Fixed again (resurrected) bad menu when coming back from Player config menu after opening Raceman Menu and coming back to Main menu
Added F1/F12/ESC/Return shortcuts in menu everywhere when lacking Fixed "max texture size" in Open GL Opetion menu git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@1696 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 2f9736529b5f65d58c51be2b02c2cb0c8ce2d9dd Former-commit-id: 7f1ddebd6a7bef871ecf62f50392cab8fe06fa61
This commit is contained in:
parent
cfd028a76d
commit
7c0fed45ca
21 changed files with 161 additions and 150 deletions
|
@ -82,7 +82,6 @@ static void* creditsPageCreate(int startChapterIndex, int startLineIndex)
|
|||
{
|
||||
static const unsigned maxBufSize = 256;
|
||||
static char buf[maxBufSize];
|
||||
//static char bufColInd[4];
|
||||
|
||||
static float colNameColor[4] = {1.0, 0.0, 1.0, 1.0};
|
||||
|
||||
|
@ -238,6 +237,8 @@ static void* creditsPageCreate(int startChapterIndex, int startLineIndex)
|
|||
RetScrHdle, GfuiScreenReplace, NULL);
|
||||
GfuiAddKey(pageScrHdle, (unsigned char)13, "Exit Credits Screen",
|
||||
RetScrHdle, GfuiScreenReplace, NULL);
|
||||
GfuiAddSKey(pageScrHdle, GLUT_KEY_F1, "Help",
|
||||
pageScrHdle, GfuiHelpScreen, NULL);
|
||||
GfuiAddSKey(pageScrHdle, GLUT_KEY_F12, "Take a Screen Shot",
|
||||
NULL, GfuiScreenShot, NULL);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ static void *exitmenuHandle = NULL;
|
|||
static void *exitMainMenuHandle = NULL;
|
||||
|
||||
|
||||
void * exitMenuInit(void *menu, void *menuHandle)
|
||||
void * exitMenuInit(void *prevMenu, void *menuHandle)
|
||||
{
|
||||
if (menuHandle) {
|
||||
GfuiScreenRelease(menuHandle);
|
||||
|
@ -48,9 +48,11 @@ void * exitMenuInit(void *menu, void *menuHandle)
|
|||
void *param = LoadMenuXML("quitscreen.xml");
|
||||
CreateStaticControls(param,menuHandle);
|
||||
CreateButtonControl(menuHandle,param,"yesquit",NULL,endofprog);
|
||||
CreateButtonControl(menuHandle,param,"nobacktogame",menu,GfuiScreenActivate);
|
||||
CreateButtonControl(menuHandle,param,"nobacktogame",prevMenu,GfuiScreenActivate);
|
||||
|
||||
GfuiMenuDefaultKeysAdd(menuHandle);
|
||||
GfuiAddKey(menuHandle, (unsigned char)27, "No, Back to Game",
|
||||
prevMenu, GfuiScreenActivate, NULL);
|
||||
|
||||
return menuHandle;
|
||||
}
|
||||
|
|
|
@ -45,9 +45,9 @@ onActivatePlayerConfig(void * /* dummy */)
|
|||
static void
|
||||
MainMenuActivate(void * /* dummy */)
|
||||
{
|
||||
if (RacemanModLoaded != NULL) {
|
||||
GfModUnloadList(&RacemanModLoaded);
|
||||
}
|
||||
if (RacemanModLoaded) {
|
||||
GfModUnloadList(&RacemanModLoaded);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -81,12 +81,14 @@ MainMenuInit(void)
|
|||
|
||||
//Add buttons and create based on xml
|
||||
CreateButtonControl(menuHandle,param,"race",ReSinglePlayerInit(menuHandle), GfuiScreenActivate);
|
||||
CreateButtonControl(menuHandle,param,"configure",DriverMenuInit(menuHandle),GfuiScreenActivate);
|
||||
CreateButtonControl(menuHandle,param,"configure",NULL,onActivatePlayerConfig);
|
||||
CreateButtonControl(menuHandle,param,"options",OptionOptionInit(menuHandle),GfuiScreenActivate);
|
||||
CreateButtonControl(menuHandle,param,"credits",menuHandle,CreditsScreenActivate);
|
||||
CreateButtonControl(menuHandle,param,"quit",MainExitMenuInit(menuHandle), GfuiScreenActivate);
|
||||
|
||||
GfuiMenuDefaultKeysAdd(menuHandle);
|
||||
GfuiAddKey(menuHandle, (unsigned char)27, "Quit Game",
|
||||
MainExitMenuInit(menuHandle), GfuiScreenActivate, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -28,17 +28,17 @@
|
|||
static void *optionHandle = NULL;
|
||||
|
||||
void *
|
||||
OptionOptionInit(void *precMenu)
|
||||
OptionOptionInit(void *prevMenu)
|
||||
{
|
||||
if (optionHandle) return optionHandle;
|
||||
if (optionHandle)
|
||||
return optionHandle;
|
||||
|
||||
optionHandle = GfuiScreenCreateEx((float*)NULL,
|
||||
NULL, NULL,
|
||||
NULL, (tfuiCallback)NULL,
|
||||
1);
|
||||
|
||||
|
||||
void *param = LoadMenuXML("optionsmenu.xml");
|
||||
void *param = LoadMenuXML("optionsmenu.xml");
|
||||
CreateStaticControls(param,optionHandle);
|
||||
|
||||
CreateButtonControl(optionHandle,param,"graphic",GraphMenuInit(optionHandle),GfuiScreenActivate);
|
||||
|
@ -46,7 +46,10 @@ OptionOptionInit(void *precMenu)
|
|||
CreateButtonControl(optionHandle,param,"simulation",SimuMenuInit(optionHandle),GfuiScreenActivate);
|
||||
CreateButtonControl(optionHandle,param,"sound",SoundMenuInit(optionHandle),GfuiScreenActivate);
|
||||
CreateButtonControl(optionHandle,param,"opengl",OpenGLMenuInit(optionHandle),GfuiScreenActivate);
|
||||
CreateButtonControl(optionHandle,param,"back",precMenu,GfuiScreenActivate);
|
||||
CreateButtonControl(optionHandle,param,"back",prevMenu,GfuiScreenActivate);
|
||||
|
||||
GfuiMenuDefaultKeysAdd(optionHandle);
|
||||
GfuiAddKey(optionHandle, 27, "Back", prevMenu, GfuiScreenActivate, NULL);
|
||||
|
||||
return optionHandle;
|
||||
}
|
||||
|
|
|
@ -477,7 +477,6 @@ ControlMenuInit(void *prevMenu, void *prefHdle, unsigned index, tGearChangeMode
|
|||
void *param = LoadMenuXML("controlconfigmenu.xml");
|
||||
CreateStaticControls(param,ScrHandle);
|
||||
|
||||
|
||||
/* Default keyboard shortcuts */
|
||||
GfuiMenuDefaultKeysAdd(ScrHandle);
|
||||
|
||||
|
@ -487,44 +486,45 @@ ControlMenuInit(void *prevMenu, void *prefHdle, unsigned index, tGearChangeMode
|
|||
|
||||
/* For each control (in Cmd array), create the associated label and editbox */
|
||||
for (i = 0; i < MaxCmd; i++)
|
||||
{
|
||||
std::string strCmd = Cmd[i].name;
|
||||
Cmd[i].labelId = CreateLabelControl(ScrHandle,param,strCmd.c_str());
|
||||
std::string strCmdEdit = strCmd+" button";
|
||||
Cmd[i].Id = CreateButtonControlEx(ScrHandle,param,strCmdEdit.c_str(),(void*)i,onPush,NULL,(tfuiCallback)NULL,onFocusLost);
|
||||
|
||||
/* If first column done, change to the second */
|
||||
if (i == MaxCmd / 2 - 1) {
|
||||
x = 320;
|
||||
x2 = 220;
|
||||
}
|
||||
{
|
||||
std::string strCmd = Cmd[i].name;
|
||||
Cmd[i].labelId = CreateLabelControl(ScrHandle,param,strCmd.c_str());
|
||||
std::string strCmdEdit = strCmd+" button";
|
||||
Cmd[i].Id = CreateButtonControlEx(ScrHandle,param,strCmdEdit.c_str(),(void*)i,onPush,NULL,(tfuiCallback)NULL,onFocusLost);
|
||||
|
||||
/* If first column done, change to the second */
|
||||
if (i == MaxCmd / 2 - 1) {
|
||||
x = 320;
|
||||
x2 = 220;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Steer Sensibility label and associated editbox */
|
||||
CreateLabelControl(ScrHandle,param,"Steer Sensitivity");
|
||||
SteerSensEditId = CreateEditControl(ScrHandle,param,"SteerSensitivityEdit",NULL,NULL,onSteerSensChange);
|
||||
CreateLabelControl(ScrHandle,param,"Steer Sensitivity");
|
||||
SteerSensEditId = CreateEditControl(ScrHandle,param,"SteerSensitivityEdit",NULL,NULL,onSteerSensChange);
|
||||
|
||||
|
||||
/* Steer Dead Zone label and associated editbox */
|
||||
CreateLabelControl(ScrHandle,param,"Steer Dead Zone");
|
||||
DeadZoneEditId = CreateEditControl(ScrHandle,param,"Steer Dead Zone Edit",NULL,NULL,onDeadZoneChange);
|
||||
CreateLabelControl(ScrHandle,param,"Steer Dead Zone");
|
||||
DeadZoneEditId = CreateEditControl(ScrHandle,param,"Steer Dead Zone Edit",NULL,NULL,onDeadZoneChange);
|
||||
|
||||
/* Save button and associated keyboard shortcut */
|
||||
CreateButtonControl(ScrHandle,param,"save",NULL,onSave);
|
||||
CreateButtonControl(ScrHandle,param,"save",NULL,onSave);
|
||||
|
||||
/* Save button and associated keyboard shortcut */
|
||||
/* Save button and associated keyboard shortcut */
|
||||
GfuiAddKey(ScrHandle, 13 /* Return */, "Save", NULL, onSave, NULL);
|
||||
GfuiButtonCreate(ScrHandle, "Save", GFUI_FONT_LARGE, 160, 40, 150, GFUI_ALIGN_HC_VB, GFUI_MOUSE_UP,
|
||||
NULL, onSave, NULL, (tfuiCallback)NULL, (tfuiCallback)NULL);
|
||||
|
||||
/* Mouse calibration screen access button */
|
||||
MouseCalButton = CreateButtonControl(ScrHandle,param,"mousecalibrate",MouseCalMenuInit(ScrHandle, Cmd, MaxCmd), DevCalibrate);
|
||||
/* Joystick/joypad/wheel calibration screen access button */
|
||||
JoyCalButton = CreateButtonControl(ScrHandle,param,"joycalibrate",JoyCalMenuInit(ScrHandle, Cmd, MaxCmd), DevCalibrate);
|
||||
MouseCalButton = CreateButtonControl(ScrHandle,param,"mousecalibrate",MouseCalMenuInit(ScrHandle, Cmd, MaxCmd), DevCalibrate);
|
||||
|
||||
/* Cancel button and associated keyboard shortcut */
|
||||
/* Joystick/joypad/wheel calibration screen access button */
|
||||
JoyCalButton = CreateButtonControl(ScrHandle,param,"joycalibrate",JoyCalMenuInit(ScrHandle, Cmd, MaxCmd), DevCalibrate);
|
||||
|
||||
/* Cancel button and associated keyboard shortcut */
|
||||
GfuiAddKey(ScrHandle, 27 /* Escape */, "Cancel", prevMenu, GfuiScreenActivate, NULL);
|
||||
CreateButtonControl(ScrHandle,param,"cancel",prevMenu,GfuiScreenActivate);
|
||||
CreateButtonControl(ScrHandle,param,"cancel",prevMenu,GfuiScreenActivate);
|
||||
|
||||
/* General callbacks for keyboard keys and special keys */
|
||||
GfuiKeyEventRegister(ScrHandle, onKeyAction);
|
||||
|
|
|
@ -1053,6 +1053,7 @@ DriverMenuInit(void *prevMenu)
|
|||
/* Keybord shortcuts */
|
||||
GfuiAddKey(ScrHandle, 13 /* Return */, "Save Drivers", NULL, SaveDrvList, NULL);
|
||||
GfuiAddKey(ScrHandle, 27 /* Escape */, "Cancel Selection", NULL, QuitDriverConfig, NULL);
|
||||
GfuiAddSKey(ScrHandle, GLUT_KEY_F1, "Help", ScrHandle, GfuiHelpScreen, NULL);
|
||||
GfuiAddSKey(ScrHandle, GLUT_KEY_F12, "Screen-Shot", NULL, GfuiScreenShot, NULL);
|
||||
GfuiAddSKey(ScrHandle, GLUT_KEY_LEFT, "Previous Car", (void*)0, ChangeCar, NULL);
|
||||
GfuiAddSKey(ScrHandle, GLUT_KEY_RIGHT, "Next Car", (void*)1, ChangeCar, NULL);
|
||||
|
|
|
@ -51,21 +51,46 @@ ExitGraphicOptions(void *prevMenu)
|
|||
static void
|
||||
SaveGraphicOptions(void *prevMenu)
|
||||
{
|
||||
sprintf(buf, "%s%s", GetLocalDir(), GR_PARAM_FILE);
|
||||
void * grHandle = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
|
||||
sprintf(buf, "%s%s", GetLocalDir(), GR_PARAM_FILE);
|
||||
void * grHandle = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
|
||||
|
||||
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_FOVFACT, "%", FovFactorValue);
|
||||
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_SMOKENB, NULL, SmokeValue);
|
||||
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_MAXSTRIPBYWHEEL, NULL, SkidValue);
|
||||
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_LODFACTOR, NULL, LodFactorValue);
|
||||
//GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_WHEEL3D, NULL, Wheel3dOtionId);
|
||||
//GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_ANIMDRIVER, NULL, AnimDriverOptionId);
|
||||
|
||||
GfParmWriteFile(NULL, grHandle, "graph");
|
||||
|
||||
GfParmReleaseHandle(grHandle);
|
||||
|
||||
ExitGraphicOptions(prevMenu);
|
||||
}
|
||||
|
||||
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_FOVFACT, "%", FovFactorValue);
|
||||
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_SMOKENB, NULL, SmokeValue);
|
||||
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_MAXSTRIPBYWHEEL, NULL, SkidValue);
|
||||
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_LODFACTOR, NULL, LodFactorValue);
|
||||
//GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_WHEEL3D, NULL, Wheel3dOtionId);
|
||||
//GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_ANIMDRIVER, NULL, AnimDriverOptionId);
|
||||
|
||||
GfParmWriteFile(NULL, grHandle, "graph");
|
||||
static void
|
||||
LoadGraphicOptions()
|
||||
{
|
||||
sprintf(buf, "%s%s", GetLocalDir(), GR_PARAM_FILE);
|
||||
void * grHandle = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
|
||||
|
||||
FovFactorValue = (int)GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_FOVFACT, "%", 100.0);
|
||||
sprintf(buf, "%d", FovFactorValue);
|
||||
GfuiEditboxSetString(scrHandle,FovEditId,buf);
|
||||
|
||||
SmokeValue = (int)GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_SMOKENB, NULL, 300.0);
|
||||
sprintf(buf, "%d", SmokeValue);
|
||||
GfuiEditboxSetString(scrHandle,SmokeEditId,buf);
|
||||
|
||||
GfParmReleaseHandle(grHandle);
|
||||
SkidValue = (int)GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_MAXSTRIPBYWHEEL, NULL, 20.0);
|
||||
sprintf(buf, "%d", SkidValue);
|
||||
GfuiEditboxSetString(scrHandle,SkidEditId,buf);
|
||||
|
||||
ExitGraphicOptions(prevMenu);
|
||||
LodFactorValue = GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_LODFACTOR, NULL, 1.0);
|
||||
sprintf(buf, "%g", LodFactorValue);
|
||||
GfuiEditboxSetString(scrHandle,LodFactorEditId,buf);
|
||||
|
||||
GfParmReleaseHandle(grHandle);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -113,61 +138,38 @@ ChangeSkid(void * /* dummy */)
|
|||
}
|
||||
|
||||
|
||||
static void onActivate(void * /* dummy */)
|
||||
{
|
||||
LoadGraphicOptions();
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
GraphMenuInit(void *prevMenu)
|
||||
{
|
||||
int x, y, x2, dy;
|
||||
|
||||
|
||||
/* screen already created */
|
||||
if (scrHandle) {
|
||||
return scrHandle;
|
||||
}
|
||||
|
||||
|
||||
sprintf(buf, "%s%s", GetLocalDir(), GR_PARAM_FILE);
|
||||
void * grHandle = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
|
||||
|
||||
scrHandle = GfuiScreenCreate();
|
||||
scrHandle = GfuiScreenCreateEx((float*)NULL, NULL, onActivate, NULL, (tfuiCallback)NULL, 1);
|
||||
|
||||
void *param = LoadMenuXML("graphicconfig.xml");
|
||||
|
||||
CreateStaticControls(param,scrHandle);
|
||||
|
||||
|
||||
|
||||
int option = 0;
|
||||
int i = 0;
|
||||
FovEditId = CreateEditControl(scrHandle,param,"fovedit",NULL,NULL,ChangeFov);
|
||||
SmokeEditId = CreateEditControl(scrHandle,param,"smokeedit",NULL,NULL,ChangeSmoke);
|
||||
SkidEditId = CreateEditControl(scrHandle,param,"skidedit",NULL,NULL,ChangeSkid);
|
||||
LodFactorEditId = CreateEditControl(scrHandle,param,"lodedit",NULL,NULL,ChangeLodFactor);
|
||||
|
||||
FovFactorValue = (int)GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_FOVFACT, "%", 100.0);
|
||||
sprintf(buf, "%d", FovFactorValue);
|
||||
FovEditId = CreateEditControl(scrHandle,param,"fovedit",NULL,ChangeFov,NULL);
|
||||
GfuiEditboxSetString(scrHandle,FovEditId,buf);
|
||||
|
||||
|
||||
SmokeValue = (int)GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_SMOKENB, NULL, 300.0);
|
||||
sprintf(buf, "%d", SmokeValue);
|
||||
|
||||
SmokeEditId = CreateEditControl(scrHandle,param,"smokeedit",NULL,ChangeSmoke,NULL);
|
||||
GfuiEditboxSetString(scrHandle,SmokeEditId,buf);
|
||||
|
||||
SkidValue = (int)GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_MAXSTRIPBYWHEEL, NULL, 20.0);
|
||||
sprintf(buf, "%d", SkidValue);
|
||||
SkidEditId = CreateEditControl(scrHandle,param,"skidedit",NULL,ChangeSkid,NULL);
|
||||
GfuiEditboxSetString(scrHandle,SkidEditId,buf);
|
||||
|
||||
LodFactorValue = GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_LODFACTOR, NULL, 1.0);
|
||||
sprintf(buf, "%g", LodFactorValue);
|
||||
|
||||
LodFactorEditId = CreateEditControl(scrHandle,param,"lodedit",NULL,ChangeLodFactor,NULL);
|
||||
GfuiEditboxSetString(scrHandle,LodFactorEditId,buf);
|
||||
|
||||
CreateButtonControl(scrHandle,param,"accept",prevMenu, SaveGraphicOptions);
|
||||
CreateButtonControl(scrHandle,param,"cancel",prevMenu, GfuiScreenActivate);
|
||||
|
||||
GfuiAddKey(scrHandle, 27, "Cancel", prevMenu, GfuiScreenActivate, NULL);
|
||||
|
||||
GfParmReleaseHandle(grHandle);
|
||||
|
||||
CreateButtonControl(scrHandle, param, "accept", prevMenu, SaveGraphicOptions);
|
||||
CreateButtonControl(scrHandle, param, "cancel", prevMenu, GfuiScreenActivate);
|
||||
|
||||
GfuiAddKey(scrHandle, 13, "Save", prevMenu, SaveGraphicOptions, NULL);
|
||||
GfuiAddKey(scrHandle, 27, "Cancel", prevMenu, GfuiScreenActivate, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_F1, "Help", scrHandle, GfuiHelpScreen, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_F12, "Screen-Shot", NULL, GfuiScreenShot, NULL);
|
||||
|
||||
return scrHandle;
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
#include "openglconfig.h"
|
||||
|
||||
|
||||
//static float LabelColor[] = {1.0, 0.0, 1.0, 1.0};
|
||||
|
||||
// Texture compression.
|
||||
static const char *textureCompressOptionList[] = {GR_ATT_TEXTURECOMPRESSION_DISABLED, GR_ATT_TEXTURECOMPRESSION_ENABLED};
|
||||
static const int nbOptionsTextComp = sizeof(textureCompressOptionList) / sizeof(textureCompressOptionList[0]);
|
||||
|
@ -182,8 +180,6 @@ static void onActivate(void * /* dummy */)
|
|||
// OpenGL menu
|
||||
void * OpenGLMenuInit(void *prevMenu)
|
||||
{
|
||||
int y, dy;
|
||||
|
||||
// Has screen already been created?
|
||||
if (scrHandle) {
|
||||
return scrHandle;
|
||||
|
@ -206,8 +202,8 @@ void * OpenGLMenuInit(void *prevMenu)
|
|||
|
||||
|
||||
// Texture sizing.
|
||||
CreateButtonControl(scrHandle,param,"textureleftarrow",(void*)-1, changeTextureCompressState);
|
||||
CreateButtonControl(scrHandle,param,"texturerightarrow",(void*)1, changeTextureCompressState);
|
||||
CreateButtonControl(scrHandle,param,"textureleftarrow",(void*)-1, changeTextureSizeState);
|
||||
CreateButtonControl(scrHandle,param,"texturerightarrow",(void*)1, changeTextureSizeState);
|
||||
TextureSizeOptionId = CreateLabelControl(scrHandle,param,"texturetext");
|
||||
|
||||
CreateButtonControl(scrHandle,param,"accept",NULL, saveOpenGLOption);
|
||||
|
@ -215,6 +211,7 @@ void * OpenGLMenuInit(void *prevMenu)
|
|||
|
||||
GfuiAddKey(scrHandle, 13, "Save", NULL, saveOpenGLOption, NULL);
|
||||
GfuiAddKey(scrHandle, 27, "Cancel Selection", prevMenu, GfuiScreenActivate, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_F1, "Help", scrHandle, GfuiHelpScreen, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_F12, "Screen-Shot", NULL, GfuiScreenShot, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_LEFT, "Previous Option in list", (void*)0, changeTextureCompressState, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_RIGHT, "Next Option in list", (void*)1, changeTextureCompressState, NULL);
|
||||
|
|
|
@ -106,7 +106,7 @@ ChangeSimuVersion(void *vp)
|
|||
|
||||
static void onActivate(void * /* dummy */)
|
||||
{
|
||||
ReadSimuCfg();
|
||||
ReadSimuCfg();
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,8 +114,6 @@ static void onActivate(void * /* dummy */)
|
|||
void *
|
||||
SimuMenuInit(void *prevMenu)
|
||||
{
|
||||
int x, y, x2, x3, x4, dy;
|
||||
|
||||
/* screen already created */
|
||||
if (scrHandle) {
|
||||
return scrHandle;
|
||||
|
@ -127,16 +125,16 @@ SimuMenuInit(void *prevMenu)
|
|||
void *param = LoadMenuXML("simulationmenu.xml");
|
||||
CreateStaticControls(param,scrHandle);
|
||||
|
||||
CreateButtonControl(scrHandle,param,"simvleftarrow",(void*)-1,ChangeSimuVersion);
|
||||
CreateButtonControl(scrHandle,param,"simvrightarrow",(void*)1,ChangeSimuVersion);
|
||||
CreateButtonControl(scrHandle,param,"simvleftarrow",(void*)-1,ChangeSimuVersion);
|
||||
CreateButtonControl(scrHandle,param,"simvrightarrow",(void*)1,ChangeSimuVersion);
|
||||
|
||||
|
||||
SimuVersionId = CreateLabelControl(scrHandle,param,"simulabel");
|
||||
CreateButtonControl(scrHandle,param,"accept",NULL,SaveSimuVersion);
|
||||
CreateButtonControl(scrHandle,param,"cancel",prevMenu,GfuiScreenActivate);
|
||||
SimuVersionId = CreateLabelControl(scrHandle,param,"simulabel");
|
||||
CreateButtonControl(scrHandle,param,"accept",NULL,SaveSimuVersion);
|
||||
CreateButtonControl(scrHandle,param,"cancel",prevMenu,GfuiScreenActivate);
|
||||
|
||||
GfuiAddKey(scrHandle, 13, "Save", NULL, SaveSimuVersion, NULL);
|
||||
GfuiAddKey(scrHandle, 27, "Cancel Selection", prevMenu, GfuiScreenActivate, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_F1, "Help", scrHandle, GfuiHelpScreen, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_F12, "Screen-Shot", NULL, GfuiScreenShot, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_LEFT, "Previous Version in list", (void*)0, ChangeSimuVersion, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_RIGHT, "Next Version in list", (void*)1, ChangeSimuVersion, NULL);
|
||||
|
|
|
@ -150,7 +150,7 @@ void * SoundMenuInit(void *prevMenu)
|
|||
scrHandle = GfuiScreenCreateEx((float*)NULL, NULL, onActivate, NULL, (tfuiCallback)NULL, 1);
|
||||
|
||||
void *param = LoadMenuXML("soundmenu.xml");
|
||||
CreateStaticControls(param,scrHandle);
|
||||
CreateStaticControls(param,scrHandle);
|
||||
|
||||
CreateButtonControl(scrHandle,param,"soundleftarrow",(void*)-1,changeSoundState);
|
||||
CreateButtonControl(scrHandle,param,"soundrightarrow",(void*)1,changeSoundState);
|
||||
|
@ -163,6 +163,7 @@ void * SoundMenuInit(void *prevMenu)
|
|||
|
||||
GfuiAddKey(scrHandle, 13, "Save", NULL, saveSoundOption, NULL);
|
||||
GfuiAddKey(scrHandle, 27, "Cancel Selection", prevMenu, GfuiScreenActivate, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_F1, "Help", scrHandle, GfuiHelpScreen, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_F12, "Screen-Shot", NULL, GfuiScreenShot, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_LEFT, "Previous Option in list", (void*)0, changeSoundState, NULL);
|
||||
GfuiAddSKey(scrHandle, GLUT_KEY_RIGHT, "Next Option in list", (void*)1, changeSoundState, NULL);
|
||||
|
|
|
@ -254,7 +254,7 @@ ReRacemanMenu(void)
|
|||
const char *str;
|
||||
void *params = ReInfo->params;
|
||||
|
||||
if (racemanMenuHdle) {
|
||||
if (racemanMenuHdle) {
|
||||
GfuiScreenRelease(racemanMenuHdle);
|
||||
}
|
||||
racemanMenuHdle = GfuiScreenCreateEx(NULL,
|
||||
|
@ -262,29 +262,30 @@ ReRacemanMenu(void)
|
|||
NULL, (tfuiCallback)NULL,
|
||||
1);
|
||||
|
||||
GfuiMenuDefaultKeysAdd(racemanMenuHdle);
|
||||
|
||||
void *param2 = LoadMenuXML("racechoicemenu.xml");
|
||||
void *param2 = LoadMenuXML("racechoicemenu.xml");
|
||||
CreateStaticControls(param2,racemanMenuHdle);
|
||||
|
||||
|
||||
str = GfParmGetStr(params, RM_SECT_HEADER, RM_ATTR_NAME, 0);
|
||||
if (str) {
|
||||
int id = CreateLabelControl(racemanMenuHdle,param2,"title");
|
||||
GfuiLabelSetText(racemanMenuHdle,id,str);
|
||||
int id = CreateLabelControl(racemanMenuHdle,param2,"title");
|
||||
GfuiLabelSetText(racemanMenuHdle,id,str);
|
||||
}
|
||||
|
||||
CreateButtonControl(racemanMenuHdle,param2,"newrace",NULL,ReStartNewRace);
|
||||
CreateButtonControl(racemanMenuHdle,param2,"configurerace",NULL,reConfigureMenu);
|
||||
CreateButtonControl(racemanMenuHdle,param2,"configureplayers",DriverMenuInit(racemanMenuHdle),GfuiScreenActivate);
|
||||
CreateButtonControl(racemanMenuHdle,param2,"configureplayers",NULL,rePlayerConfig);
|
||||
|
||||
CreateButtonControl(racemanMenuHdle,param2,"backtomain",ReInfo->_reMenuScreen,GfuiScreenActivate);
|
||||
CreateButtonControl(racemanMenuHdle,param2,"backtomain",ReInfo->_reMenuScreen,GfuiScreenActivate);
|
||||
|
||||
|
||||
if (GfParmGetEltNb(params, RM_SECT_TRACKS) > 1) {
|
||||
CreateButtonControl(racemanMenuHdle,param2,"load",racemanMenuHdle,reLoadMenu);
|
||||
CreateButtonControl(racemanMenuHdle,param2,"load",racemanMenuHdle,reLoadMenu);
|
||||
}
|
||||
|
||||
GfuiMenuDefaultKeysAdd(racemanMenuHdle);
|
||||
GfuiAddKey(racemanMenuHdle, 27, "Back to Main menu", ReInfo->_reMenuScreen, GfuiScreenActivate, NULL);
|
||||
|
||||
GfuiScreenActivate(racemanMenuHdle);
|
||||
|
||||
return RM_ASYNC | RM_NEXT_STEP;
|
||||
|
|
|
@ -116,7 +116,8 @@ RmFileSelect(void *vs)
|
|||
GfuiButtonCreate(scrHandle, "Cancel", GFUI_FONT_LARGE, 430, 40, 150, GFUI_ALIGN_HC_VB, GFUI_MOUSE_UP,
|
||||
NULL, rmDeactivate, NULL, (tfuiCallback)NULL, (tfuiCallback)NULL);
|
||||
|
||||
/* Default menu keyboard actions */
|
||||
GfuiAddKey(scrHandle, (unsigned char)27, "Cancel", NULL, rmDeactivate, NULL);
|
||||
GfuiMenuDefaultKeysAdd(scrHandle);
|
||||
|
||||
GfuiScreenActivate(scrHandle);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@ RmTwoStateScreen(
|
|||
GfuiMenuButtonCreate(twoStateHdle, label1, tip1, screen1, GfuiScreenActivate);
|
||||
GfuiMenuButtonCreate(twoStateHdle, label2, tip2, screen2, GfuiScreenActivate);
|
||||
GfuiAddKey(twoStateHdle, 27, tip2, screen2, GfuiScreenActivate, NULL);
|
||||
GfuiAddSKey(twoStateHdle, GLUT_KEY_F1, "Help", twoStateHdle, GfuiHelpScreen, NULL);
|
||||
GfuiAddSKey(twoStateHdle, GLUT_KEY_F12, "Take a Screen Shot", NULL, GfuiScreenShot, NULL);
|
||||
GfuiScreenActivate(twoStateHdle);
|
||||
|
||||
return twoStateHdle;
|
||||
|
@ -72,6 +74,8 @@ RmTriStateScreen(
|
|||
GfuiMenuButtonCreate(triStateHdle, label2, tip2, screen2, GfuiScreenActivate);
|
||||
GfuiMenuButtonCreate(triStateHdle, label3, tip3, screen3, GfuiScreenActivate);
|
||||
GfuiAddKey(triStateHdle, 27, tip3, screen3, GfuiScreenActivate, NULL);
|
||||
GfuiAddSKey(triStateHdle, GLUT_KEY_F1, "Help", triStateHdle, GfuiHelpScreen, NULL);
|
||||
GfuiAddSKey(triStateHdle, GLUT_KEY_F12, "Take a Screen Shot", NULL, GfuiScreenShot, NULL);
|
||||
GfuiScreenActivate(triStateHdle);
|
||||
|
||||
return triStateHdle;
|
||||
|
@ -96,6 +100,8 @@ RmFourStateScreen(
|
|||
GfuiMenuButtonCreate(fourStateHdle, label3, tip3, screen3, GfuiScreenActivate);
|
||||
GfuiMenuButtonCreate(fourStateHdle, label4, tip4, screen4, GfuiScreenActivate);
|
||||
GfuiAddKey(fourStateHdle, 27, tip4, screen4, GfuiScreenActivate, NULL);
|
||||
GfuiAddSKey(fourStateHdle, GLUT_KEY_F1, "Help", fourStateHdle, GfuiHelpScreen, NULL);
|
||||
GfuiAddSKey(fourStateHdle, GLUT_KEY_F12, "Take a Screen Shot", NULL, GfuiScreenShot, NULL);
|
||||
GfuiScreenActivate(fourStateHdle);
|
||||
|
||||
return fourStateHdle;
|
||||
|
@ -258,8 +264,9 @@ rmDisplayStartRace(tRmInfo *info, void *startScr, void *abortScr, int start)
|
|||
NULL,
|
||||
(tfuiCallback)NULL,
|
||||
(tfuiCallback)NULL);
|
||||
|
||||
GfuiAddKey(rmScrHdle, (unsigned char)27, "Abandon", abortScr, GfuiScreenReplace, NULL);
|
||||
|
||||
GfuiAddSKey(rmScrHdle, GLUT_KEY_F1, "Help", rmScrHdle, GfuiHelpScreen, NULL);
|
||||
GfuiAddSKey(rmScrHdle, GLUT_KEY_F12, "Take a Screen Shot", NULL, GfuiScreenShot, NULL);
|
||||
|
||||
GfuiScreenActivate(rmScrHdle);
|
||||
|
|
|
@ -129,5 +129,7 @@ RmPitMenuStart(tCarElt *car, void *userdata, tfuiCallback callback)
|
|||
GfuiButtonCreate(menuHandle, "Stop & Go", GFUI_FONT_LARGE, 480, 40, 150, GFUI_ALIGN_HC_VB, GFUI_MOUSE_UP,
|
||||
NULL, rmStopAndGo, NULL, (tfuiCallback)NULL, (tfuiCallback)NULL);
|
||||
|
||||
GfuiAddSKey(menuHandle, GLUT_KEY_F1, "Help", menuHandle, GfuiHelpScreen, NULL);
|
||||
GfuiAddSKey(menuHandle, GLUT_KEY_F12, "Screen-Shot", NULL, GfuiScreenShot, NULL);
|
||||
GfuiScreenActivate(menuHandle);
|
||||
}
|
||||
|
|
|
@ -209,6 +209,7 @@ rmPracticeResults(void *prevHdle, tRmInfo *info, int start)
|
|||
|
||||
GfuiAddKey(rmScrHdle, (unsigned char)27, "", prevHdle, GfuiScreenReplace, NULL);
|
||||
GfuiAddKey(rmScrHdle, (unsigned char)13, "", prevHdle, GfuiScreenReplace, NULL);
|
||||
GfuiAddSKey(rmScrHdle, GLUT_KEY_F1, "Help", rmScrHdle, GfuiHelpScreen, NULL);
|
||||
GfuiAddSKey(rmScrHdle, GLUT_KEY_F12, "Take a Screen Shot", NULL, GfuiScreenShot, NULL);
|
||||
|
||||
GfuiScreenActivate(rmScrHdle);
|
||||
|
|
|
@ -303,6 +303,7 @@ static void rmtsAddKeys(void)
|
|||
GfuiAddKey(ScrHandle, 27, "Cancel Selection", TrackSelect->prevScreen, rmtsDeactivate, NULL);
|
||||
GfuiAddSKey(ScrHandle, GLUT_KEY_LEFT, "Previous Track", (void*)0, rmtsTrackPrevNext, NULL);
|
||||
GfuiAddSKey(ScrHandle, GLUT_KEY_RIGHT, "Next Track", (void*)1, rmtsTrackPrevNext, NULL);
|
||||
GfuiAddSKey(ScrHandle, GLUT_KEY_F1, "Help", ScrHandle, GfuiHelpScreen, NULL);
|
||||
GfuiAddSKey(ScrHandle, GLUT_KEY_F12, "Screen-Shot", NULL, GfuiScreenShot, NULL);
|
||||
GfuiAddSKey(ScrHandle, GLUT_KEY_UP, "Previous Track Category", (void*)0, rmtsTrackCatPrevNext, NULL);
|
||||
GfuiAddSKey(ScrHandle, GLUT_KEY_DOWN, "Next Track Category", (void*)1, rmtsTrackCatPrevNext, NULL);
|
||||
|
|
|
@ -607,7 +607,6 @@ GfuiScreenCreateEx(float *bgColor,
|
|||
void *userDataOnDeactivate, tfuiCallback onDeactivate,
|
||||
int mouseAllowed)
|
||||
{
|
||||
int i;
|
||||
tGfuiScreen *screen;
|
||||
|
||||
screen = (tGfuiScreen*)calloc(1, sizeof(tGfuiScreen));
|
||||
|
@ -954,7 +953,7 @@ GfuiScreenShot(void * /* notused */)
|
|||
|
||||
t = time(NULL);
|
||||
stm = localtime(&t);
|
||||
snprintf(buf, 1024, "%s/torcs-%4d%02d%02d%02d%02d%02d.png",
|
||||
snprintf(buf, 1024, "%s/sd-%4d%02d%02d%02d%02d%02d.png",
|
||||
path,
|
||||
stm->tm_year+1900,
|
||||
stm->tm_mon+1,
|
||||
|
|
|
@ -45,7 +45,6 @@ gfMenuInit(void)
|
|||
/** Add the default menu keyboard callback to a screen.
|
||||
The keys are:
|
||||
<br><tt>F1 .......... </tt>Help
|
||||
<br><tt>Escape ...... </tt>Quit the menu
|
||||
<br><tt>Enter ....... </tt>Perform Action
|
||||
<br><tt>Up Arrow .... </tt>Select Previous Entry
|
||||
<br><tt>Down Arrow .. </tt>Select Next Entry
|
||||
|
@ -424,10 +423,10 @@ CreateStaticImageControl(void *menuHandle,void *param,const char *pControlName)
|
|||
int
|
||||
CreateLabel(void *menuHandle,void *param,const char *pControlName)
|
||||
{
|
||||
std::string strType = GfParmGetStr(param, pControlName, "type", "");
|
||||
const std::string strType = GfParmGetStr(param, pControlName, "type", "");
|
||||
if (strType!="label")
|
||||
{
|
||||
printf("Error not label type\n");
|
||||
GfError("Error: Control '%s' is not a label\n", pControlName);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -612,13 +611,13 @@ CreateButtonControlEx(void *menuHandle,void *param,const char *pControlName,void
|
|||
std::string strControlName = pControlName;
|
||||
strControlName = "dynamiccontrols/"+strControlName;
|
||||
|
||||
std::string strType = GfParmGetStr(param, strControlName.c_str(), "type", "");
|
||||
const std::string strType = GfParmGetStr(param, strControlName.c_str(), "type", "");
|
||||
if (strType == "textbutton")
|
||||
return CreateTextButtonControl(menuHandle,param,strControlName.c_str(),userdata,onpush,NULL,NULL,NULL);
|
||||
else if(strType == "imagebutton")
|
||||
return CreateImageButtonControl(menuHandle,param,strControlName.c_str(),userdata,onpush,NULL,NULL,NULL);
|
||||
else
|
||||
printf("ERROR: unknown button type\n");
|
||||
printf("Error: Unknown button type '%s'\n", strType.c_str());
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -762,11 +761,11 @@ LoadMenuXML(const char *pMenuPath)
|
|||
{
|
||||
std::string strPath = pMenuPath;
|
||||
strPath = "data/menu/"+strPath;
|
||||
void *param = NULL;
|
||||
|
||||
char buf[1024];
|
||||
sprintf(buf, "%s%s", GetDataDir(),strPath.c_str());
|
||||
param = GfParmReadFile(buf, GFPARM_RMODE_STD);
|
||||
|
||||
return param;
|
||||
void *param = NULL;
|
||||
|
||||
char buf[1024];
|
||||
sprintf(buf, "%s%s", GetDataDir(),strPath.c_str());
|
||||
param = GfParmReadFile(buf, GFPARM_RMODE_STD);
|
||||
|
||||
return param;
|
||||
}
|
||||
|
|
|
@ -37,20 +37,18 @@ gfuiObjectInit(void)
|
|||
//Read mouse pointer settings
|
||||
char buf[1024];
|
||||
void *param;
|
||||
int size;
|
||||
int i;
|
||||
|
||||
sprintf(buf, "%s%s", GetLocalDir(), GFSCR_CONF_FILE);
|
||||
param = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
|
||||
|
||||
std::string strSec = "Mouse Pointer";
|
||||
g_mouseOffsetX = (int)GfParmGetNum(param, strSec.c_str(),"offsetX", (char*)NULL, 0.0);
|
||||
g_mouseOffsetY = (int)GfParmGetNum(param, strSec.c_str(),"offsetY", (char*)NULL, 0.0);
|
||||
g_mouseH = (int)GfParmGetNum(param, strSec.c_str(),"height", (char*)NULL, 20.0);
|
||||
g_mouseW = (int)GfParmGetNum(param, strSec.c_str(),"width", (char*)NULL, 20.0);
|
||||
std::string strImage = GfParmGetStr(param, strSec.c_str(), "image", "data/img/mouse.png");
|
||||
|
||||
g_mouseImage = GfImgReadTex(strImage.c_str());
|
||||
static const char* pszSec = "Mouse Pointer";
|
||||
g_mouseOffsetX = (int)GfParmGetNum(param, pszSec,"offsetX", (char*)NULL, 0.0);
|
||||
g_mouseOffsetY = (int)GfParmGetNum(param, pszSec,"offsetY", (char*)NULL, 0.0);
|
||||
g_mouseH = (int)GfParmGetNum(param, pszSec,"height", (char*)NULL, 20.0);
|
||||
g_mouseW = (int)GfParmGetNum(param, pszSec,"width", (char*)NULL, 20.0);
|
||||
|
||||
const char* pszImage = GfParmGetStr(param, pszSec, "image", "data/img/mouse.png");
|
||||
g_mouseImage = GfImgReadTex(pszImage);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -255,9 +255,6 @@ GfuiScrollListSetSelectedElement(void *scr, int Id, unsigned int selectElement)
|
|||
{
|
||||
tGfuiObject *object;
|
||||
tGfuiScrollList *scrollist;
|
||||
tGfuiListElement *elt;
|
||||
const char *name;
|
||||
int i;
|
||||
|
||||
|
||||
object = gfuiGetObject(scr, Id);
|
||||
|
@ -269,12 +266,12 @@ GfuiScrollListSetSelectedElement(void *scr, int Id, unsigned int selectElement)
|
|||
}
|
||||
scrollist = &(object->u.scrollist);
|
||||
|
||||
if (selectElement >= scrollist->nbElts)
|
||||
return false;
|
||||
if (selectElement >= (unsigned)scrollist->nbElts)
|
||||
return false;
|
||||
|
||||
scrollist->selectedElt == selectElement;
|
||||
scrollist->selectedElt = selectElement;
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Get the selected element from the scroll list.
|
||||
|
|
|
@ -155,8 +155,6 @@ static int VInitLabelId;
|
|||
|
||||
static void *paramHdle;
|
||||
|
||||
static float LabelColor[] = {1.0, 0.0, 1.0, 1.0};
|
||||
|
||||
|
||||
void
|
||||
gfScreenInit(void)
|
||||
|
|
Loading…
Reference in a new issue