Design Best way to handle an editor

Joh

Member
Hello,

I am wondering what would be the best way to handle an editor, think the GM sprite editor or room editor, paint, photoshop etc.
There's the GUI and the actual content which can be scaled, moved etc.

I can think of a few ways to go about it, but mostly want to keep it simple.
One of the problems I'm seeing are coordinates. Different canvas size lead to different x,y positions. I could recalculate position at any scale/canvas change (x/prevsize*newsize) but this seems off and prone to edge cases issues.
I could have all coordinates as % of the canvas. Seems the simplest but feels wrong, I also don't think I've seen that elswhere.

Views have the opposite problem where what you see is not representative of true positions. mouse_x/y can need conversions which is also annoying.
Surfaces are pretty much the same.

So I guess I'm calling all options unpleasant... I prefer when the x/y matches what I can see, but perhaps there's no choice here.
I already work with surfaces, so its not like I can't do it, I just thought I'd ask around for possibilities, perhaps I overlooked something or I'm overcomplicating the ideas.
Wouldn't want to re-invent the wheel or miss out on existing approaches.

Thanks!
 

Yal

šŸ§ *penguin noises*
GMC Elder
If you keep internal representations separate, you won't get edge cases from stuff like Copy Degradation (from multiple to/from conversions). If it's slightly inaccurate when drawn to the player it's not a big issue. Snap everything to the closest pixel / tile size when taking input, perhaps add a little preview box so the player knows exactly where they're editing?
 
Top