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