It's been a while since I last posted an update on my lua based GUI. That was the second time that I have rewrote it. Now I'm on my third rewrite. This time the reason is that I am using the Lua OOP module Averice has made available. My GUI was already object oriented but it was messy to code. Now it looks sensible and has much less code.
I have no pretty images to show but I will detail some of the major structural changes and concepts that i have employed.
I no longer use the require keyword. I use the import command now since it plays better with the lua sandbox and can be used in the workshop games
Window Manager Changes
If you have followed the development of this gui, you may already know that there is a window manager that controls all the states of the windows. This was so that programmers can have multiple window managers that have different interfaces (think game menu gui, and in-game computer interfaces). Now there a window manager manager (collect all the things!). This allows the programmer to have a system that will manager and update all of the window managers autonomously if they so choose.
Drawing
Before, each component (windows, buttons, etc..), did their own drawing. This was fine for the most part, but this limited me to the Leadwerks line and box command. Now I use
to allow me to draw whatever shape I want to. There is an almost negligible performance hit, since it has to process the shape and scan-line draw the image. This will also allow me to use the point in polygon algorithm to select items, creating the possibility of selecting non square objects with the mouse.
Abstraction
Along with changing the drawing, I have abstracted all drawing to a single class. This class contains all the drawing and text commands that the gui uses. This makes the gui more portable and if Leadwerks changes something there will only be one location to change them instead of multiple places.
The rewrite should take substantially less time, and with the new class system adding components should be easier and faster.
2 Comments
Recommended Comments