TORCS  1.3.9
The Open Racing Car Simulator
guihelp.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  guihelp.cpp -- automatic help on keys
3  -------------------
4  created : Fri Aug 13 22:20:37 CEST 1999
5  copyright : (C) 1999 by Eric Espie
6  email : torcs@free.fr
7  version : $Id$
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 
26 #include <stdlib.h>
27 #ifdef WIN32
28 #include <windows.h>
29 #endif
30 #include <tgfclient.h>
31 #include "gui.h"
32 
33 static void *scrHandle;
34 static float *fgColor1 = &(GfuiColor[GFUI_HELPCOLOR1][0]);
35 static float *fgColor2 = &(GfuiColor[GFUI_HELPCOLOR2][0]);
36 
37 void
39 {
40 }
41 
47 void
48 GfuiHelpScreen(void *prevScreen)
49 {
50  int x, x2, dx, y;
51  tGfuiKey *curKey;
52  tGfuiKey *curSKey;
53  tGfuiScreen *pscr = (tGfuiScreen*)prevScreen;
54 
56 
58  "Keys Definition",
59  fgColor2,
61  320,
62  440,
64  0);
65 
66  x = 30;
67  dx = 80;
68  x2 = 330;
69  y = 380;
70 
71  curSKey = pscr->userSpecKeys;
72  curKey = pscr->userKeys;
73  do {
74  if (curSKey != NULL) {
75  curSKey = curSKey->next;
78  }
79 
80  if (curKey != NULL) {
81  curKey = curKey->next;
84  }
85  y -= 12;
86 
87  if (curKey == pscr->userKeys) curKey = (tGfuiKey*)NULL;
88  if (curSKey == pscr->userSpecKeys) curSKey = (tGfuiKey*)NULL;
89 
90  } while ((curKey != NULL) || (curSKey != NULL));
91 
92 
94  "Back",
96  320,
97  40,
98  GFUI_BTNSZ,
100  0,
101  prevScreen,
103  NULL,
104  (tfuiCallback)NULL,
105  (tfuiCallback)NULL);
106 
107  GfuiAddKey(scrHandle, (unsigned char)27, "", prevScreen, GfuiScreenReplace, NULL);
108  GfuiAddSKey(scrHandle, GLUT_KEY_F1, "", prevScreen, GfuiScreenReplace, NULL);
109  GfuiAddKey(scrHandle, (unsigned char)13, "", prevScreen, GfuiScreenReplace, NULL);
110 
112 
114 
115 }
116 
Definition: gui.h:222
void GfuiScreenReplace(void *screen)
Activate a screen and make it current plus release the current screen.
Definition: gui.cpp:506
int GfuiButtonCreate(void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, void *userDataOnPush, tfuiCallback onPush, void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost)
Add a button to a screen.
Definition: guibutton.cpp:248
#define GFUI_BTNSZ
Definition: tgfclient.h:192
void GfuiAddKey(void *scr, unsigned char key, const char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
Add a Keyboard callback to a screen.
Definition: gui.cpp:742
#define GFUI_FONT_SMALL_C
Definition: tgfclient.h:174
static float * fgColor1
Definition: guihelp.cpp:34
struct GfuiKey * next
Definition: gui.h:232
The Gaming Framework API (client part).
#define GFUI_FONT_LARGE
Definition: tgfclient.h:168
#define GFUI_HELPCOLOR2
Definition: gui.h:42
#define GFUI_HELPCOLOR1
Definition: gui.h:41
void GfuiMenuDefaultKeysAdd(void *scr)
Add the default menu keyboard callback to a screen.
Definition: guimenu.cpp:55
static float * fgColor2
Definition: guihelp.cpp:35
void(* tfuiCallback)(void *)
Definition: tgfclient.h:105
void GfuiScreenActivate(void *screen)
Activate a screen and make it current.
Definition: gui.cpp:467
void GfuiAddSKey(void *scr, int key, const char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
Add a Special Keyboard shortcut to the screen.
Definition: gui.cpp:816
char * descr
Definition: gui.h:226
#define GFUI_ALIGN_HC_VB
Definition: tgfclient.h:72
#define GFUI_ALIGN_HL_VB
Definition: tgfclient.h:69
void GfuiHelpScreen(void *prevScreen)
Generate a help screen.
Definition: guihelp.cpp:48
float GfuiColor[GFUI_COLORNB][4]
Definition: gui.cpp:41
static Vector y[4]
Definition: Convex.cpp:56
int GfuiLabelCreateEx(void *scr, const char *text, float *fgColor, int font, int x, int y, int align, int maxlen)
Create a new label (extended version).
Definition: guilabel.cpp:63
void * GfuiScreenCreate(void)
Create a new screen.
Definition: gui.cpp:543
tGfuiKey * userKeys
Definition: gui.h:248
#define GFUI_FONT_BIG
Definition: tgfclient.h:167
void gfuiHelpInit(void)
Definition: guihelp.cpp:38
tGfuiKey * userSpecKeys
Definition: gui.h:249
char * name
Definition: gui.h:225
static void * scrHandle
Definition: guihelp.cpp:33