At first I thought it was a good idea to just be able to toggle between the game and editing a level while in gameplay mode. Quickly I found that this was not ideal and I really need a separate mode. That’s not a problem or anything. What became a problem is my way of implementing it haha.
I thought it would be a good idea to just keep track of the entities instead of including the whole level state inside the editor state. However the AddLowEntity and other entity creation functions all work with the level state struct. My editor state became basically a copy of the level state, so I decided to just include the level state inside the editor state. I think the naming of the level state struct was just misleading me. As it has "mode" in the name, while it’s now not only for the level or gameplay mode anymore.
So I basically undid all the work and then quickly got back to a working state. It’s really an early start still, but I already see the possibilities. I think the debug view will help me greatly here, adding some buttons to load a level or create (and place) trees in a level. All those things are now not far away I think.
What excites me the most is looking into the tile map creation and saving the level as a file. As a first test I can probably just write out the whole binary to disk and then try to load it into a game instance. Though I expect that way of saving to not be very robust for cross-platform stuff. But that’s also where the fun comes in. Finding out how to solve such issues 🙂