Compare commits
2 Commits
7aa114efb1
...
d6c79e6197
Author | SHA1 | Date |
---|---|---|
Xavier Del Campo Romero | d6c79e6197 | |
Xavier Del Campo Romero | 1567936498 |
|
@ -26,6 +26,7 @@
|
|||
#include <cstdlib>
|
||||
|
||||
#include "gui.h"
|
||||
#include "guistack.h"
|
||||
|
||||
|
||||
static int NRecursions = 0;
|
||||
|
@ -47,6 +48,12 @@ onDeactivate(void* /* dummy */)
|
|||
NRecursions--;
|
||||
}
|
||||
|
||||
static void
|
||||
onBack(void* /* dummy */)
|
||||
{
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
/** Generate a help screen.
|
||||
@ingroup gui
|
||||
@param targetScreen The screen to display help for and to return to when exiting
|
||||
|
@ -174,13 +181,13 @@ GfuiHelpScreen(void *targetScreen, void *returnScreen)
|
|||
|
||||
// Close menu XML descriptor.
|
||||
GfParmReleaseHandle(hmenu);
|
||||
|
||||
|
||||
// Add keyboard shortcuts.
|
||||
GfuiMenuDefaultKeysAdd(scrHandle);
|
||||
GfuiAddKey(scrHandle, GFUIK_ESCAPE, "Back to the menu", returnScreen, GfuiScreenReplace, NULL);
|
||||
GfuiAddKey(scrHandle, GFUIK_RETURN, "Back to the menu", returnScreen, GfuiScreenReplace, NULL);
|
||||
GfuiAddKey(scrHandle, GFUIK_ESCAPE, "Back to the menu", returnScreen, onBack, NULL);
|
||||
GfuiAddKey(scrHandle, GFUIK_RETURN, "Back to the menu", returnScreen, onBack, NULL);
|
||||
if (NRecursions == 0)
|
||||
GfuiAddKey(scrHandle, GFUIK_F1, "Help on Help menu", scrHandle, GfuiHelpScreen, NULL);
|
||||
|
||||
GfuiScreenActivate(scrHandle);
|
||||
GuiStack::push(scrHandle);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
#include "guistack.h"
|
||||
#include "tgfclient.h"
|
||||
#include <stack>
|
||||
#include <cstddef>
|
||||
|
||||
GuiStack &
|
||||
GuiStack::get()
|
||||
{
|
||||
static GuiStack stack;
|
||||
return stack;
|
||||
}
|
||||
|
||||
void *
|
||||
GuiStack::top()
|
||||
{
|
||||
GuiStack &g = get();
|
||||
|
||||
return g.screens.empty() ? NULL : g.screens.top();
|
||||
}
|
||||
|
||||
void
|
||||
GuiStack::push(void *screen)
|
||||
{
|
||||
get().screens.push(screen);
|
||||
GfuiScreenActivate(screen);
|
||||
}
|
||||
|
||||
void *
|
||||
GuiStack::pop()
|
||||
{
|
||||
void *ret;
|
||||
GuiStack &g = get();
|
||||
|
||||
if (g.screens.empty())
|
||||
return NULL;
|
||||
|
||||
GfuiScreenRelease(g.screens.top());
|
||||
g.screens.pop();
|
||||
|
||||
if (g.screens.empty())
|
||||
return NULL;
|
||||
|
||||
ret = g.screens.top();
|
||||
GfuiScreenActivate(ret);
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef GUI_STACK_H
|
||||
#define GUI_STACK_H
|
||||
|
||||
#include <stack>
|
||||
|
||||
class GuiStack
|
||||
{
|
||||
public:
|
||||
static void *top();
|
||||
static void push(void *screen);
|
||||
static void *pop();
|
||||
|
||||
private:
|
||||
static GuiStack &get();
|
||||
GuiStack() {};
|
||||
void operator=(const GuiStack &);
|
||||
std::stack<void *> screens;
|
||||
};
|
||||
|
||||
#endif /* GUI_STACK_H */
|
|
@ -30,6 +30,7 @@
|
|||
#include <portability.h>
|
||||
#include <tgfclient.h>
|
||||
#include <graphic.h>
|
||||
#include <guistack.h>
|
||||
|
||||
#include "advancedgraphconfig.h"
|
||||
|
||||
|
@ -178,30 +179,26 @@ onActivate(void* /* dummy */)
|
|||
}
|
||||
|
||||
static void
|
||||
onAccept(void* tgtScrHdle)
|
||||
onAccept(void* /* dummy */)
|
||||
{
|
||||
saveOptions();
|
||||
|
||||
GfuiScreenActivate(tgtScrHdle);
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
static void
|
||||
onCancel(void* tgtScrHdle)
|
||||
onCancel(void* /* dummy */)
|
||||
{
|
||||
GfuiScreenActivate(tgtScrHdle);
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
|
||||
// Menu initialization ==================================================================
|
||||
|
||||
void*
|
||||
AdvancedGraphMenuInit(void* prevMenu)
|
||||
void
|
||||
AdvancedGraphMenuInit()
|
||||
{
|
||||
// Don't do it twice.
|
||||
if (ScrHandle)
|
||||
return ScrHandle;
|
||||
|
||||
ScrHandle = GfuiScreenCreate((float*)NULL, NULL, onActivate, NULL, (tfuiCallback)NULL, 1);
|
||||
void *ScrHandle = GfuiScreenCreate(NULL, NULL, onActivate, NULL, NULL, 1);
|
||||
|
||||
void* param = GfuiMenuLoad("advancedgraphconfigmenu.xml");
|
||||
|
||||
|
@ -231,14 +228,14 @@ AdvancedGraphMenuInit(void* prevMenu)
|
|||
GfuiMenuCreateButtonControl(ScrHandle, param, "carrightarrow", (void*)1, onChangeShaders);
|
||||
ShadersLabelId = GfuiMenuCreateLabelControl(ScrHandle, param, "carlabel");
|
||||
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "ApplyButton", prevMenu, onAccept);
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "CancelButton", prevMenu, onCancel);
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "ApplyButton", NULL, onAccept);
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "CancelButton", NULL, onCancel);
|
||||
|
||||
GfParmReleaseHandle(param);
|
||||
|
||||
GfuiMenuDefaultKeysAdd(ScrHandle);
|
||||
GfuiAddKey(ScrHandle, GFUIK_RETURN, "Apply", prevMenu, onAccept, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_ESCAPE, "Cancel", prevMenu, onCancel, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_RETURN, "Apply", NULL, onAccept, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_ESCAPE, "Cancel", NULL, onCancel, NULL);
|
||||
|
||||
return ScrHandle;
|
||||
GuiStack::push(ScrHandle);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,6 @@
|
|||
|
||||
#include "confscreens.h"
|
||||
|
||||
extern void *AdvancedGraphMenuInit(void *prevMenu);
|
||||
extern void AdvancedGraphMenuInit();
|
||||
|
||||
#endif /* _ADVANCEDGRAPHCONFIG_H_ */
|
|
@ -26,6 +26,7 @@
|
|||
#include <cstdlib>
|
||||
|
||||
#include <tgfclient.h>
|
||||
#include <guistack.h>
|
||||
#include <robot.h>
|
||||
#include <portability.h>
|
||||
|
||||
|
@ -43,11 +44,6 @@ static int CurSkillLevelIndex = 0;
|
|||
/* GUI label ids */
|
||||
static int SkillLevelId;
|
||||
|
||||
/* GUI screen handles */
|
||||
static void *ScrHandle = NULL;
|
||||
static void *PrevHandle = NULL;
|
||||
|
||||
|
||||
/* Load the parameter values from the corresponding parameter file */
|
||||
static void ReadAICfg(void)
|
||||
{
|
||||
|
@ -67,7 +63,7 @@ static void ReadAICfg(void)
|
|||
|
||||
GfParmReleaseHandle(paramHandle);
|
||||
|
||||
GfuiLabelSetText(ScrHandle, SkillLevelId, SkillLevels[CurSkillLevelIndex]);
|
||||
GfuiLabelSetText(GuiStack::top(), SkillLevelId, SkillLevels[CurSkillLevelIndex]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,9 +76,7 @@ static void SaveSkillLevel(void * /* dummy */)
|
|||
GfParmReleaseHandle(paramHandle);
|
||||
|
||||
/* return to previous screen */
|
||||
GfuiScreenActivate(PrevHandle);
|
||||
|
||||
return;
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
/* Change the global AI skill level */
|
||||
|
@ -93,7 +87,7 @@ ChangeSkillLevel(void *vp)
|
|||
|
||||
CurSkillLevelIndex = (CurSkillLevelIndex + delta + NSkillLevels) % NSkillLevels;
|
||||
|
||||
GfuiLabelSetText(ScrHandle, SkillLevelId, SkillLevels[CurSkillLevelIndex]);
|
||||
GfuiLabelSetText(GuiStack::top(), SkillLevelId, SkillLevels[CurSkillLevelIndex]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,18 +96,16 @@ static void onActivate(void * /* dummy */)
|
|||
ReadAICfg();
|
||||
}
|
||||
|
||||
static void onCancel(void * /* dummy */)
|
||||
{
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
/* Menu creation */
|
||||
void *
|
||||
AIMenuInit(void *prevMenu)
|
||||
void
|
||||
AIMenuInit()
|
||||
{
|
||||
/* screen already created */
|
||||
if (ScrHandle) {
|
||||
return ScrHandle;
|
||||
}
|
||||
PrevHandle = prevMenu;
|
||||
|
||||
ScrHandle = GfuiScreenCreate((float*)NULL, NULL, onActivate, NULL, (tfuiCallback)NULL, 1);
|
||||
void *ScrHandle = GfuiScreenCreate(NULL, NULL, onActivate, NULL, NULL, 1);
|
||||
|
||||
void *param = GfuiMenuLoad("aiconfigmenu.xml");
|
||||
GfuiMenuCreateStaticControls(ScrHandle, param);
|
||||
|
@ -122,16 +114,16 @@ AIMenuInit(void *prevMenu)
|
|||
GfuiMenuCreateButtonControl(ScrHandle,param,"skillrightarrow",(void*)1,ChangeSkillLevel);
|
||||
|
||||
SkillLevelId = GfuiMenuCreateLabelControl(ScrHandle,param,"skilllabel");
|
||||
GfuiMenuCreateButtonControl(ScrHandle,param,"ApplyButton",prevMenu,SaveSkillLevel);
|
||||
GfuiMenuCreateButtonControl(ScrHandle,param,"CancelButton",prevMenu,GfuiScreenActivate);
|
||||
GfuiMenuCreateButtonControl(ScrHandle,param,"ApplyButton", NULL, SaveSkillLevel);
|
||||
GfuiMenuCreateButtonControl(ScrHandle,param,"CancelButton", NULL, onCancel);
|
||||
|
||||
GfParmReleaseHandle(param);
|
||||
|
||||
GfuiMenuDefaultKeysAdd(ScrHandle);
|
||||
GfuiAddKey(ScrHandle, GFUIK_RETURN, "Apply", NULL, SaveSkillLevel, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_ESCAPE, "Cancel", prevMenu, GfuiScreenActivate, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_ESCAPE, "Cancel", NULL, onCancel, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_LEFT, "Previous Skill Level", (void*)-1, ChangeSkillLevel, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_RIGHT, "Next Skill Level", (void*)+1, ChangeSkillLevel, NULL);
|
||||
|
||||
return ScrHandle;
|
||||
GuiStack::push(ScrHandle);
|
||||
}
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
|
||||
#include "confscreens.h"
|
||||
|
||||
extern void *AIMenuInit(void *prevMenu);
|
||||
|
||||
#endif /* _AICONFIG_H_ */
|
||||
|
||||
|
||||
extern void AIMenuInit();
|
||||
|
||||
#endif /* _AICONFIG_H_ */
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <portability.h>
|
||||
#include <tgfclient.h>
|
||||
#include <guistack.h>
|
||||
#include <graphic.h>
|
||||
|
||||
#include "graphconfig.h"
|
||||
|
@ -49,8 +50,6 @@ static const int NbBackgroundLandscapeValues = sizeof(BackgroundLandscapeValues)
|
|||
static const int VisibilityValues[] = { 4000, 6000, 8000, 10000, 12000 };
|
||||
static const int NbVisibilityValues = sizeof(VisibilityValues) / sizeof(VisibilityValues[0]);
|
||||
|
||||
static void *ScrHandle = NULL;
|
||||
|
||||
static int FovEditId;
|
||||
static int SmokeEditId;
|
||||
static int SkidEditId;
|
||||
|
@ -198,12 +197,14 @@ onChangeVisibility(void* vp)
|
|||
const long delta = (long)vp;
|
||||
VisibilityIndex = (VisibilityIndex + NbVisibilityValues + delta) % NbVisibilityValues;
|
||||
snprintf(buf, sizeof(buf), "%d", VisibilityValues[VisibilityIndex]);
|
||||
GfuiLabelSetText(ScrHandle, VisibilityLabelId, buf);
|
||||
}
|
||||
GfuiLabelSetText(GuiStack::top(), VisibilityLabelId, buf);
|
||||
}
|
||||
|
||||
static void
|
||||
onChangeFov(void* vp)
|
||||
{
|
||||
void *ScrHandle = GuiStack::top();
|
||||
|
||||
if (vp)
|
||||
{
|
||||
// Get new value from the edit control
|
||||
|
@ -219,6 +220,8 @@ onChangeFov(void* vp)
|
|||
static void
|
||||
onChangeLodFactor(void* vp)
|
||||
{
|
||||
void *ScrHandle = GuiStack::top();
|
||||
|
||||
if (vp)
|
||||
{
|
||||
// Get new value from the edit control
|
||||
|
@ -234,6 +237,8 @@ onChangeLodFactor(void* vp)
|
|||
static void
|
||||
onChangeSmoke(void* vp)
|
||||
{
|
||||
void *ScrHandle = GuiStack::top();
|
||||
|
||||
if (vp)
|
||||
{
|
||||
// Get new value from the edit control
|
||||
|
@ -249,6 +254,8 @@ onChangeSmoke(void* vp)
|
|||
static void
|
||||
onChangeSkid(void* vp)
|
||||
{
|
||||
void *ScrHandle = GuiStack::top();
|
||||
|
||||
if (vp)
|
||||
{
|
||||
// Get new value from the edit control
|
||||
|
@ -266,16 +273,16 @@ onChangeDynamicTimeOfDay(void* vp)
|
|||
{
|
||||
const long delta = (long)vp;
|
||||
DynamicTimeOfDayIndex = (DynamicTimeOfDayIndex + NbDynamicTimeOfDayValues + delta) % NbDynamicTimeOfDayValues;
|
||||
GfuiLabelSetText(ScrHandle, DynamicTimeOfDayLabelId, DynamicTimeOfDayValues[DynamicTimeOfDayIndex]);
|
||||
}
|
||||
GfuiLabelSetText(GuiStack::top(), DynamicTimeOfDayLabelId, DynamicTimeOfDayValues[DynamicTimeOfDayIndex]);
|
||||
}
|
||||
|
||||
static void
|
||||
onChangeBackgroundLandscape(void* vp)
|
||||
{
|
||||
const long delta = (long)vp;
|
||||
BackgroundLandscapeIndex = (BackgroundLandscapeIndex + NbBackgroundLandscapeValues + delta) % NbBackgroundLandscapeValues;
|
||||
GfuiLabelSetText(ScrHandle, BackgroundLandscapeLabelId, BackgroundLandscapeValues[BackgroundLandscapeIndex]);
|
||||
}
|
||||
GfuiLabelSetText(GuiStack::top(), BackgroundLandscapeLabelId, BackgroundLandscapeValues[BackgroundLandscapeIndex]);
|
||||
}
|
||||
|
||||
static void
|
||||
onChangeCloudLayers(void* vp)
|
||||
|
@ -283,12 +290,13 @@ onChangeCloudLayers(void* vp)
|
|||
const long delta = (long)vp;
|
||||
CloudLayerIndex = (CloudLayerIndex + NbCloudLayersValues + delta) % NbCloudLayersValues;
|
||||
snprintf(buf, sizeof(buf), "%d", CloudLayersValues[CloudLayerIndex]);
|
||||
GfuiLabelSetText(ScrHandle, CloudLayersLabelId, buf);
|
||||
GfuiLabelSetText(GuiStack::top(), CloudLayersLabelId, buf);
|
||||
}
|
||||
|
||||
static void
|
||||
onChangeSkyDomeDistance(void* vp)
|
||||
{
|
||||
void *ScrHandle = GuiStack::top();
|
||||
const long delta = (long)vp;
|
||||
SkyDomeDistanceIndex = (SkyDomeDistanceIndex + NbSkyDomeDistanceValues + delta) % NbSkyDomeDistanceValues;
|
||||
snprintf(buf, sizeof(buf), "%d", SkyDomeDistanceValues[SkyDomeDistanceIndex]);
|
||||
|
@ -338,7 +346,7 @@ onChangePrecipDensity(void* vp)
|
|||
const long delta = (long)vp;
|
||||
PrecipDensityIndex = (PrecipDensityIndex + NbPrecipDensityValues + delta) % NbPrecipDensityValues;
|
||||
snprintf(buf, sizeof(buf), "%d", PrecipDensityValues[PrecipDensityIndex]);
|
||||
GfuiLabelSetText(ScrHandle, PrecipDensityLabelId, buf);
|
||||
GfuiLabelSetText(GuiStack::top(), PrecipDensityLabelId, buf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -357,30 +365,26 @@ onActivate(void* /* dummy */)
|
|||
}
|
||||
|
||||
static void
|
||||
onAccept(void* tgtScrHdle)
|
||||
onAccept(void* /* dummy */)
|
||||
{
|
||||
saveOptions();
|
||||
|
||||
GfuiScreenActivate(tgtScrHdle);
|
||||
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
static void
|
||||
onCancel(void* tgtScrHdle)
|
||||
onCancel(void* /* dummy */)
|
||||
{
|
||||
GfuiScreenActivate(tgtScrHdle);
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
|
||||
// Menu initialization ==================================================================
|
||||
|
||||
void*
|
||||
GraphMenuInit(void* prevMenu)
|
||||
void
|
||||
GraphMenuInit()
|
||||
{
|
||||
// Don't do it twice.
|
||||
if (ScrHandle)
|
||||
return ScrHandle;
|
||||
|
||||
ScrHandle = GfuiScreenCreate((float*)NULL, NULL, onActivate, NULL, (tfuiCallback)NULL, 1);
|
||||
void *ScrHandle = GfuiScreenCreate(NULL, NULL, onActivate, NULL, NULL, 1);
|
||||
|
||||
void* param = GfuiMenuLoad("graphicsconfigmenu.xml");
|
||||
|
||||
|
@ -433,15 +437,15 @@ GraphMenuInit(void* prevMenu)
|
|||
VisibilityLabelId =
|
||||
GfuiMenuCreateLabelControl(ScrHandle, param, "visibilitylabel");
|
||||
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "ApplyButton", prevMenu, onAccept);
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "CancelButton", prevMenu, onCancel);
|
||||
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "ApplyButton", NULL, onAccept);
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "CancelButton", NULL, onCancel);
|
||||
|
||||
GfParmReleaseHandle(param);
|
||||
|
||||
|
||||
// Add standard keyboard shortcuts.
|
||||
GfuiMenuDefaultKeysAdd(ScrHandle);
|
||||
GfuiAddKey(ScrHandle, GFUIK_RETURN, "Apply", prevMenu, onAccept, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_ESCAPE, "Cancel", prevMenu, onCancel, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_RETURN, "Apply", NULL, onAccept, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_ESCAPE, "Cancel", NULL, onCancel, NULL);
|
||||
|
||||
return ScrHandle;
|
||||
GuiStack::push(ScrHandle);
|
||||
}
|
||||
|
|
|
@ -29,9 +29,6 @@
|
|||
#include "confscreens.h"
|
||||
|
||||
|
||||
extern void *GraphMenuInit(void *prevMenu);
|
||||
|
||||
#endif /* _GRAPHCONFIG_H_ */
|
||||
|
||||
|
||||
extern void GraphMenuInit();
|
||||
|
||||
#endif /* _GRAPHCONFIG_H_ */
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <sstream>
|
||||
|
||||
#include <tgfclient.h>
|
||||
#include <guistack.h>
|
||||
|
||||
#include "legacymenu.h"
|
||||
#include "monitorconfig.h"
|
||||
|
@ -100,17 +101,12 @@ void MonitorMenu::onAccept(void *pMonitorMenu)
|
|||
// Save display settings.
|
||||
pMenu->storeSettings();
|
||||
|
||||
// Back to previous screen.
|
||||
GfuiScreenActivate(pMenu->getPreviousMenuHandle());
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
void MonitorMenu::onCancel(void *pMonitorMenu)
|
||||
{
|
||||
// Get the MonitorMenu instance from call-back user data.
|
||||
const MonitorMenu* pMenu = static_cast<MonitorMenu*>(pMonitorMenu);
|
||||
|
||||
// Back to previous screen.
|
||||
GfuiScreenActivate(pMenu->getPreviousMenuHandle());
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
void MonitorMenu::updateControls()
|
||||
|
@ -200,28 +196,25 @@ MonitorMenu::MonitorMenu()
|
|||
_eSpanSplit = eDisabled;
|
||||
_nBezelComp = 1.0;
|
||||
}
|
||||
|
||||
bool MonitorMenu::initialize(void *pPreviousMenu)
|
||||
#error finish refactoring
|
||||
bool MonitorMenu::initialize()
|
||||
{
|
||||
// Save the menu to return to.
|
||||
setPreviousMenuHandle(pPreviousMenu);
|
||||
|
||||
// Create the menu and all its controls.
|
||||
createMenu(NULL, this, onActivate, NULL, (tfuiCallback)NULL, 1);
|
||||
void *scrHandle = GfuiScreenCreate(NULL, this, onActivate, NULL, NULL, 1);
|
||||
|
||||
void *param = GfuiMenuLoad("monitorconfigmenu.xml");
|
||||
|
||||
openXMLDescriptor();
|
||||
|
||||
|
||||
createStaticControls();
|
||||
|
||||
|
||||
const int nMonitorTypeComboId =
|
||||
createComboboxControl("MonitorTypeCombo", this, onChangeMonitorType);
|
||||
|
||||
const int nSpanSplitComboId =
|
||||
createComboboxControl("SpanSplitCombo", this, onChangeSpanSplit);
|
||||
|
||||
nBezelCompID = GfuiMenuCreateEditControl(getMenuHandle(), param, "BezelCompEdit", (void*)1, NULL, onChangeBezelComp);
|
||||
nBezelCompID = GfuiMenuCreateEditControl(scrHandle, param, "BezelCompEdit", (void*)1, NULL, onChangeBezelComp);
|
||||
// createComboboxControl("BezelCompEdit", this, onChangeBezelComp);
|
||||
|
||||
createButtonControl("ApplyButton", this, onAccept);
|
||||
|
@ -229,7 +222,7 @@ bool MonitorMenu::initialize(void *pPreviousMenu)
|
|||
|
||||
addDefaultShortcuts();
|
||||
addShortcut(GFUIK_RETURN, "Apply", this, onAccept, 0);
|
||||
addShortcut(GFUIK_ESCAPE, "Cancel", this, onCancel, 0);
|
||||
addShortcut(GFUIK_ESCAPE, "Cancel", NULL, onCancel, 0);
|
||||
// TODO Keyboard shortcuts: Add support for shortcuts in GfuiCombobox ?
|
||||
//addShortcut(GFUIK_LEFT, "Previous Resolution", this, onChangeScreenSize, 0);
|
||||
//addShortcut(GFUIK_RIGHT, "Next Resolution", this, onChangeScreenSize, 0);
|
||||
|
@ -239,12 +232,13 @@ bool MonitorMenu::initialize(void *pPreviousMenu)
|
|||
// Load constant value lists in combo-boxes.
|
||||
// 1) Monitor Type
|
||||
for (int nMonitorTypeInd = 0; nMonitorTypeInd < nMonitorTypes; nMonitorTypeInd++)
|
||||
GfuiComboboxAddText(getMenuHandle(), nMonitorTypeComboId, AMonitorTypes[nMonitorTypeInd]);
|
||||
GfuiComboboxAddText(scrHandle, nMonitorTypeComboId, AMonitorTypes[nMonitorTypeInd]);
|
||||
|
||||
// 2) Span Split Screens - for wide displays
|
||||
for (int nSpanSplitInd = 0; nSpanSplitInd < nSpanSplits; nSpanSplitInd++)
|
||||
GfuiComboboxAddText(getMenuHandle(), nSpanSplitComboId, ASpanSplits[nSpanSplitInd]);
|
||||
GfuiComboboxAddText(scrHandle, nSpanSplitComboId, ASpanSplits[nSpanSplitInd]);
|
||||
|
||||
GuiStack::push(scrHandle);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -252,15 +246,12 @@ bool MonitorMenu::initialize(void *pPreviousMenu)
|
|||
@ingroup screen
|
||||
@param precMenu previous menu to return to
|
||||
*/
|
||||
void* MonitorMenuInit(void *pPreviousMenu)
|
||||
void MonitorMenuInit()
|
||||
{
|
||||
if (!PMonitorMenu)
|
||||
{
|
||||
PMonitorMenu = new MonitorMenu;
|
||||
|
||||
PMonitorMenu->initialize(pPreviousMenu);
|
||||
|
||||
PMonitorMenu->initialize();
|
||||
}
|
||||
|
||||
return PMonitorMenu->getMenuHandle();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,13 +24,13 @@
|
|||
|
||||
#include "confscreens.h"
|
||||
|
||||
class MonitorMenu : public GfuiMenuScreen
|
||||
class MonitorMenu
|
||||
{
|
||||
public:
|
||||
|
||||
MonitorMenu();
|
||||
bool initialize(void* pPreviousMenu);
|
||||
|
||||
bool initialize();
|
||||
|
||||
enum EMonitorType { e4by3 = 0, e16by9 = 1, e21by9 = 2, nMonitorTypes };
|
||||
enum ESpanSplit { eDisabled = 0, eEnabled = 1, nSpanSplits };
|
||||
|
||||
|
@ -65,6 +65,6 @@ private:
|
|||
|
||||
};
|
||||
|
||||
extern void* MonitorMenuInit(void* pPreviousMenu);
|
||||
extern void MonitorMenuInit();
|
||||
|
||||
#endif //_MONITORCONFIG_H_
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <tgfclient.h>
|
||||
#include <glfeatures.h>
|
||||
#include <raceman.h>
|
||||
#include <guistack.h>
|
||||
|
||||
#include "legacymenu.h"
|
||||
#include "openglconfig.h"
|
||||
|
@ -439,17 +440,17 @@ static void onActivate(void * /* dummy */)
|
|||
GfuiLabelSetText(ScrHandle, GraphicSchemeId, GraphicDispNameList[CurGraphicScheme]);
|
||||
}
|
||||
|
||||
static void onCancel(void * /* dummy */)
|
||||
{
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
// OpenGL menu
|
||||
void* OpenGLMenuInit(void *prevMenu)
|
||||
void OpenGLMenuInit()
|
||||
{
|
||||
//const char *graphicSchemeName;
|
||||
// Has screen already been created?
|
||||
if (ScrHandle)
|
||||
return ScrHandle;
|
||||
|
||||
PrevHandle = prevMenu;
|
||||
|
||||
ScrHandle = GfuiScreenCreate((float*)NULL, NULL, onActivate, NULL, (tfuiCallback)NULL, 1);
|
||||
void *ScrHandle = GfuiScreenCreate(NULL, NULL, onActivate, NULL, NULL, 1);
|
||||
void *hparmMenu = GfuiMenuLoad("opengloptionsmenu.xml");
|
||||
GfuiMenuCreateStaticControls(ScrHandle, hparmMenu);
|
||||
|
||||
|
@ -516,13 +517,13 @@ void* OpenGLMenuInit(void *prevMenu)
|
|||
#endif
|
||||
|
||||
GfuiMenuCreateButtonControl(ScrHandle,hparmMenu,"ApplyButton",NULL, onAccept);
|
||||
GfuiMenuCreateButtonControl(ScrHandle,hparmMenu,"CancelButton",prevMenu, GfuiScreenActivate);
|
||||
GfuiMenuCreateButtonControl(ScrHandle,hparmMenu,"CancelButton", NULL, onCancel);
|
||||
|
||||
GfParmReleaseHandle(hparmMenu);
|
||||
|
||||
GfuiMenuDefaultKeysAdd(ScrHandle);
|
||||
GfuiAddKey(ScrHandle, GFUIK_RETURN, "Apply", NULL, onAccept, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_ESCAPE, "Cancel", prevMenu, GfuiScreenActivate, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_ESCAPE, "Cancel", NULL, onCancel, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_LEFT, "Decrease Texture Size Limit", (void*)-1, changeMaxTextureSizeState, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_RIGHT, "Increase Texture Size Limit", (void*)1, changeMaxTextureSizeState, NULL);
|
||||
GfuiAddKey(ScrHandle, ' ', "Toggle Texture Compression", (void*)1, changeTextureCompressionState, NULL);
|
||||
|
@ -545,5 +546,5 @@ void* OpenGLMenuInit(void *prevMenu)
|
|||
}
|
||||
}
|
||||
|
||||
return ScrHandle;
|
||||
GuiStack::push(ScrHandle);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "confscreens.h"
|
||||
|
||||
|
||||
extern void *OpenGLMenuInit(void *prevMenu);
|
||||
extern void OpenGLMenuInit();
|
||||
|
||||
extern void OpenGLLoadSelectedFeatures();
|
||||
extern void OpenGLStoreSelectedFeatures();
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <raceman.h>
|
||||
#include <portability.h>
|
||||
#include <tgfclient.h>
|
||||
#include <guistack.h>
|
||||
|
||||
#include "simuconfig.h"
|
||||
|
||||
|
@ -84,11 +85,6 @@ static int StartPausedSchemeId;
|
|||
|
||||
static int CooldownSchemeId;
|
||||
|
||||
/* gui screen handles */
|
||||
static void *ScrHandle = NULL;
|
||||
static void *PrevScrHandle = NULL;
|
||||
|
||||
|
||||
static void loadSimuCfg(void)
|
||||
{
|
||||
const char *simuVersionName;
|
||||
|
@ -139,7 +135,7 @@ static void loadSimuCfg(void)
|
|||
|
||||
// Thread affinity.
|
||||
threadAffinitySchemeName = GfParmGetStr(paramHandle, RM_SECT_RACE_ENGINE, RM_ATTR_THREAD_AFFINITY, ThreadAffinitySchemeList[0]);
|
||||
for (i = 0; i < NbThreadAffinitySchemes; i++)
|
||||
for (i = 0; i < NbThreadAffinitySchemes; i++)
|
||||
{
|
||||
if (strcmp(threadAffinitySchemeName, ThreadAffinitySchemeList[i]) == 0)
|
||||
{
|
||||
|
@ -151,7 +147,7 @@ static void loadSimuCfg(void)
|
|||
// Replay Rate
|
||||
#ifdef THIRD_PARTY_SQLITE3
|
||||
replayRateSchemeName = GfParmGetStr(paramHandle, RM_SECT_RACE_ENGINE, RM_ATTR_REPLAY_RATE, ReplaySchemeList[0]);
|
||||
for (i = 0; i < NbReplaySchemes; i++)
|
||||
for (i = 0; i < NbReplaySchemes; i++)
|
||||
{
|
||||
if (strcmp(replayRateSchemeName, ReplaySchemeList[i]) == 0)
|
||||
{
|
||||
|
@ -212,10 +208,9 @@ static void storeSimuCfg(void * /* dummy */)
|
|||
GfParmSetStr(paramHandle, RM_SECT_RACE_ENGINE, RM_ATTR_COOLDOWN, CooldownSchemeList[CurCooldownScheme]);
|
||||
GfParmWriteFile(NULL, paramHandle, "raceengine");
|
||||
GfParmReleaseHandle(paramHandle);
|
||||
|
||||
|
||||
/* return to previous screen */
|
||||
GfuiScreenActivate(PrevScrHandle);
|
||||
return;
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
/* Change the simulation version (but only show really available modules) */
|
||||
|
@ -231,12 +226,12 @@ onChangeSimuVersion(void *vp)
|
|||
do
|
||||
{
|
||||
CurSimuVersion = (CurSimuVersion + NbSimuVersions + (int)(long)vp) % NbSimuVersions;
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%smodules/simu/%s%s", GfLibDir(), SimuVersionList[CurSimuVersion], DLLEXT);
|
||||
}
|
||||
while (!GfFileExists(buf) && CurSimuVersion != oldSimuVersion);
|
||||
|
||||
GfuiLabelSetText(ScrHandle, SimuVersionId, SimuVersionDispNameList[CurSimuVersion]);
|
||||
GfuiLabelSetText(GuiStack::top(), SimuVersionId, SimuVersionDispNameList[CurSimuVersion]);
|
||||
}
|
||||
|
||||
/* Change the multi-threading scheme */
|
||||
|
@ -245,8 +240,8 @@ onChangeMultiThreadScheme(void *vp)
|
|||
{
|
||||
CurMultiThreadScheme =
|
||||
(CurMultiThreadScheme + NbMultiThreadSchemes + (int)(long)vp) % NbMultiThreadSchemes;
|
||||
|
||||
GfuiLabelSetText(ScrHandle, MultiThreadSchemeId, MultiThreadSchemeList[CurMultiThreadScheme]);
|
||||
|
||||
GfuiLabelSetText(GuiStack::top(), MultiThreadSchemeId, MultiThreadSchemeList[CurMultiThreadScheme]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -256,8 +251,8 @@ onChangeThreadAffinityScheme(void *vp)
|
|||
{
|
||||
CurThreadAffinityScheme =
|
||||
(CurThreadAffinityScheme + NbThreadAffinitySchemes + (int)(long)vp) % NbThreadAffinitySchemes;
|
||||
|
||||
GfuiLabelSetText(ScrHandle, ThreadAffinitySchemeId, ThreadAffinitySchemeList[CurThreadAffinityScheme]);
|
||||
|
||||
GfuiLabelSetText(GuiStack::top(), ThreadAffinitySchemeId, ThreadAffinitySchemeList[CurThreadAffinityScheme]);
|
||||
}
|
||||
|
||||
#ifdef THIRD_PARTY_SQLITE3
|
||||
|
@ -267,8 +262,8 @@ onChangeReplayRateScheme(void *vp)
|
|||
{
|
||||
CurReplayScheme =
|
||||
(CurReplayScheme + NbReplaySchemes + (int)(long)vp) % NbReplaySchemes;
|
||||
|
||||
GfuiLabelSetText(ScrHandle, ReplayRateSchemeId, ReplaySchemeDispNameList[CurReplayScheme]);
|
||||
|
||||
GfuiLabelSetText(GuiStack::top(), ReplayRateSchemeId, ReplaySchemeDispNameList[CurReplayScheme]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -278,8 +273,8 @@ onChangeStartPausedScheme(void *vp)
|
|||
{
|
||||
CurStartPausedScheme =
|
||||
(CurStartPausedScheme + NbStartPausedSchemes + (int)(long)vp) % NbStartPausedSchemes;
|
||||
|
||||
GfuiLabelSetText(ScrHandle, StartPausedSchemeId, StartPausedSchemeList[CurStartPausedScheme]);
|
||||
|
||||
GfuiLabelSetText(GuiStack::top(), StartPausedSchemeId, StartPausedSchemeList[CurStartPausedScheme]);
|
||||
}
|
||||
|
||||
/* Change the cooldown scheme */
|
||||
|
@ -288,8 +283,8 @@ onChangeCooldownScheme(void *vp)
|
|||
{
|
||||
CurCooldownScheme =
|
||||
(CurCooldownScheme + NbCooldownSchemes + (int)(long)vp) % NbCooldownSchemes;
|
||||
|
||||
GfuiLabelSetText(ScrHandle, CooldownSchemeId, CooldownSchemeList[CurCooldownScheme]);
|
||||
|
||||
GfuiLabelSetText(GuiStack::top(), CooldownSchemeId, CooldownSchemeList[CurCooldownScheme]);
|
||||
}
|
||||
|
||||
static void onActivate(void * /* dummy */)
|
||||
|
@ -297,18 +292,16 @@ static void onActivate(void * /* dummy */)
|
|||
loadSimuCfg();
|
||||
}
|
||||
|
||||
static void onCancel(void * /* dummy */)
|
||||
{
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
/* Menu creation */
|
||||
void *
|
||||
SimuMenuInit(void *prevMenu)
|
||||
void
|
||||
SimuMenuInit()
|
||||
{
|
||||
/* screen already created */
|
||||
if (ScrHandle) {
|
||||
return ScrHandle;
|
||||
}
|
||||
PrevScrHandle = prevMenu;
|
||||
|
||||
ScrHandle = GfuiScreenCreate((float*)NULL, NULL, onActivate, NULL, (tfuiCallback)NULL, 1);
|
||||
void *ScrHandle = GfuiScreenCreate(NULL, NULL, onActivate, NULL, NULL, 1);
|
||||
|
||||
void *menuDescHdle = GfuiMenuLoad("simuconfigmenu.xml");
|
||||
GfuiMenuCreateStaticControls(ScrHandle, menuDescHdle);
|
||||
|
@ -344,19 +337,19 @@ SimuMenuInit(void *prevMenu)
|
|||
GfuiMenuCreateButtonControl(ScrHandle, menuDescHdle, "cooldownleftarrow", (void*)-1, onChangeCooldownScheme);
|
||||
GfuiMenuCreateButtonControl(ScrHandle, menuDescHdle, "cooldownrightarrow", (void*)1, onChangeCooldownScheme);
|
||||
|
||||
GfuiMenuCreateButtonControl(ScrHandle, menuDescHdle, "ApplyButton", PrevScrHandle, storeSimuCfg);
|
||||
GfuiMenuCreateButtonControl(ScrHandle, menuDescHdle, "CancelButton", PrevScrHandle, GfuiScreenActivate);
|
||||
GfuiMenuCreateButtonControl(ScrHandle, menuDescHdle, "ApplyButton", NULL, storeSimuCfg);
|
||||
GfuiMenuCreateButtonControl(ScrHandle, menuDescHdle, "CancelButton", NULL, GfuiScreenActivate);
|
||||
|
||||
|
||||
GfParmReleaseHandle(menuDescHdle);
|
||||
|
||||
GfuiMenuDefaultKeysAdd(ScrHandle);
|
||||
GfuiAddKey(ScrHandle, GFUIK_RETURN, "Apply", NULL, storeSimuCfg, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_ESCAPE, "Cancel", PrevScrHandle, GfuiScreenActivate, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_ESCAPE, "Cancel", NULL, onCancel, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_LEFT, "Previous simu engine version", (void*)-1, onChangeSimuVersion, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_RIGHT, "Next simu engine version", (void*)1, onChangeSimuVersion, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_UP, "Previous multi-threading scheme", (void*)-1, onChangeMultiThreadScheme, NULL);
|
||||
GfuiAddKey(ScrHandle, GFUIK_DOWN, "Next multi-threading scheme", (void*)1, onChangeMultiThreadScheme, NULL);
|
||||
|
||||
return ScrHandle;
|
||||
GuiStack::push(ScrHandle);
|
||||
}
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
#include "confscreens.h"
|
||||
|
||||
|
||||
extern void *SimuMenuInit(void *prevMenu);
|
||||
|
||||
#endif /* _SIMUCONFIG_H_ */
|
||||
|
||||
|
||||
extern void SimuMenuInit();
|
||||
|
||||
#endif /* _SIMUCONFIG_H_ */
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <cstring>
|
||||
|
||||
#include <tgfclient.h>
|
||||
#include <guistack.h>
|
||||
#include <sound.h>
|
||||
#include <musicplayer.h>
|
||||
#include <guimenusfx.h>
|
||||
|
@ -80,10 +81,6 @@ static float MenuSfxVolumeValue = 100.0f;
|
|||
static float OriginalMenuSfxVolumeValue = 100.0f;
|
||||
static int MenuSfxVolumeValueId;
|
||||
|
||||
// gui screen handles.
|
||||
static void *scrHandle = NULL;
|
||||
static void *prevHandle = NULL;
|
||||
|
||||
|
||||
// Read sound configuration.
|
||||
static void readSoundCfg(void)
|
||||
|
@ -103,6 +100,7 @@ static void readSoundCfg(void)
|
|||
}
|
||||
}
|
||||
|
||||
void *scrHandle = GuiStack::top();
|
||||
GfuiLabelSetText(scrHandle, SoundOptionId, soundOptionList[curOption]);
|
||||
|
||||
// Sound volume.
|
||||
|
@ -225,14 +223,13 @@ static void onAccept(void *)
|
|||
setMenuSfxVolume(MenuSfxVolumeValue);
|
||||
|
||||
// Return to previous screen.
|
||||
GfuiScreenActivate(prevHandle);
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
// Reset any changes
|
||||
// Reset any changes
|
||||
static void onCancel(void *)
|
||||
{
|
||||
// Return to previous screen.
|
||||
GfuiScreenActivate(prevHandle);
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
// Toggle sound state openal/plib/disabled.
|
||||
|
@ -240,12 +237,13 @@ static void changeSoundState(void *vp)
|
|||
{
|
||||
curOption = (curOption + (int)(long)vp + nbOptions) % nbOptions;
|
||||
|
||||
GfuiLabelSetText(scrHandle, SoundOptionId, soundOptionList[curOption]);
|
||||
GfuiLabelSetText(GuiStack::top(), SoundOptionId, soundOptionList[curOption]);
|
||||
}
|
||||
|
||||
// Volume
|
||||
static void changeVolume(void * )
|
||||
{
|
||||
void *scrHandle = GuiStack::top();
|
||||
char* val = GfuiEditboxGetString(scrHandle, VolumeValueId);
|
||||
sscanf(val, "%g", &VolumeValue);
|
||||
if (VolumeValue > 100.0f)
|
||||
|
@ -263,13 +261,14 @@ static void changeMusicState(void *vp)
|
|||
{
|
||||
curMusicState = (curMusicState + (int)(long)vp + nbMusicStates) % nbMusicStates;
|
||||
|
||||
GfuiLabelSetText(scrHandle, MusicStateId, musicStateList[curMusicState]);
|
||||
GfuiLabelSetText(GuiStack::top(), MusicStateId, musicStateList[curMusicState]);
|
||||
|
||||
}
|
||||
|
||||
// Music Volume
|
||||
static void changeMusicVolume(void * )
|
||||
{
|
||||
void *scrHandle = GuiStack::top();
|
||||
char* val = GfuiEditboxGetString(scrHandle, MusicVolumeValueId);
|
||||
sscanf(val, "%g", &MusicVolumeValue);
|
||||
if (MusicVolumeValue > 100.0f)
|
||||
|
@ -287,13 +286,14 @@ static void changeMenuSfxState(void *vp)
|
|||
{
|
||||
curMenuSfxState = (curMenuSfxState + (int)(long)vp + nbMenuSfxStates) % nbMenuSfxStates;
|
||||
|
||||
GfuiLabelSetText(scrHandle, MenuSfxStateId, menusfxStateList[curMenuSfxState]);
|
||||
GfuiLabelSetText(GuiStack::top(), MenuSfxStateId, menusfxStateList[curMenuSfxState]);
|
||||
|
||||
}
|
||||
|
||||
// Menu SFX Volume
|
||||
static void changeMenuSfxVolume(void * )
|
||||
{
|
||||
void *scrHandle = GuiStack::top();
|
||||
char* val = GfuiEditboxGetString(scrHandle, MenuSfxVolumeValueId);
|
||||
sscanf(val, "%g", &MenuSfxVolumeValue);
|
||||
if (MenuSfxVolumeValue > 100.0f)
|
||||
|
@ -313,16 +313,9 @@ static void onActivate(void * /* dummy */)
|
|||
|
||||
|
||||
// Sound menu
|
||||
void* SoundMenuInit(void *prevMenu)
|
||||
void SoundMenuInit()
|
||||
{
|
||||
// Has screen already been created?
|
||||
if (scrHandle) {
|
||||
return scrHandle;
|
||||
}
|
||||
|
||||
prevHandle = prevMenu;
|
||||
|
||||
scrHandle = GfuiScreenCreate((float*)NULL, NULL, onActivate, NULL, (tfuiCallback)NULL, 1);
|
||||
void *scrHandle = GfuiScreenCreate(NULL, NULL, onActivate, NULL, NULL, 1);
|
||||
|
||||
void *param = GfuiMenuLoad("soundconfigmenu.xml");
|
||||
GfuiMenuCreateStaticControls(scrHandle, param);
|
||||
|
@ -358,5 +351,5 @@ void* SoundMenuInit(void *prevMenu)
|
|||
GfuiAddKey(scrHandle, GFUIK_LEFT, "Previous Option in list", (void*)-1, changeSoundState, NULL);
|
||||
GfuiAddKey(scrHandle, GFUIK_RIGHT, "Next Option in list", (void*)1, changeSoundState, NULL);
|
||||
|
||||
return scrHandle;
|
||||
GuiStack::push(scrHandle);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,6 @@
|
|||
#include "confscreens.h"
|
||||
|
||||
|
||||
extern void *SoundMenuInit(void *prevMenu);
|
||||
extern void SoundMenuInit();
|
||||
|
||||
#endif // _SOUNDCONFIG_H_
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "legacymenu.h"
|
||||
#include "displayconfig.h"
|
||||
#include "guistack.h"
|
||||
|
||||
|
||||
// The LegacyMenu singleton.
|
||||
|
@ -585,7 +586,7 @@ void LegacyMenu::eraseResultsTable()
|
|||
|
||||
void LegacyMenu::activateGameScreen()
|
||||
{
|
||||
GfuiScreenActivate(_hscrGame);
|
||||
GuiStack::push(_hscrGame);
|
||||
}
|
||||
|
||||
// Graphics&Sound engine control =====================================================
|
||||
|
|
|
@ -56,7 +56,7 @@ onRaceSelectMenuActivate(void * /* dummy */)
|
|||
static void
|
||||
onOptionsMenuActivate(void * /* dummy */)
|
||||
{
|
||||
GfuiScreenActivate(OptionsMenuInit(MenuHandle));
|
||||
OptionsMenuInit(MenuHandle);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -27,12 +27,11 @@
|
|||
#include <soundconfig.h>
|
||||
#include <simuconfig.h>
|
||||
#include <aiconfig.h>
|
||||
#include <guistack.h>
|
||||
|
||||
#include "optionsmenu.h"
|
||||
|
||||
|
||||
static void *MenuHandle = NULL;
|
||||
|
||||
// SDW hack to get access to Monitor menu, doesn't have a defined position yet
|
||||
// (Uncomment to select Monitor menu otherwise, the Display menu is used)
|
||||
//#define MonitorMenu 1
|
||||
|
@ -42,7 +41,7 @@ static void *MenuHandle = NULL;
|
|||
static void
|
||||
onDisplayMenuActivate(void * /* dummy */)
|
||||
{
|
||||
GfuiScreenActivate(DisplayMenuInit(MenuHandle));
|
||||
DisplayMenuInit();
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -50,7 +49,7 @@ onDisplayMenuActivate(void * /* dummy */)
|
|||
static void
|
||||
onMonitorMenuActivate(void * /* dummy */)
|
||||
{
|
||||
GfuiScreenActivate(MonitorMenuInit(MenuHandle));
|
||||
MonitorMenuInit();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -58,51 +57,53 @@ onMonitorMenuActivate(void * /* dummy */)
|
|||
static void
|
||||
onGraphMenuActivate(void * /* dummy */)
|
||||
{
|
||||
GfuiScreenActivate(GraphMenuInit(MenuHandle));
|
||||
GraphMenuInit();
|
||||
}
|
||||
|
||||
static void
|
||||
onAdvancedGraphMenuActivate(void * /*dummy */)
|
||||
{
|
||||
GfuiScreenActivate(AdvancedGraphMenuInit(MenuHandle));
|
||||
AdvancedGraphMenuInit();
|
||||
}
|
||||
|
||||
static void
|
||||
onOpenGLMenuActivate(void * /* dummy */)
|
||||
{
|
||||
GfuiScreenActivate(OpenGLMenuInit(MenuHandle));
|
||||
OpenGLMenuInit();
|
||||
}
|
||||
|
||||
static void
|
||||
onSoundMenuActivate(void * /* dummy */)
|
||||
{
|
||||
GfuiScreenActivate(SoundMenuInit(MenuHandle));
|
||||
SoundMenuInit();
|
||||
}
|
||||
|
||||
static void
|
||||
onSimuMenuActivate(void * /* dummy */)
|
||||
{
|
||||
GfuiScreenActivate(SimuMenuInit(MenuHandle));
|
||||
SimuMenuInit();
|
||||
}
|
||||
|
||||
static void
|
||||
onAIMenuActivate(void * /* dummy */)
|
||||
{
|
||||
GfuiScreenActivate(AIMenuInit(MenuHandle));
|
||||
AIMenuInit();
|
||||
}
|
||||
|
||||
void *
|
||||
OptionsMenuInit(void *prevMenu)
|
||||
static void
|
||||
onBack(void * /* dummy */)
|
||||
{
|
||||
if (MenuHandle)
|
||||
return MenuHandle;
|
||||
|
||||
MenuHandle = GfuiScreenCreate((float*)NULL, NULL, NULL, NULL, (tfuiCallback)NULL, 1);
|
||||
GuiStack::pop();
|
||||
}
|
||||
|
||||
void
|
||||
OptionsMenuInit()
|
||||
{
|
||||
void *MenuHandle = GfuiScreenCreate();
|
||||
void *param = GfuiMenuLoad("optionsmenu.xml");
|
||||
|
||||
GfuiMenuCreateStaticControls(MenuHandle, param);
|
||||
|
||||
|
||||
// SDW hack to get access to Monitor menu, doesn't have a defined position yet
|
||||
#ifdef MonitorMenu
|
||||
GfuiMenuCreateButtonControl(MenuHandle, param, "display", NULL, onMonitorMenuActivate);
|
||||
|
@ -118,12 +119,11 @@ OptionsMenuInit(void *prevMenu)
|
|||
GfuiMenuCreateButtonControl(MenuHandle, param, "sound", NULL, onSoundMenuActivate);
|
||||
GfuiMenuCreateButtonControl(MenuHandle, param, "simulation", NULL, onSimuMenuActivate);
|
||||
GfuiMenuCreateButtonControl(MenuHandle, param, "ai", NULL, onAIMenuActivate);
|
||||
GfuiMenuCreateButtonControl(MenuHandle, param, "back", prevMenu, GfuiScreenActivate);
|
||||
GfuiMenuCreateButtonControl(MenuHandle, param, "back", NULL, onBack);
|
||||
|
||||
GfParmReleaseHandle(param);
|
||||
|
||||
GfuiMenuDefaultKeysAdd(MenuHandle);
|
||||
GfuiAddKey(MenuHandle, GFUIK_ESCAPE, "Back", prevMenu, GfuiScreenActivate, NULL);
|
||||
|
||||
return MenuHandle;
|
||||
GfuiAddKey(MenuHandle, GFUIK_ESCAPE, "Back", NULL, onBack, NULL);
|
||||
GuiStack::push(MenuHandle);
|
||||
}
|
||||
|
|
|
@ -21,10 +21,7 @@
|
|||
#ifndef _OPTIONSMENU_H_
|
||||
#define _OPTIONSMENU_H_
|
||||
|
||||
extern void *OptionsMenuInit(void *precMenu);
|
||||
|
||||
|
||||
#endif /* _OPTIONSMENU_H_ */
|
||||
|
||||
extern void OptionsMenuInit();
|
||||
|
||||
|
||||
#endif /* _OPTIONSMENU_H_ */
|
||||
|
|
Loading…
Reference in New Issue