Re #361 (Move the whole menu system to a module) Fixes the Windows side of r3438 + broken time accel/slow-down cmd + broken in-race Exit menu
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3441 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 3bcfc689dc4f25a03801560310734604bb03e19c Former-commit-id: f22c61bbc40bd466913cae17d743ec0293c79cc2
This commit is contained in:
parent
2d237092b7
commit
ba6ee842e1
10 changed files with 24 additions and 32 deletions
|
@ -18,4 +18,4 @@ ROBOT_DATA(NAME ${ROBOT_NAME}
|
|||
FILES ${ROBOT_NAME}.xml preferences.xml car.xml
|
||||
USER)
|
||||
|
||||
ADD_SDLIB_LIBRARY(${ROBOT_NAME} tgf)
|
||||
ADD_SDLIB_LIBRARY(${ROBOT_NAME} tgf tgfclient)
|
||||
|
|
|
@ -18,4 +18,4 @@ ROBOT_DATA(NAME ${ROBOT_NAME}
|
|||
FILES ${ROBOT_NAME}.xml preferences.xml car.xml
|
||||
USER)
|
||||
|
||||
ADD_SDLIB_LIBRARY(${ROBOT_NAME} tgf networking)
|
||||
ADD_SDLIB_LIBRARY(${ROBOT_NAME} tgf tgfclient networking)
|
||||
|
|
|
@ -35,6 +35,8 @@ public:
|
|||
|
||||
//! Activation of the user interface (splash if any, main menu ...).
|
||||
virtual bool activate() = 0;
|
||||
|
||||
virtual void* createExitMenu(void* prevHdle) = 0;
|
||||
|
||||
virtual void *createRaceScreen() = 0;
|
||||
virtual void *createRaceEventLoopHook() = 0;
|
||||
|
|
|
@ -703,19 +703,12 @@ RestartRaceHookInit(void)
|
|||
static void *QuitHookHandle = 0;
|
||||
static void *StopScrHandle = 0;
|
||||
|
||||
static void* (*ExitMenuInitFunc)(void*) = 0;
|
||||
|
||||
void ReSetExitMenuInitFunc(void* (*func)(void*))
|
||||
{
|
||||
ExitMenuInitFunc = func;
|
||||
}
|
||||
|
||||
static void
|
||||
QuitHookActivate(void * /* dummy */)
|
||||
{
|
||||
if (StopScrHandle)
|
||||
{
|
||||
GfuiScreenActivate(ExitMenuInitFunc(StopScrHandle));
|
||||
GfuiScreenActivate(RaceEngine::self().userInterface().createExitMenu(StopScrHandle));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ INCLUDE_DIRECTORIES(. ${MS} ${CS} ${RS})
|
|||
ADD_INTERFACE_INCLUDEDIR()
|
||||
ADD_OSSPEC_INCLUDEDIR()
|
||||
ADD_SDLIB_INCLUDEDIR(math portability tgf tgfclient tgfdata networking)
|
||||
#ADD_SDLIB_INCLUDEDIR(robottools) ????
|
||||
ADD_PLIB_INCLUDEDIR()
|
||||
ADD_SDL_INCLUDEDIR()
|
||||
ADD_ENET_INCLUDEDIR()
|
||||
|
@ -76,7 +75,6 @@ IF(WIN32)
|
|||
ENDIF(WIN32)
|
||||
|
||||
ADD_SDLIB_LIBRARY(legacymenu tgf tgfclient tgfdata networking)
|
||||
#ADD_SDLIB_LIBRARY(legacymenu robottools) ????
|
||||
|
||||
# Temporary installation as a normal lib, as long as not a real module.
|
||||
#SD_INSTALL_FILES(LIB modules/userinterface TARGETS legacymenu)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <iraceengine.h>
|
||||
|
||||
#include "client.h"
|
||||
#include "exitmenu.h"
|
||||
#include "racescreens.h"
|
||||
|
||||
#include "legacymenu.h"
|
||||
|
@ -46,6 +47,11 @@ bool LegacyMenu::activate()
|
|||
return ::MenuEntry();
|
||||
}
|
||||
|
||||
void* LegacyMenu::createExitMenu(void* prevHdle)
|
||||
{
|
||||
return ::ExitMenuInit(prevHdle);
|
||||
}
|
||||
|
||||
void *LegacyMenu::createRaceScreen()
|
||||
{
|
||||
return ::ReScreenInit();
|
||||
|
|
|
@ -46,6 +46,8 @@ public:
|
|||
// Implementation of IUserInterface.
|
||||
virtual bool activate();
|
||||
|
||||
virtual void* createExitMenu(void* prevHdle);
|
||||
|
||||
virtual void *createRaceScreen();
|
||||
virtual void *createRaceEventLoopHook();
|
||||
virtual void setRaceMessage(const char *msg);
|
||||
|
|
|
@ -102,9 +102,14 @@ reSkipPreStart(void * /* dummy */)
|
|||
}
|
||||
|
||||
static void
|
||||
reTimeMod (void *pvMultFactor)
|
||||
reTimeMod (void *pvCmd)
|
||||
{
|
||||
LegacyMenu::self().raceEngine().accelerateTime(*(double*)pvMultFactor);
|
||||
double fMultFactor = 0.0; // The mult. factor for resetting "real time" simulation step.
|
||||
if ((long)pvCmd > 0)
|
||||
fMultFactor = 0.5; // Accelerate time means reduce the simulation time step.
|
||||
else if ((long)pvCmd < 0)
|
||||
fMultFactor = 2.0; // Slow-down time means increase the simulation time step.
|
||||
LegacyMenu::self().raceEngine().accelerateTime(fMultFactor);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -160,12 +165,9 @@ reAddKeys(void)
|
|||
GfuiAddKey(reScreenHandle, GFUIK_F1, "Help", reScreenHandle, GfuiHelpScreen, NULL);
|
||||
GfuiAddKey(reScreenHandle, GFUIK_F12, "Screen Shot", NULL, GfuiScreenShot, NULL);
|
||||
|
||||
double fSlowDownFactor = 2.0;
|
||||
GfuiAddKey(reScreenHandle, '-', "Slow down Time", &fSlowDownFactor, reTimeMod, NULL);
|
||||
double fAccelerateFactor = 0.5;
|
||||
GfuiAddKey(reScreenHandle, '+', "Accelerate Time", &fAccelerateFactor, reTimeMod, NULL);
|
||||
double fRealTimeFactor = 0.0;
|
||||
GfuiAddKey(reScreenHandle, '.', "Restore Real Time", &fRealTimeFactor, reTimeMod, NULL);
|
||||
GfuiAddKey(reScreenHandle, '-', "Slow down Time", (void*)-1, reTimeMod, NULL);
|
||||
GfuiAddKey(reScreenHandle, '+', "Accelerate Time", (void*)+1, reTimeMod, NULL);
|
||||
GfuiAddKey(reScreenHandle, '.', "Restore Real Time", (void*)0, reTimeMod, NULL);
|
||||
|
||||
GfuiAddKey(reScreenHandle, 'p', "Pause Race", (void*)0, ReBoardInfo, NULL);
|
||||
GfuiAddKey(reScreenHandle, GFUIK_ESCAPE, "Stop Current Race", (void*)RE_STATE_RACE_STOP, reApplyState, NULL);
|
||||
|
|
|
@ -31,18 +31,6 @@
|
|||
|
||||
class GfRace;
|
||||
|
||||
// DLL exported symbols declarator for Windows.
|
||||
#ifdef WIN32
|
||||
# ifdef RACESCREENS_DLL
|
||||
# define extern __declspec(dllexport)
|
||||
# else
|
||||
# define extern __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define extern
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct RmTrackSelect
|
||||
{
|
||||
GfRace *pRace; /* The race to update */
|
||||
|
|
|
@ -6,6 +6,7 @@ SET(SD_SOURCES main.cpp windowsspec.cpp speed-dreams.rc ../../data/data/icons/ic
|
|||
ADD_INTERFACE_INCLUDEDIR()
|
||||
ADD_OSSPEC_INCLUDEDIR()
|
||||
ADD_SDLIB_INCLUDEDIR(legacymenu raceengine tgf tgfclient portability)
|
||||
ADD_PLIB_INCLUDEDIR()
|
||||
|
||||
#disable developer warning
|
||||
if (COMMAND cmake_policy)
|
||||
|
|
Loading…
Reference in a new issue