Abstracting some Logic in my engine
May 7, 2025
I removed the shader maker mode for now and started working on the shader editor mode. The implementation is already working so now I can use the engine to work on my shader scripts. There is a live update feature that I can toggle on or off to see changes. Also I added a button to insert a template into the editor, as well as a way to save the script when you’re done working on it. I need to make a way to load scripts into the editor as well. Shouldn’t be too hard since I already did this with the template as it’s being pulled from a glsl file.
I’m working on separating some of the logic in the code and I’ve abstracted the GUI and Panels into their own classes. The GUI has a reference to the base panel class and when we want to change modes I can call the SwitchMode() function and pass in the Inherited Panel class based on what PanelType enum was passed into the function as an argument. This function sets up the panel for the current mode and in the main loop the panel is rendered by calling the virtual RenderPanel() function which is overridden by the derived classes.
However I need to abstract this further, I need to create a mode state machine that is in charge of what mode is active and this state machine would also be in charge of changing the current panel(s), since I don’t want to be limited to only one panel per mode.
Changes to make:
add state machine
Blog
Kero Mena