Game Develop C++ Platform: SpriteObjectEditor.h Source File

| Game Develop C++ Platform Platform for developing native games based on OpenGL and SFML with Game Develop

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
SpriteObjectEditor.h
Go to the documentation of this file.
1
5 #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
6 #ifndef SPRITEOBJECTEDITOR_H
7 #define SPRITEOBJECTEDITOR_H
8
9 //(*Headers(SpriteObjectEditor)
10 #include <wx/listctrl.h>
11 #include <wx/treectrl.h>
12 #include <wx/sizer.h>
13 #include <wx/stattext.h>
14 #include <wx/menu.h>
15 #include <wx/treelist.h>
16 #include <wx/aui/aui.h>
17 #include <wx/panel.h>
18 #include <wx/scrolbar.h>
19 #include <wx/dialog.h>
20 #include <wx/timer.h>
21 //*)
22 #include <wx/dnd.h>
23 #include <vector>
24 namespace gd { class MainFrameWrapper; }
25 class ResourcesEditor;
26 class SpriteObject;
27 namespace gd { class Resource; }
28 namespace gd { class Project; }
29 class Sprite;
30
34 class SpriteObjectEditor: public wxDialog
35 {
36 public:
37
38 SpriteObjectEditor(wxWindow* parent, gd::Project & game, SpriteObject & object, gd::MainFrameWrapper & mainFrameWrapper_ );
39 virtual ~SpriteObjectEditor();
40
48 void AddImageToCurrentAnimation(wxString image, bool refresh = true);
49
50 //(*Declarations(SpriteObjectEditor)
51 wxAuiManager* AuiManager1;
52 wxMenu* MenuItem2;
53 wxTreeCtrl* animationsTree;
54 wxTreeListCtrl* maskTree;
55 wxMenuItem* MenuItem8;
56 wxListCtrl* pointsList;
57 wxPanel* toolbarPanel;
58 wxAuiToolBar* toolbar;
59 wxMenuItem* MenuItem7;
60 wxAuiToolBar* pointToolbar;
61 wxAuiManager* mgr;
62 wxAuiManager* AuiManager4;
63 wxStaticText* statusTxt;
64 wxMenuItem* MenuItem5;
65 wxPanel* centerPanel;
66 wxMenuItem* deleteItem;
67 wxMenuItem* MenuItem1;
68 wxMenuItem* MenuItem4;
69 wxMenuItem* MenuItem11;
70 wxPanel* Panel1;
71 wxMenu animationsMenu;
72 wxMenuItem* MenuItem10;
73 wxAuiManager* AuiManager2;
74 wxMenuItem* removeImageItem;
75 wxPanel* Panel3;
76 wxAuiToolBar* maskToolbar;
77 wxPanel* animationsPanel;
78 wxMenuItem* MenuItem12;
79 wxScrollBar* xScrollBar;
80 wxTimer previewTimer;
81 wxMenuItem* MenuItem3;
82 wxAuiManager* AuiManager3;
83 wxPanel* imagePanel;
84 wxScrollBar* yScrollBar;
85 wxMenu emptyImagesMenu;
86 wxMenuItem* moveLeftItem;
87 wxMenuItem* MenuItem6;
88 wxPanel* previewPanel;
89 wxPanel* maskPanel;
90 wxMenuItem* moveRightItem;
91 wxPanel* Panel2;
92 wxMenuItem* automaticRotationItem;
93 wxPanel* pointsPanel;
94 wxMenuItem* MenuItem9;
95 wxMenuItem* multipleDirectionsItem;
96 wxListCtrl* imagesList;
97 wxMenu imagesMenu;
98 wxMenu maskMenu;
99 wxPanel* imagesPanel;
100 wxAuiToolBar* animationToolbar;
101 //*)
102 ResourcesEditor * resourcesEditorPnl;
103
104 protected:
105
106 //(*Identifiers(SpriteObjectEditor)
107 static const long ID_MASKITEM;
108 static const long ID_POINTSITEM;
109 static const long ID_AUITOOLBARITEM4;
110 static const long ID_AUITOOLBARITEM2;
111 static const long ID_AUITOOLBAR1;
112 static const long ID_PANEL6;
113 static const long ID_PANEL4;
114 static const long ID_SCROLLBAR1;
115 static const long ID_SCROLLBAR2;
116 static const long ID_STATICTEXT1;
117 static const long ID_PANEL1;
118 static const long ID_AUITOOLBARITEM5;
119 static const long ID_AUITOOLBARITEM8;
120 static const long ID_TOOLLOOP;
121 static const long ID_AUITOOLBARITEM10;
122 static const long ID_AUITOOLBAR4;
123 static const long ID_PANEL11;
124 static const long ID_TREECTRL1;
125 static const long ID_PANEL3;
126 static const long ID_LISTCTRL1;
127 static const long ID_PANEL2;
128 static const long ID_AUITOOLBARITEM9;
129 static const long ID_AUITOOLBARITEM11;
130 static const long ID_AUITOOLBARITEM7;
131 static const long ID_AUITOOLBARITEM1;
132 static const long ID_MASKAPPLYWHOLEANIMITEM;
133 static const long ID_AUITOOLBAR3;
134 static const long ID_PANEL9;
135 static const long ID_TREELISTCTRL1;
136 static const long ID_PANEL8;
137 static const long ID_AUITOOLBARITEM3;
138 static const long ID_DELETEPOINTITEM;
139 static const long ID_POINTAPPLYWHOLEANIMITEM;
140 static const long ID_AUITOOLBAR2;
141 static const long ID_PANEL7;
142 static const long ID_LISTCTRL3;
143 static const long ID_PANEL5;
144 static const long ID_PANEL10;
145 static const long ID_MENUITEM5;
146 static const long ID_MENUITEM6;
147 static const long ID_MENUITEM4;
148 static const long ID_MENUTIMEBETWEENFRAMES;
149 static const long ID_MENULOOP;
150 static const long ID_MENUITEM1;
151 static const long ID_MENUITEM2;
152 static const long ID_MENUITEM3;
153 static const long ID_MENUITEM7;
154 static const long ID_MENUITEM11;
155 static const long ID_MENUITEM8;
156 static const long ID_MENUITEM9;
157 static const long ID_MENUITEM10;
158 static const long ID_POSITIONMASKITEM;
159 static const long ID_MOVEPOLYGONITEM;
160 static const long ID_MENUITEM14;
161 static const long ID_TIMER1;
162 static const long ID_MENUITEM12;
163 static const long ID_MENUITEM13;
164 //*)
165
166 private:
167
168 //(*Handlers(SpriteObjectEditor)
169 void OnimagePanelPaint(wxPaintEvent& event);
170 void OnimagePanelEraseBackground(wxEraseEvent& event);
171 void OnimagesListItemSelect(wxListEvent& event);
172 void OnimagePanelResize(wxSizeEvent& event);
173 void OnanimationsTreeSelectionChanged(wxTreeEvent& event);
174 void OnAddAnimationSelected(wxCommandEvent& event);
175 void OnDeleteAnimationSelected(wxCommandEvent& event);
176 void OnanimationsTreeItemRightClick(wxTreeEvent& event);
177 void OnautomaticRotationItemSelected(wxCommandEvent& event);
178 void OnmultipleDirectionsItemSelected(wxCommandEvent& event);
179 void OnimagesListItemRClick(wxListEvent& event);
180 void OnremoveImageItemSelected(wxCommandEvent& event);
181 void OnMoveLeftSelected(wxCommandEvent& event);
182 void OnMoveRightSelected(wxCommandEvent& event);
183 void OnMaskEditClick(wxCommandEvent& event);
184 void OnPointEditClick(wxCommandEvent& event);
185 void OnmgrPaneClose(wxAuiManagerEvent& event);
186 void OnpointsListBeginLabelEdit(wxListEvent& event);
187 void OnpointsListEndLabelEdit(wxListEvent& event);
188 void OnimagePanelLeftUp(wxMouseEvent& event);
189 void OnpointsListItemSelect(wxListEvent& event);
190 void OnDeletePointClick(wxCommandEvent& event);
191 void OnAddPointClick(wxCommandEvent& event);
192 void OnpointsListItemActivated(wxListEvent& event);
193 void OnimagePanelLeftDown(wxMouseEvent& event);
194 void OnimagePanelMouseMove(wxMouseEvent& event);
195 void OnAddMaskClick(wxCommandEvent& event);
196 void OnDeleteMaskClick(wxCommandEvent& event);
197 void OnDefaultMaskClick(wxCommandEvent& event);
198 void OnPositionMaskSelected(wxCommandEvent& event);
199 void OnResizeMaskSelected(wxCommandEvent& event);
200 void OnMenuLoopSelected(wxCommandEvent& event);
201 void OnTimeBetweenFramesSelected(wxCommandEvent& event);
202 void OnpreviewPanelEraseBackground(wxEraseEvent& event);
203 void OnpreviewPanelResize(wxSizeEvent& event);
204 void OnpreviewPanelPaint(wxPaintEvent& event);
205 void OnTimer1Trigger(wxTimerEvent& event);
206 void OnpreviewTimerTrigger(wxTimerEvent& event);
207 void OnPreviewClick(wxCommandEvent& event);
208 void OnimagesListKeyDown(wxListEvent& event);
209 void OnAddImageFromFileSelected(wxCommandEvent& event);
210 void OnAddFromImageBankSelected(wxCommandEvent& event);
211 void OnHelpClick(wxCommandEvent& event);
212 void OnToolLoopClick(wxCommandEvent& event);
213 void OnMovePolygonSelected(wxCommandEvent& event);
214 void OnAddPolygonMaskClick(wxCommandEvent& event);
215 void OnAddVerticeClick(wxCommandEvent& event);
216 void OnRotatePolygonSelected(wxCommandEvent& event);
217 void OnyScrollBarScroll(wxScrollEvent& event);
218 void OnxScrollBarScroll(wxScrollEvent& event);
219 //*)
220 void OnmaskTreeItemRClick(wxTreeListEvent& event);
221 void OnmaskTreeItemActivated(wxTreeListEvent& event);
222 void OnmaskTreeSelectionChanged(wxTreeListEvent& event);
223 void OnimagesListRightClick(wxMouseEvent& event);
224 void RefreshAll();
225 void RefreshAnimationTree();
226 void RefreshAnimationToolbar();
227 void RefreshImagesList();
228 void RefreshImageAndControls();
229 void RefreshPoints();
230 void RefreshCollisionMasks();
231 void ResetPreview();
232 wxBitmap GetwxBitmapFromImageResource(gd::Resource & resource);
233
241 std::vector < Sprite * > GetSpritesToModify();
242
243 DECLARE_EVENT_TABLE()
244
245 gd::Project & game;
246 SpriteObject & object;
247 unsigned int selectedAnimation;
248 unsigned int selectedDirection;
249 unsigned int selectedImage;
250 std::string selectedPoint;
251 float spritePosX;
252 float spritePosY;
253 float spriteWidth;
254 float spriteHeight;
255
256 bool editingMask;
257 bool editingPoint;
258
259 std::string renamedPointOldName;
260
261 bool movingPolygon;
262 unsigned int selectedPolygon;
263 bool movingPolygonPoint;
264 unsigned int selectedPolygonPoint;
265 float xSelectionOffset;
266 float ySelectionOffset;
267
268 float previewElapsedTime;
269 int previewCurrentSprite;
270
271 gd::MainFrameWrapper & mainFrameWrapper;
272 };
273
277 class DndTextSpriteObjectEditor : public wxTextDropTarget
278 {
279 public:
280 DndTextSpriteObjectEditor(SpriteObjectEditor & editor_) : editor(editor_) {}
281
282 virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text);
283
284 private:
285
286 SpriteObjectEditor & editor;
287 };
288 #endif
289 #endif
290