snestracker icon indicating copy to clipboard operation
snestracker copied to clipboard

Widget Editor

Open bazz1tv opened this issue 4 years ago • 0 comments

TL;DR

Use some class definition that gives abstract access to each widget's rect coordinates. The widgets can be repositioned and saved to a gui design file.

In order for the widgets to be able to be repositioned, the code that calculates the positions of the widget's subelements needs to be put into a public function that we can call from the abstract class. The widget must inherit from that class.

Something like this:

class Widget
{
public:
  virtual void setPos(int x, int y);
  SDL_Rect rect;
};

Basically plug that into Meatball's level editor.

Once this design file is initially output, rewrite meatball to load it's gui from it, or an internal default if none present.

This touches on another code design I want to improve which is file formatting. I'm starting to lean towards XML!

Waffle

One of the ugliest things about snestracker in my opinion is the widget positioning and sizing code (view). Through a crazy use of relative positioning, I was able to get the initial layout established.

There's also a direct use of the current font's fixed tile width and height that goes into all of the widget positioning calculations. Not flexible at all!

That being said, I guess widget rendering flexibility with regard to font size is an issue for another day, that will be coupled other related issues (unicode support, ttf fonts - these issues are not yet filed).

Even with the said inflexibility, a gui editor would be neat.

One of my hopes is that efforts here also bare fruit for the level editor in meatball. For example, there is currently no way to select items from a menu. This seems rather meatball-specific though. There must be something, though.. I've got it! An undo buffer! And this undo buffer should also serve to guide the way for The Pattern Editor's undo buffer!

bazz1tv avatar Jun 07 '20 04:06 bazz1tv