RFMOTS: Refactor for More of the Same

Today’s update is pretty minimal as far as progress is concerned. The state of things is the same as it was in yesterday’s update, but the code that does it now looks TOTALLY different. Assuming that it being the same code but in a different layout makes it in any way different.

One thing that did change was that I modified the engine so that the code that creates screen shots is in the Stage class and not the Scene class. I noticed last night that I had to temporarily cram some code into the title scene and game over scene to be able to easily generate a screen shot in those scenes. It seems weird that you can only capture a screen shot in some scenes and annoying that you have to enter code everywhere to make it happen in every scene.

Accordingly the default key handler for Scene universally returns false and does nothing EXCEPT when the key pressed is F5, in which case it generates a screen shot. All scenes in the game now take advantage of this.

Back to the menu code, basically what we have now is a subclass of Entity with a couple of methods for adding menu items and changing the selection. I spent a bit of time going in a different direction with this before deciding that the easiest way to incorporate the menu would be to treat it like an entity, since the rendering and update calls we need get made “for free”, as it were.

Next steps are probably to use this to implement a menu on the game over screen, and clean this up a bit.