Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate the polygon editor from the sprite editor #18

Closed
victorlevasseur opened this issue Sep 13, 2014 · 4 comments
Closed

Separate the polygon editor from the sprite editor #18

victorlevasseur opened this issue Sep 13, 2014 · 4 comments

Comments

@victorlevasseur
Copy link
Contributor

Hi,
I've created that issue to discuss the way the polygon will be separated from the sprite editor.
For me, it can be made using a main class called, for example, PolygonEditor (maybe it's not a good idea of name as it's not a standalone editor, but an helper plugged to a wxPanel of wxScrolledWindow) or PolygonEditionHelper.
Then, the class will contain some functions that we will call from the Panel/ScrolledWindow using it : DrawEditor(wxDC&, wxPoint offset), OnLeftDownEvent(wxMouseEvent&) to be called from the Panel when the left mouse button is pressed.
Also, the class will contain the polygon "treeview" editor (to be added manually to its AuiManager or automatically from the ctor ?)

@victorlevasseur
Copy link
Contributor Author

In fact, the class can't contain the polygon treeview editor as it contains some specific Sprite features such as copying the mask to the whole animation and so on...

@4ian
Copy link
Owner

4ian commented Sep 14, 2014

A PolygonEditorHelper class would be still nice I think :) It should provide as you said so feature so that it can be connected to a wxPanel (the poloygon editor helper should be agnostic regarding what is displayed inside the panel: it should just draw the polygon and the anchors, and handle events using its OnLeftDownEvent method).

For the treeview, it may be excluded from this refactoring for now.. Maybe it could be included just after, and provide a separate method to customize the toolbar (so that the sprite editor can add its own buttons in the toolbar :) )

@victorlevasseur
Copy link
Contributor Author

Currently working on it on my fork's polygon-edition-helper branch.
I've made the choice to pass almost all the required stuff (vector of polygons, offset, maximum polygon point position) in each functions (OnPaint, OnMouseLeftDown, OnMouseMove, ...) to make it work easily with the sprite editor (as the mask is got again and again in each editor's functions).
So the PolygonEditionHelper is restricted only to the drawing and to the point drag&drop without owning the polygons and even a pointer to the polygons.
I plan to do almost a similar thing for the Tree view but it'll come afterwards.

@4ian
Copy link
Owner

4ian commented Sep 16, 2014

Excellent choice, I think it's the best choice to make for a helper class
(having methods that can be simply used by a call with all the necessary
argument). It will be easy to plug this helper class into the already
existing sprite editor !

Keep up the good work, let me know if you need help on a particular point :)

D8H pushed a commit that referenced this issue May 3, 2023
Use same context, render texture and rendering types to optimise 2D/3D rendering of many layers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants