The level editor now supports multiple rooms.
Added a GameMenu class to ResistorKit, since that is a feature that I commonly use on many screens. The GameMenu class keeps track of the set of menu items and which item is selected. It handles rotating the selection back to the top when down is pressed on the last item or selects the last item when up is pressed on the first item. This way I don’t have to rewrite this code on each screen that has a menu.
I expanded the menu system to draw the menu at a given position using a specified font, which are passed as parameters. The text color and highlight color can be set using the appropriate method calls. The spacing between menu items can also be set with a method call. One feature I would like to add is passing the menu item action as a function parameter for each menu item, but the C Sharp way for passing function/method parameters wasn’t clear to me. I did find some documentation on using Func or delegates, but I don’t want to invest time in figuring those out now. Therefore, executing the action must be handled on the game screen using the getSelectedItem method that I created to return the index of the currently selected menu item.
The title screen has been updated to use the ResistorKit GameMenu class, and it takes advantage of the text and highlight color setting methods. Currently, default text is black and highlighted text is green.
Level Editor Modifications
Updated the level editor so it now supports multiple rooms. When the level editor is started it creates a default room that is the head of the list of rooms. Pressing A will add a block to the room. Pressing RB will add a new room to the end of the list. Pressing start will add all created rooms to the game world. Currently, a room can’t be edited once it has been added, but that is a feature I plan to add. I will also need to add a method for navigating through the currently created maps. Then I will probably make RB create a room to the right and LB create a room to the left of the currently selected room.
A preview of all levels is now displayed at the top of the level editor screen. This preview expands as new rooms are added. The room ID is also displayed in the upper right corner for each preview, but I may remove that in the final release.