Game Menu
Now we are on board the ship of hardcore coding and have just started sailing. We are now ready with the GUI of the game-the menu of the game which handles the game parameters.
We started building it from scratch by taking reference from book- Beginning XNA Programming, from Novice to Professional by Alexandre Lobao and others. Our Intern programmer from DDIT was assigned this task to learn how to go about building the menu and his contribution did help us.
We made a general menu initially which gave us the idea about the functioning of menu. We took the approach of Game Components in which every screen was added to the game as a game component. Through this we acquired the knowledge about important features of XNA like Game Components and Game Services.
We also got to know about controlling Sound, display modes and keyboard controls. Dealing with File input/input and mouse was also a part of the learning process so now we were familiar with that also.
Then we began the main programming of our game specific menu but by following the reference as mentioned above we were facing memory issues as every menu screen was added as a game Component which consumed some space in memory and the code would get more and more complex as the number of menu screens would increase. So now we had to think of a very simple way to develop and handle menu because if menu itself would be so complex then mounting the whole game would lead severe memory issues.
We took the approach of a controller which controls the rendering and hiding of menu screen and passing controls to respective screen. The only game component added was the controller which when required to display a screen, would load its contents on run time and would display the screen. This reduced a lot of memory overload as only the visible contents were loaded in game and others are not. This also made our code very simple as in from only a single class – the class of the controller we could manage all the game screens.
Having a simple skeleton ready for the menu, adding the different functionality was not a major task as due to prior knowledge of the audio, display, mouse etc, it was just like fixing the spare parts of the motor engine in proper place. This reduced the development time and effort. Now we will move on to developing the first level of the game.