menustate.c

Go to the documentation of this file.
00001 
00025 #include "color.h"
00026 #include "genconmac.h"
00027 #include "menustate.h"
00028 #include "netstat.h"
00029 #include "states.h"
00030 #include "teamsel.h"
00031 #include <stdlib.h>
00032 
00033 MenuSettings *menuSettings = NULL;
00034 
00040 static MenuItem *menu;
00041 
00042 int MenuRootInit() {
00043     int loop;
00044     // set the text color
00045     colorFmtInd[COLOR_TEXT] = colorFmtInd[COLOR_BLACK];
00046     // get some memory and render text
00047     if (!(menuSettings = calloc(1, sizeof(MenuSettings))) ||
00048     !(menu = calloc(2, sizeof(MenuItem))) || !TextSetupStateMenu()) {
00049         // could not allocate the memory or text could not be prepared
00050         return STATE_ERROR;
00051     }
00052     // reset layer offsets
00053     for (loop = 0; loop < LAYER_MAX; loop++) {
00054         layers[loop].offX = layers[loop].offY = 0;
00055     }
00060     // initialize menu items
00061     TeamSelInit(menu);
00062     if (!NetStatInit(menu + 1)) return STATE_ERROR;
00063     // initalize the menu
00064     SetupMenu(menu, 0, 2);
00065     return STATE_OK;
00066 }
00067 
00068 int MenuRootUninit() {
00069     NetStatUninit(menu + 1);
00070     TeamSelUninit(menu);
00071     RemoveMenu();
00072     free(menu);
00073     TextUnsetState();
00074     return STATE_OK;
00075 }
00076 

Generated on Mon May 28 04:41:39 2007 for Retro Tank Super Attack by  doxygen 1.5.2