TORCS  1.3.9
The Open Racing Car Simulator
exitmenu.cpp
Go to the documentation of this file.
1 /***************************************************************************
2 
3  file : exitmenu.cpp
4  created : Sat Mar 18 23:42:12 CET 2000
5  copyright : (C) 2000 by Eric Espie
6  email : torcs@free.fr
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 
20 
21 #include <stdio.h>
22 #include <tgfclient.h>
23 #include "exitmenu.h"
24 #include "mainmenu.h"
25 
26 static void
27 endofprog(void * /* dummy */)
28 {
30  PRINT_PROFILE();
31 /* glutSetKeyRepeat(GLUT_KEY_REPEAT_ON); */
32  GfScrShutdown();
33  exit(0);
34 }
35 
36 static void *exitmenuHandle = NULL;
37 static void *exitMainMenuHandle = NULL;
38 
39 
40 void * exitMenuInit(void *menu, void *menuHandle)
41 {
42  if (menuHandle) {
44  }
45 
46  menuHandle = GfuiMenuScreenCreate("Quit ?");
47  GfuiScreenAddBgImg(menuHandle, "data/img/splash-quit.png");
48 
50  "No, Back to Game",
51  "Return to TORCS",
52  menu,
54 
56  "Yes, Let's Quit",
57  "Exit of TORCS",
58  NULL,
59  endofprog);
60  return menuHandle;
61 }
62 
63 /*
64  * Function
65  * TorcsExitMenuInit
66  *
67  * Description
68  * init the exit menus
69  *
70  * Parameters
71  * none
72  *
73  * Return
74  * 0 ok -1 nok
75  *
76  * Remarks
77  *
78  */
79 void * TorcsExitMenuInit(void *menu)
80 {
82  return exitmenuHandle;
83 }
84 
85 
87 {
89  return exitMainMenuHandle;
90 }
#define PRINT_PROFILE()
Definition: tgf.h:600
static void * mainMenu
Definition: racestate.cpp:43
int GfuiMenuButtonCreate(void *scr, const char *text, const char *tip, void *userdata, tfuiCallback onpush)
Add a button to a menu screen.
Definition: guimenu.cpp:110
static void * exitmenuHandle
Definition: exitmenu.cpp:36
void GfuiScreenRelease(void *scr)
Release the given screen.
Definition: gui.cpp:618
void * GfuiMenuScreenCreate(const char *title)
Create a new menu screen.
Definition: guimenu.cpp:76
void * TorcsExitMenuInit(void *menu)
Definition: exitmenu.cpp:79
void GfuiScreenAddBgImg(void *scr, const char *filename)
Add an image background to a screen.
Definition: gui.cpp:961
The Gaming Framework API (client part).
static void endofprog(void *)
Definition: exitmenu.cpp:27
void * exitMenuInit(void *menu, void *menuHandle)
Definition: exitmenu.cpp:40
void GfuiScreenActivate(void *screen)
Activate a screen and make it current.
Definition: gui.cpp:467
#define STOP_ACTIVE_PROFILES()
Definition: tgf.h:599
static void * exitMainMenuHandle
Definition: exitmenu.cpp:37
void * TorcsMainExitMenuInit(void *mainMenu)
Definition: exitmenu.cpp:86
void GfScrShutdown(void)
Shutdown the screen.
Definition: screen.cpp:442