xml menu support

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@1651 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 99df39ca5788e6cd60109a93bdae5e83d6f20b4a
Former-commit-id: 759924b9c1adf8590f15e7d20d6b82cad125badc
This commit is contained in:
briangr 2009-10-22 23:36:15 +00:00
parent 0dec4e3c0e
commit 760c8742a0
5 changed files with 35 additions and 8 deletions

View file

@ -66,6 +66,31 @@ MainMenuActivate(void * /* dummy */)
* Remarks
*
*/
int
MainMenuInit(void)
{
menuHandle = GfuiScreenCreateEx((float*)NULL,
NULL, MainMenuActivate,
NULL, (tfuiCallback)NULL,
1);
void *param = LoadMenuXML("welcomemenu.xml");
CreateStaticControls(param,menuHandle);
//Add buttons and create based on xml
CreateButtonControl(menuHandle,param,"race",ReSinglePlayerInit(menuHandle), GfuiScreenActivate);
CreateButtonControl(menuHandle,param,"configure",DriverMenuInit(menuHandle),GfuiScreenActivate);
CreateButtonControl(menuHandle,param,"options",OptionOptionInit(menuHandle),GfuiScreenActivate);
CreateButtonControl(menuHandle,param,"credits",menuHandle,CreditsScreenActivate);
CreateButtonControl(menuHandle,param,"quit",MainExitMenuInit(menuHandle), GfuiScreenActivate);
GfuiMenuDefaultKeysAdd(menuHandle);
return 0;
}
/*
int
MainMenuInit(void)
{
@ -106,7 +131,7 @@ MainMenuInit(void)
return 0;
}
*/
/*
* Function
*

View file

@ -56,15 +56,17 @@ gfuiColorInit(void)
void *hdle;
int i, j;
const char *rgba[4] = {GFSCR_ATTR_RED, GFSCR_ATTR_GREEN, GFSCR_ATTR_BLUE, GFSCR_ATTR_ALPHA};
const char *clr[GFUI_COLORNB] = {
GFSCR_ELT_BGCOLOR, GFSCR_ELT_TITLECOLOR, GFSCR_ELT_BGBTNFOCUS, GFSCR_ELT_BGBTNCLICK,
GFSCR_ELT_BGBTNENABLED, GFSCR_ELT_BGBTNDISABLED, GFSCR_ELT_BTNFOCUS, GFSCR_ELT_BTNCLICK,
GFSCR_ELT_BTNENABLED, GFSCR_ELT_BTNDISABLED, GFSCR_ELT_LABELCOLOR, GFSCR_ELT_TIPCOLOR,
GFSCR_ELT_MOUSECOLOR1, GFSCR_ELT_MOUSECOLOR2, GFSCR_ELT_HELPCOLOR1, GFSCR_ELT_HELPCOLOR2,
GFSCR_ELT_BGSCROLLIST, GFSCR_ELT_SCROLLIST, GFSCR_ELT_BGSELSCROLLIST, GFSCR_ELT_SELSCROLLIST,
GFSCR_ELT_EDITCURSORCLR
GFSCR_ELT_EDITCURSORCLR, GFSCR_ELT_LABELCOLORDRIVERCONFIG, GFSCR_ELT_BASECOLORBGIMAGE, GFSCR_ELT_EDITBOXCOLOR,
GFSCR_ELt_LABELCOLOROPTIONS, GFSCR_ELT_TABLEHEADER
};
sprintf(buf, "%s%s", GetLocalDir(), GFSCR_CONF_FILE);
hdle = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
@ -196,7 +198,7 @@ GfuiDisplay(void)
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor3f(0.0, 0.0, 1.0);
glColor3f(GfuiColor[GFUI_BASECOLORBGIMAGE][0],GfuiColor[GFUI_BASECOLORBGIMAGE][1],GfuiColor[GFUI_BASECOLORBGIMAGE][2]);
glBindTexture(GL_TEXTURE_2D, GfuiScreen->bgImage);
glBegin(GL_QUADS);
glTexCoord2f(tx1, ty1); glVertex3f(0.0, 0.0, 0.0);

View file

@ -21,7 +21,7 @@
#include "guifont.h"
#define GFUI_COLORNB 21
#define GFUI_COLORNB 26
extern float GfuiColor[GFUI_COLORNB][4];
#define GFUI_BGCOLOR 0

View file

@ -755,11 +755,11 @@ void *
LoadMenuXML(const char *pMenuPath)
{
std::string strPath = pMenuPath;
strPath = "config/"+strPath;
strPath = "menu/"+strPath;
void *param = NULL;
char buf[1024];
sprintf(buf, "%s%s", GetLocalDir(),strPath.c_str());
sprintf(buf, "%s%s", GetDataDir(),strPath.c_str());
param = GfParmReadFile(buf, GFPARM_RMODE_STD);
return param;

View file

@ -2,7 +2,7 @@
<!DOCTYPE params SYSTEM "params.dtd">
<params name="Screen" version="0.33">
<params name="Screen" version="0.51">
<section name="Screen Properties">
<attnum name="x" val="800"/>
<attnum name="y" val="600"/>