File: singleplayer.cpp

package info (click to toggle)
torcs 1.3.3%2Bdfsg-0.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 680,248 kB
  • ctags: 14,190
  • sloc: cpp: 81,697; xml: 75,140; ansic: 9,746; makefile: 2,275; sh: 1,134
file content (83 lines) | stat: -rw-r--r-- 2,564 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/***************************************************************************

    file        : singleplayer.cpp
    created     : Sat Nov 16 09:36:29 CET 2002
    copyright   : (C) 2002 by Eric Espi                        
    email       : eric.espie@torcs.org   
    version     : $Id: singleplayer.cpp,v 1.4 2004/04/05 18:25:00 olethros Exp $                                  

 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

/** @file   
    		
    @author	<a href=mailto:eric.espie@torcs.org>Eric Espie</a>
    @version	$Id: singleplayer.cpp,v 1.4 2004/04/05 18:25:00 olethros Exp $
*/

#include <stdlib.h>
#include <stdio.h>
#include <tgfclient.h>
#include <raceman.h>

#include "raceengine.h"
#include "racemain.h"
#include "raceinit.h"
#include "racestate.h"

static void *singlePlayerHandle = NULL;

/* Called when the menu is activated */
static void
singlePlayerMenuActivate(void * /* dummy */)
{
    /* Race engine init */
    ReInit();
    ReInfo->_reMenuScreen = singlePlayerHandle;
}

/* Exit from Race engine */
static void
singlePLayerShutdown(void *precMenu)
{
    GfuiScreenActivate(precMenu);
    ReShutdown();
}


/* Initialize the single player menu */
void *
ReSinglePlayerInit(void *precMenu)
{
    if (singlePlayerHandle) return singlePlayerHandle;
    
    singlePlayerHandle = GfuiScreenCreateEx((float*)NULL, 
					    NULL, singlePlayerMenuActivate, 
					    NULL, (tfuiCallback)NULL, 
					    1);

    GfuiTitleCreate(singlePlayerHandle, "SELECT RACE", 0);

    GfuiScreenAddBgImg(singlePlayerHandle, "data/img/splash-single-player.png");

    /* Display the raceman button selection */
    ReAddRacemanListButton(singlePlayerHandle);

    GfuiMenuDefaultKeysAdd(singlePlayerHandle);

    ReStateInit(singlePlayerHandle);

    GfuiMenuBackQuitButtonCreate(singlePlayerHandle,
				 "Back", "Back to Main",
				 precMenu, singlePLayerShutdown);
    
    return singlePlayerHandle;
}