Day Three

Continuing from where I left off. I forgot to document what i did on the second day.

I started the day, separating the current source file into separate units, and header files, so once for Home/About, and then one for the Game, and updating the Visual Studio Solution and GNU Makefile to match. Next I finally wrote the lines that would be displayed in the About and added the code to render them to the screen.

As I was writing the framework/skeleton for the Game file, I realized i had a limitation in my current design that was it wasn’t flexible enough for more actions on the States, since there was just 2 arrays, 1 for the Events Handling, and 1 for the Rendering, so I re factored this up to be an Array of a State Structure which contains pointers to the event and rendering functions, and added a initialization and deinitialization callback. Following that instead of having all the different functions like DrawMenu, DrawAbout, EventMenu, being seen by the rest, I exposed a SetupMenu, SetupAbout which takes a state structure pointer, and then that is responsible for setting the callback handler to those methods. This made the header for the Home [Menu and About], just 2 functions instead of 4 (it would of been 6 functions with the Init/Deinit). Few other little things in the design was changed to lock things down further.

The whole time I forgot to actually commit the C source and header for the actually Game State, my bad. Final thing for the day was implement the rendering and displaying of the Score and Lives, followed by fixing some memory leaks of un-freed memory.

Sorry no screen shots for this, the game screen is not much to look at.