TORCS  1.3.9
The Open Racing Car Simulator
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 by Eric Espié
6  email : eric.espie@torcs.org
7  version : $Id$
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
26 #include <stdlib.h>
27 #include <stdio.h>
28 #include <tgfclient.h>
29 #include <raceman.h>
30 
31 #include "raceengine.h"
32 #include "racemain.h"
33 #include "raceinit.h"
34 #include "racestate.h"
35 
36 static void *singlePlayerHandle = NULL;
37 
38 /* Called when the menu is activated */
39 static void
40 singlePlayerMenuActivate(void * /* dummy */)
41 {
42  /* Race engine init */
43  ReInit();
44  ReInfo->_reMenuScreen = singlePlayerHandle;
45 }
46 
47 /* Exit from Race engine */
48 static void
49 singlePLayerShutdown(void *precMenu)
50 {
51  GfuiScreenActivate(precMenu);
52  ReShutdown();
53 }
54 
55 
56 /* Initialize the single player menu */
57 void *
58 ReSinglePlayerInit(void *precMenu)
59 {
61 
62  singlePlayerHandle = GfuiScreenCreateEx((float*)NULL,
64  NULL, (tfuiCallback)NULL,
65  1);
66 
67  GfuiTitleCreate(singlePlayerHandle, "SELECT RACE", 0);
68 
69  GfuiScreenAddBgImg(singlePlayerHandle, "data/img/splash-single-player.png");
70 
71  /* Display the raceman button selection */
73 
75 
77 
79  "Back", "Back to Main",
80  precMenu, singlePLayerShutdown);
81 
82  return singlePlayerHandle;
83 }
void ReInit(void)
Definition: raceinit.cpp:63
static void singlePlayerMenuActivate(void *)
void ReStateInit(void *prevMenu)
Definition: racestate.cpp:47
void ReAddRacemanListButton(void *menuHandle)
Definition: raceinit.cpp:255
static void singlePLayerShutdown(void *precMenu)
void GfuiScreenAddBgImg(void *scr, const char *filename)
Add an image background to a screen.
Definition: gui.cpp:961
void ReShutdown(void)
Definition: raceinit.cpp:107
The Gaming Framework API (client part).
void * GfuiScreenCreateEx(float *bgColor, void *userDataOnActivate, tfuiCallback onActivate, void *userDataOnDeactivate, tfuiCallback onDeactivate, int mouseAllowed)
Create a screen.
Definition: gui.cpp:578
tRmInfo * ReInfo
Definition: raceengine.cpp:45
void GfuiMenuDefaultKeysAdd(void *scr)
Add the default menu keyboard callback to a screen.
Definition: guimenu.cpp:55
void(* tfuiCallback)(void *)
Definition: tgfclient.h:105
This is the race information structures.
void * ReSinglePlayerInit(void *precMenu)
void GfuiScreenActivate(void *screen)
Activate a screen and make it current.
Definition: gui.cpp:467
int GfuiTitleCreate(void *scr, const char *text, int maxlen)
Add a Title to the screen.
Definition: guilabel.cpp:170
static void * singlePlayerHandle
int GfuiMenuBackQuitButtonCreate(void *scr, const char *text, const char *tip, void *userdata, tfuiCallback onpush)
Add the "Back" or "Quit" button at the bottom of the menu screen.
Definition: guimenu.cpp:156