Rev 1414 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1401 | chris | 1 | using System; |
| 2 | using System.Collections.Generic; |
||
| 3 | using System.Linq; |
||
| 4 | using System.Text; |
||
| 5 | using System.Threading.Tasks; |
||
| 1408 | chris | 6 | using System.Windows.Forms; |
| 1412 | chris | 7 | using System.ComponentModel; |
| 1401 | chris | 8 | |
| 9 | using BauzoidNET.graphics.sprite; |
||
| 10 | |||
| 11 | namespace ShapeEditor.file.shapes |
||
| 12 | { |
||
| 13 | public abstract class BaseShapeElement |
||
| 14 | { |
||
| 1412 | chris | 15 | [Browsable(false)] |
| 1402 | chris | 16 | public string ShapeName { get; set; } |
| 1401 | chris | 17 | |
| 1533 | chris | 18 | |
| 19 | private int mStartFrame = -1; |
||
| 20 | public int StartFrame |
||
| 21 | { |
||
| 22 | get |
||
| 23 | { |
||
| 24 | return mStartFrame; |
||
| 25 | } |
||
| 26 | set |
||
| 27 | { |
||
| 28 | mStartFrame = value; |
||
| 29 | UpdateName(); |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | private int mEndFrame = -1; |
||
| 34 | public int EndFrame |
||
| 35 | { |
||
| 36 | get |
||
| 37 | { |
||
| 38 | return mEndFrame; |
||
| 39 | } |
||
| 40 | set |
||
| 41 | { |
||
| 42 | mEndFrame = value; |
||
| 43 | UpdateName(); |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 1402 | chris | 47 | protected Document mDocument = null; |
| 1401 | chris | 48 | |
| 1402 | chris | 49 | public BaseShapeElement(Document doc, string name) |
| 1401 | chris | 50 | { |
| 1402 | chris | 51 | mDocument = doc; |
| 52 | ShapeName = name; |
||
| 1401 | chris | 53 | } |
| 54 | |||
| 1533 | chris | 55 | public string GetFrameRangeStr() |
| 56 | { |
||
| 57 | return "[" + StartFrame + ".." + EndFrame + "] "; |
||
| 58 | } |
||
| 59 | |||
| 60 | public bool IsInFrameRange(int frame) |
||
| 61 | { |
||
| 62 | if ((StartFrame == -1) || (EndFrame == -1)) |
||
| 63 | return true; |
||
| 64 | |||
| 65 | return ((frame >= StartFrame) && (frame <= EndFrame)); |
||
| 66 | } |
||
| 67 | |||
| 68 | public void WriteFrameRange(System.IO.TextWriter tw) |
||
| 69 | { |
||
| 70 | tw.WriteLine("frameRange " + StartFrame + ", " + EndFrame + ";"); |
||
| 71 | } |
||
| 72 | |||
| 73 | public abstract string GetName(); |
||
| 74 | public abstract void UpdateName(); |
||
| 75 | |||
| 1408 | chris | 76 | public abstract void Render(SpriteTransform transform); |
| 77 | public abstract void RenderSelected(SpriteTransform transform, bool drawHandles = true); |
||
| 1405 | chris | 78 | public abstract int GetNumHandles(); |
| 1408 | chris | 79 | public abstract int FindHandleAt(float x, float y); |
| 1405 | chris | 80 | |
| 1408 | chris | 81 | public abstract bool IsInside(float x, float y); |
| 1406 | chris | 82 | |
| 1405 | chris | 83 | public abstract void DragHandle(int handle, float dx, float dy); |
| 1406 | chris | 84 | public abstract void DragMove(float dx, float dy); |
| 1405 | chris | 85 | public abstract void FixCoordinates(); |
| 86 | |||
| 1408 | chris | 87 | public abstract Cursor GetCursor(int handle); |
| 88 | |||
| 1414 | chris | 89 | public abstract void WriteFile(System.IO.TextWriter tw); |
| 90 | |||
| 1401 | chris | 91 | } |
| 92 | } |