TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
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-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
23
24#include <stdlib.h>
25#ifdef WIN32
26#include <windows.h>
27#endif
28#include <tgfclient.h>
29#include "gui.h"
30
31static void *scrHandle;
32static float *fgColor1 = &(GfuiColor[GFUI_HELPCOLOR1][0]);
33static float *fgColor2 = &(GfuiColor[GFUI_HELPCOLOR2][0]);
34
35void
37{
38}
39
46void
47GfuiHelpScreen(void *prevScreen)
48{
49 int x, x2, dx, y;
50 tGfuiKey *curKey;
51 tGfuiKey *curSKey;
52 tGfuiScreen *pscr = (tGfuiScreen*)prevScreen;
53
55
57 "Keys Definition",
60 320,
61 440,
63 0);
64
65 x = 30;
66 dx = 80;
67 x2 = 330;
68 y = 380;
69
70 curSKey = pscr->userSpecKeys;
71 curKey = pscr->userKeys;
72 do {
73 if (curSKey != NULL) {
74 curSKey = curSKey->next;
77 }
78
79 if (curKey != NULL) {
80 curKey = curKey->next;
83 }
84 y -= 12;
85
86 if (curKey == pscr->userKeys) curKey = (tGfuiKey*)NULL;
87 if (curSKey == pscr->userSpecKeys) curSKey = (tGfuiKey*)NULL;
88
89 } while ((curKey != NULL) || (curSKey != NULL));
90
91
93 "Back",
95 320,
96 40,
99 0,
100 [prevScreen] { GfuiScreenActivate(prevScreen); },
101 tGfuiAction(),
102 tGfuiAction());
103
104 GfuiAddKeyAction(scrHandle, (unsigned char)27, "", [prevScreen] { GfuiScreenReplace(prevScreen); }, tGfuiAction());
105 GfuiAddSKeyAction(scrHandle, GLUT_KEY_F1, "", [prevScreen] { GfuiScreenReplace(prevScreen); }, tGfuiAction());
106 GfuiAddKeyAction(scrHandle, (unsigned char)13, "", [prevScreen] { GfuiScreenReplace(prevScreen); }, tGfuiAction());
107
109
111
112}
static Vector y[4]
Definition Convex.cpp:56
static void * scrHandle
void GfuiHelpScreen(void *prevScreen)
Generate a help screen.
Definition guihelp.cpp:47
void GfuiMenuDefaultKeysAdd(void *scr)
Add the default menu keyboard callback to a screen.
Definition guimenu.cpp:56
void GfuiAddKeyAction(void *scr, unsigned char key, const char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased)
Add a Keyboard callback to a screen.
Definition gui.cpp:809
void GfuiAddSKeyAction(void *scr, int key, const char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased)
Add a Special Keyboard shortcut to the screen.
Definition gui.cpp:895
void GfuiScreenReplace(void *screen)
Activate a screen and make it current plus release the current screen.
Definition gui.cpp:549
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:51
void * GfuiScreenCreate(void)
Create a new screen.
Definition gui.cpp:588
void GfuiScreenActivate(void *screen)
Activate a screen and make it current.
Definition gui.cpp:508
int GfuiButtonCreateAction(void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, const tGfuiAction &onPush, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost)
Add a button to a screen.
float GfuiColor[GFUI_COLORNB][4]
Definition gui.cpp:38
struct GfuiKey tGfuiKey
#define GFUI_HELPCOLOR2
Definition gui.h:42
#define GFUI_HELPCOLOR1
Definition gui.h:41
static float * fgColor2
Definition guihelp.cpp:33
void gfuiHelpInit(void)
Definition guihelp.cpp:36
static float * fgColor1
Definition guihelp.cpp:32
struct GfuiKey * next
Definition gui.h:225
char * name
Definition gui.h:219
char * descr
Definition gui.h:220
tGfuiKey * userKeys
Definition gui.h:241
tGfuiKey * userSpecKeys
Definition gui.h:242
The Gaming Framework API (client part).
#define GFUI_FONT_BIG
Definition tgfclient.h:247
#define GFUI_FONT_LARGE
Definition tgfclient.h:248
#define GFUI_FONT_SMALL_C
Definition tgfclient.h:254
#define GFUI_ALIGN_HL_VB
Definition tgfclient.h:71
std::function< void()> tGfuiAction
Definition tgfclient.h:107
#define GFUI_BTNSZ
Definition tgfclient.h:292
#define GFUI_ALIGN_HC_VB
Definition tgfclient.h:74