TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
singleplayer.cpp
Go to the documentation of this file.
1/***************************************************************************
2
3 file : singleplayer.cpp
4 created : Sat Nov 16 09:36:29 CET 2002
5 copyright : (C) 2002-2026 by Eric EspiƩ, Bernhard Wymann
6 email : berniw@bluewin.ch
7
8 ***************************************************************************/
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
21
22#include <stdlib.h>
23#include <stdio.h>
24#include <tgfclient.h>
25#include <raceman.h>
26
27#include "raceengine.h"
28#include "racemain.h"
29#include "raceinit.h"
30#include "racestate.h"
31
32static void *singlePlayerHandle = NULL;
33
34/* Called when the menu is activated */
35static void
37{
38 /* Race engine init */
39 ReInit();
40 ReInfo->_reMenuScreen = singlePlayerHandle;
41}
42
43/* Exit from Race engine */
44static void
45singlePLayerShutdown(void *precMenu)
46{
47 GfuiScreenActivate(precMenu);
48 ReShutdown();
49}
50
51
52/* Initialize the single player menu */
53void *
54ReSinglePlayerInit(void *precMenu)
55{
57
61 1);
62
63 GfuiTitleCreate(singlePlayerHandle, "SELECT RACE", 0);
64
65 GfuiScreenAddBgImg(singlePlayerHandle, "data/img/splash-single-player.png");
66
67 /* Display the raceman button selection */
69
71
73
75 "Back", "Back to Main",
76 [precMenu] { singlePLayerShutdown(precMenu); });
77
78 return singlePlayerHandle;
79}
void * GfuiScreenCreateExAction(float *bgColor, const tGfuiAction &onActivate, const tGfuiAction &onDeactivate, int mouseAllowed)
Create a screen.
Definition gui.cpp:619
void GfuiMenuDefaultKeysAdd(void *scr)
Add the default menu keyboard callback to a screen.
Definition guimenu.cpp:56
int GfuiTitleCreate(void *scr, const char *text, int maxlen)
Add a Title to the screen.
Definition guilabel.cpp:150
void GfuiScreenAddBgImg(void *scr, const char *filename)
Add an image background to a screen.
Definition gui.cpp:1058
int GfuiMenuBackQuitButtonCreateAction(void *scr, const char *text, const char *tip, const tGfuiAction &onpush)
Add the "Back" or "Quit" button at the bottom of the menu screen.
Definition guimenu.cpp:187
void GfuiScreenActivate(void *screen)
Activate a screen and make it current.
Definition gui.cpp:508
tRmInfo * ReInfo
void ReAddRacemanListButton(void *menuHandle)
Definition raceinit.cpp:252
void ReInit(void)
Definition raceinit.cpp:60
void ReShutdown(void)
Definition raceinit.cpp:104
void ReStateInit(void *prevMenu)
Definition racestate.cpp:43
void * ReSinglePlayerInit(void *precMenu)
static void singlePlayerMenuActivate(void)
static void * singlePlayerHandle
static void singlePLayerShutdown(void *precMenu)
std::function< void()> tGfuiAction
Definition tgfclient.h:107