This repository has been archived by the owner on Feb 6, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gif exporting will be improved soon.
- Loading branch information
Evar Smith
authored and
Evar Smith
committed
Aug 20, 2015
1 parent
9b24a65
commit 7c2326d
Showing
17 changed files
with
488 additions
and
230 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
using System; | ||
using System.Drawing; | ||
using System.IO; | ||
using TISFAT.Util; | ||
|
||
namespace TISFAT.Entities | ||
{ | ||
public class BitmapObject : IEntity | ||
{ | ||
public Bitmap Texture; | ||
public int TextureID; | ||
|
||
public class State : IEntityState | ||
{ | ||
public RectangleF Bounds; | ||
|
||
public State() { } | ||
|
||
public IEntityState Copy() | ||
{ | ||
State state = new State(); | ||
state.Bounds = new RectangleF(Bounds.Location, Bounds.Size); | ||
return state; | ||
} | ||
|
||
public void Write(BinaryWriter writer) | ||
{ | ||
|
||
} | ||
|
||
public void Read(BinaryReader reader, UInt16 version) | ||
{ | ||
|
||
} | ||
} | ||
|
||
public BitmapObject() { } | ||
|
||
public IEntityState Interpolate(float t, IEntityState _current, IEntityState _target) | ||
{ | ||
State current = _current as State; | ||
State target = _target as State; | ||
State state = new State(); | ||
|
||
state.Bounds = Interpolation.Linear(t, current.Bounds, target.Bounds); | ||
|
||
return state; | ||
} | ||
|
||
public void Draw(IEntityState _state) | ||
{ | ||
State state = _state as State; | ||
Drawing.Bitmap(state.Bounds.Location, state.Bounds.Size, TextureID); | ||
} | ||
|
||
private void DrawHandle(State state, Color c) | ||
{ | ||
float size = Math.Min(12, Texture.Width / 2); | ||
|
||
Drawing.RectangleLine(state.Bounds.Location, state.Bounds.Size, c); | ||
Drawing.Rectangle(new PointF(state.Bounds.Left, state.Bounds.Top), new SizeF(size, size), c); | ||
Drawing.Rectangle(new PointF(state.Bounds.Right - size, state.Bounds.Top), new SizeF(size, size), c); | ||
Drawing.Rectangle(new PointF(state.Bounds.Left, state.Bounds.Bottom - size), new SizeF(size, size), c); | ||
Drawing.Rectangle(new PointF(state.Bounds.Right - size, state.Bounds.Bottom - size), new SizeF(size, size), c); | ||
} | ||
|
||
public void DrawEditable(IEntityState _state) | ||
{ | ||
State state = _state as State; | ||
|
||
Drawing.Bitmap(state.Bounds.Location, state.Bounds.Size, TextureID); | ||
DrawHandle(state, Color.Cyan); | ||
} | ||
|
||
public ManipulateResult TryManipulate(IEntityState state, Point location, System.Windows.Forms.MouseButtons button, System.Windows.Forms.Keys modifiers) | ||
{ | ||
return null; | ||
} | ||
|
||
public void ManipulateStart(IManipulatable target, IManipulatableParams mparams, Point location) | ||
{ | ||
|
||
} | ||
|
||
public void ManipulateUpdate(IManipulatable target, IManipulatableParams mparams, Point location) | ||
{ | ||
|
||
} | ||
|
||
public void ManipulateEnd(IManipulatable target, IManipulatableParams mparams, Point location) | ||
{ | ||
|
||
} | ||
|
||
public IEntityState CreateRefState() | ||
{ | ||
return new State() { Bounds = new RectangleF(10, 10, Texture.Width, Texture.Height) }; | ||
} | ||
|
||
public void Write(BinaryWriter writer) | ||
{ | ||
|
||
} | ||
|
||
public void Read(BinaryReader reader, UInt16 version) | ||
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.