forked from speed-dreams/speed-dreams-code
Network play menu improvements.
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2303 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 3b3d2b8f642c244031b9a4c2629f0865179cef3f Former-commit-id: 32d46453657db129c50055a7d964b577657c76df
This commit is contained in:
parent
f4aae21bab
commit
a8287e6b03
5 changed files with 44 additions and 35 deletions
|
@ -64,11 +64,12 @@ bool CarMenuSettings::Init(void* pMenu,const char *pszCar)
|
|||
NULL, (tfuiCallback)NULL,
|
||||
1);
|
||||
|
||||
void *param = LoadMenuXML("carsettingsmenu.xml");
|
||||
void *param = LoadMenuXML("carselectionmenu.xml");
|
||||
CreateStaticControls(param,m_pMenuHandle);
|
||||
|
||||
int carCatId = CreateComboboxControl(m_pMenuHandle,param,"carcombo",CarPickCB);
|
||||
int carImageId = CreateStaticImageControl(m_pMenuHandle,param,"carimage");
|
||||
int carCatId = CreateComboboxControl(m_pMenuHandle,param,"modelcombo",CarPickCB);
|
||||
int skinId = CreateComboboxControl(m_pMenuHandle,param,"skincombo",NULL);
|
||||
int carImageId = CreateStaticImageControl(m_pMenuHandle,param,"carpreviewimage");
|
||||
int progressId = CreateProgressbarControl(m_pMenuHandle,param,"topspeedprogress");
|
||||
int accelerationId = CreateProgressbarControl(m_pMenuHandle,param,"accelerationprogress");
|
||||
int handlingId = CreateProgressbarControl(m_pMenuHandle,param,"handlingprogress");
|
||||
|
|
|
@ -82,7 +82,7 @@ gfuiRightArrow(void *idv)
|
|||
}
|
||||
|
||||
int
|
||||
GfuiComboboxCreate(void *scr, int font, int x, int y, int width,int align ,int style,
|
||||
GfuiComboboxCreate(void *scr, int font, int x, int y, int width,int align ,int style,const char *pszText,
|
||||
tfuiComboCallback onChange)
|
||||
{
|
||||
tGfuiCombobox *combobox;
|
||||
|
@ -171,7 +171,7 @@ GfuiComboboxCreate(void *scr, int font, int x, int y, int width,int align ,int s
|
|||
int xmax = object->xmax;
|
||||
int xmin = object->xmin;
|
||||
|
||||
combobox->labelId = GfuiLabelCreate(scr,"",font,xm,ym,GFUI_ALIGN_HC_VC,99);
|
||||
combobox->labelId = GfuiLabelCreate(scr,pszText,font,xm,ym,GFUI_ALIGN_HC_VC,99);
|
||||
|
||||
|
||||
GfuiGrButtonCreate(scr, "data/img/arrow-left.png", "data/img/arrow-left.png",
|
||||
|
|
|
@ -734,8 +734,9 @@ CreateComboboxControl(void *menuHandle,void *param,const char *pControlName,tfui
|
|||
if (width == 0)
|
||||
width = 200;
|
||||
|
||||
const char* pszText = GfParmGetStr(param, strControlName.c_str(), "text", "");
|
||||
|
||||
id = GfuiComboboxCreate(menuHandle,textsize,x,y,width,align ,0,onChange);
|
||||
id = GfuiComboboxCreate(menuHandle,textsize,x,y,width,align,0,pszText,onChange);
|
||||
|
||||
Color c;
|
||||
bool bColor = GetColorFromXML(param,pControlName,"color",c);
|
||||
|
@ -791,32 +792,38 @@ CreateScrollListControl(void *menuHandle,void *param,const char *pControlName,vo
|
|||
bool
|
||||
CreateStaticControls(void *param,void *menuHandle)
|
||||
{
|
||||
char buf[32];
|
||||
if (param==NULL)
|
||||
{
|
||||
GfError("ERROR: XML menu is not loaded");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i=1; i <= GfParmGetEltNb(param, "staticcontrols"); i++)
|
||||
{
|
||||
sprintf(buf, "staticcontrols/%i", i);
|
||||
const char* pszType = GfParmGetStr(param, buf, "type", "");
|
||||
|
||||
if (!strcmp(pszType, "label"))
|
||||
{
|
||||
CreateLabel(menuHandle,param,buf);
|
||||
}
|
||||
else if (!strcmp(pszType, "staticimage"))
|
||||
{
|
||||
CreateStaticImage(menuHandle,param,buf);
|
||||
}
|
||||
else if (!strcmp(pszType, "backgroundimage"))
|
||||
{
|
||||
CreateBackgroundImage(menuHandle,param,buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
GfError("Errot: Unknown static control type '%s'\n", pszType);
|
||||
}
|
||||
}
|
||||
char buf[32];
|
||||
|
||||
return true;
|
||||
for (int i=1; i <= GfParmGetEltNb(param, "staticcontrols"); i++)
|
||||
{
|
||||
sprintf(buf, "staticcontrols/%i", i);
|
||||
const char* pszType = GfParmGetStr(param, buf, "type", "");
|
||||
|
||||
if (!strcmp(pszType, "label"))
|
||||
{
|
||||
CreateLabel(menuHandle,param,buf);
|
||||
}
|
||||
else if (!strcmp(pszType, "staticimage"))
|
||||
{
|
||||
CreateStaticImage(menuHandle,param,buf);
|
||||
}
|
||||
else if (!strcmp(pszType, "backgroundimage"))
|
||||
{
|
||||
CreateBackgroundImage(menuHandle,param,buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
GfError("Errot: Unknown static control type '%s'\n", pszType);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ extern int GfuiGrButtonCreateEx(void *scr, const char *disabled, const char *ena
|
|||
int x, int y, int imageWidth,int imageHeight,int align, int mouse,
|
||||
void *userDataOnPush, tfuiCallback onPush,
|
||||
void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost);
|
||||
extern int GfuiComboboxCreate(void *scr, int font, int x, int y, int width,int align ,int style,tfuiComboCallback onChange);
|
||||
extern int GfuiComboboxCreate(void *scr, int font, int x, int y, int width,int align ,int style,const char *pszText,tfuiComboCallback onChange);
|
||||
extern int GfuiCheckboxCreate(void *scr, int font, int x, int y, int imagewidth,int imageheight,int align ,int style,const char *pszText,bool bChecked,tfuiCheckboxCallback onChange);
|
||||
|
||||
|
||||
|
|
|
@ -58,15 +58,14 @@ int ReadControl(void *param,std::string strType,const char *pControlName)
|
|||
else if (strType == "combobox")
|
||||
{
|
||||
int id = CreateComboboxControl(menuHandle,param,pControlName,NULL);
|
||||
//Add some place holder text
|
||||
GfuiComboboxAddText(menuHandle,id,"1");
|
||||
GfuiComboboxAddText(menuHandle,id,"2");
|
||||
return id;
|
||||
}
|
||||
else if (strType == "scrolllist")
|
||||
return CreateScrollListControl(menuHandle,param,pControlName,0,NULL);
|
||||
else if (strType == "checkbox")
|
||||
return CreateCheckboxControl(menuHandle,param,pControlName,NULL);
|
||||
else if (strType == "progressbar")
|
||||
return CreateProgressbarControl(menuHandle,param,pControlName);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -104,10 +103,12 @@ LoadMenuScreen()
|
|||
1);
|
||||
|
||||
void *param = GfParmReadFile(g_strFile.c_str(), GFPARM_RMODE_REREAD);
|
||||
if (param == NULL)
|
||||
param = GfParmReadFileLocal(g_strFile.c_str(), GFPARM_RMODE_REREAD);
|
||||
|
||||
CreateStaticControls(param,menuHandle);
|
||||
ShowDynamicControls(param);
|
||||
GfuiAddSKey(menuHandle, GFUIK_F1, "reload", NULL, ReloadMenuScreen, NULL);
|
||||
GfuiAddSKey(menuHandle, GFUIK_F5, "reload", NULL, ReloadMenuScreen, NULL);
|
||||
GfuiAddKey(menuHandle, 'Q', "Quit", 0, endofprog, NULL);
|
||||
GfuiAddKey(menuHandle, 'q', "Quit", 0, endofprog, NULL);
|
||||
GfParmReleaseHandle(param);
|
||||
|
|
Loading…
Reference in a new issue