TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
gui.cpp File Reference

This API is used to manage all the menu screens. More...

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <tgfclient.h>
#include "gui.h"
#include <portability.h>
Include dependency graph for gui.cpp:

Go to the source code of this file.

Macros

#define REPEAT1   1.0
#define REPEAT2   0.2

Functions

tGfuiAction gfuiMakeAction (void *userData, tfuiCallback callback)
tGfuiAction * gfuiCreateAction (const tGfuiAction &action)
void gfuiRunAction (const tGfuiAction *action)
void gfuiReleaseAction (tGfuiAction *action)
static void gfuiColorInit (void)
void gfuiInit (void)
void GfuiDisplayNothing (void)
 GLUT display callback that performs no drawing or buffer swap.
void GfuiIdle (void)
 Process held-mouse-button repeat actions on the active screen.
void GfuiDisplay (void)
 Draw the active GUI screen and swap the GLUT buffers.
void GfuiMouseHide (void)
 Disallow the software mouse cursor on the active screen.
void GfuiMouseShow (void)
 Allow the software mouse cursor on the active screen.
void GfuiMouseSetHWPresent (void)
 Force the hardware mouse pointer.
static void gfuiKeyboard (unsigned char key, int, int)
static void gfuiSpecial (int key, int, int)
static void gfuiKeyboardUp (unsigned char key, int, int)
static void gfuiSpecialUp (int key, int, int)
tMouseInfo * GfuiMouseInfo (void)
 Get the GUI's current mouse state.
void GfuiMouseSetPos (int x, int y)
 Set the mouse position.
static void gfuiMouse (int button, int state, int x, int y)
static void gfuiMotion (int x, int y)
static void gfuiPassiveMotion (int x, int y)
int GfuiScreenIsActive (void *screen)
 Tell if the screen is active or not.
void GfuiScreenActivate (void *screen)
 Activate a screen and make it current.
void GfuiScreenReplace (void *screen)
 Activate a screen and make it current plus release the current screen.
void GfuiScreenDeactivate (void)
 Deactivate the current screen.
void * GfuiScreenCreate (void)
 Create a new screen.
void * GfuiScreenCreateExAction (float *bgColor, const tGfuiAction &onActivate, const tGfuiAction &onDeactivate, int mouseAllowed)
 Create a screen.
void * GfuiScreenCreateEx (float *bgColor, void *userDataOnActivate, tfuiCallback onActivate, void *userDataOnDeactivate, tfuiCallback onDeactivate, int mouseAllowed)
 Create a screen using callbacks with caller-supplied data.
void GfuiScreenRelease (void *scr)
 Release the given screen.
void * GfuiHookCreateAction (const tGfuiAction &onActivate)
 Create a callback hook.
void * GfuiHookCreate (void *userDataOnActivate, tfuiCallback onActivate)
 Create a callback-only screen hook.
void GfuiHookRelease (void *hook)
 Release the given hook.
void GfuiKeyEventRegister (void *scr, tfuiKeyCallback onKeyAction)
 Set the ordinary-key event interceptor for a screen.
void GfuiSKeyEventRegister (void *scr, tfuiSKeyCallback onSKeyAction)
 Set the special-key event interceptor for a screen.
void GfuiKeyEventRegisterCurrent (tfuiKeyCallback onKeyAction)
 Set the ordinary-key interceptor on the currently active screen.
void GfuiSKeyEventRegisterCurrent (tfuiSKeyCallback onSKeyAction)
 Set the special-key interceptor on the currently active screen.
void GfuiAddKeyAction (void *scr, unsigned char key, const char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased)
 Add a Keyboard callback to a screen.
void GfuiAddKey (void *scr, unsigned char key, const char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
 Bind an ordinary key on a screen using callbacks with caller-supplied data.
void GfuiRegisterKeyAction (unsigned char key, char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased)
 Add a Keyboard callback to the current screen.
void GfuiRegisterKey (unsigned char key, char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
 Bind an ordinary key on the currently active screen.
void GfuiAddSKeyAction (void *scr, int key, const char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased)
 Add a Special Keyboard shortcut to the screen.
void GfuiAddSKey (void *scr, int key, const char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
 Bind a GLUT special key, such as an arrow or function key, on a screen.
void GfuiScreenShot (void *)
 Save a screen shot in png format.
void GfuiScreenAddBgImg (void *scr, const char *filename)
 Add an image background to a screen.

Variables

tGfuiScreen * GfuiScreen
static int GfuiMouseVisible = 1
tMouseInfo GfuiMouse
int GfuiMouseHW = 0
float GfuiColor [GFUI_COLORNB][4]
static int ScrW
static int ScrH
static int ViewW
static int ViewH
static tdble DelayRepeat
static double LastTimeClick

Detailed Description

This API is used to manage all the menu screens.

Definition in file gui.cpp.

Macro Definition Documentation

◆ REPEAT1

#define REPEAT1   1.0

Definition at line 44 of file gui.cpp.

◆ REPEAT2

#define REPEAT2   0.2

Definition at line 45 of file gui.cpp.

Function Documentation

◆ gfuiColorInit()

void gfuiColorInit ( void )
static

Definition at line 85 of file gui.cpp.

Here is the call graph for this function:

◆ gfuiCreateAction()

tGfuiAction * gfuiCreateAction ( const tGfuiAction & action)

Definition at line 60 of file gui.cpp.

◆ gfuiInit()

void gfuiInit ( void )

Definition at line 124 of file gui.cpp.

Here is the call graph for this function:

◆ gfuiKeyboard()

void gfuiKeyboard ( unsigned char key,
int ,
int  )
static

Definition at line 284 of file gui.cpp.

Here is the call graph for this function:

◆ gfuiKeyboardUp()

void gfuiKeyboardUp ( unsigned char key,
int ,
int  )
static

Definition at line 358 of file gui.cpp.

Here is the call graph for this function:

◆ gfuiMakeAction()

tGfuiAction gfuiMakeAction ( void * userData,
tfuiCallback callback )

Definition at line 48 of file gui.cpp.

◆ gfuiMotion()

void gfuiMotion ( int x,
int y )
static

Definition at line 470 of file gui.cpp.

Here is the call graph for this function:

◆ gfuiMouse()

void gfuiMouse ( int button,
int state,
int x,
int y )
static

Definition at line 437 of file gui.cpp.

Here is the call graph for this function:

◆ gfuiPassiveMotion()

void gfuiPassiveMotion ( int x,
int y )
static

Definition at line 481 of file gui.cpp.

Here is the call graph for this function:

◆ gfuiReleaseAction()

void gfuiReleaseAction ( tGfuiAction * action)

Definition at line 79 of file gui.cpp.

◆ gfuiRunAction()

void gfuiRunAction ( const tGfuiAction * action)

Definition at line 70 of file gui.cpp.

◆ gfuiSpecial()

void gfuiSpecial ( int key,
int ,
int  )
static

Definition at line 321 of file gui.cpp.

Here is the call graph for this function:

◆ gfuiSpecialUp()

void gfuiSpecialUp ( int key,
int ,
int  )
static

Definition at line 386 of file gui.cpp.

Here is the call graph for this function:

Variable Documentation

◆ DelayRepeat

tdble DelayRepeat
static

Definition at line 42 of file gui.cpp.

◆ GfuiColor

float GfuiColor[GFUI_COLORNB][4]

Definition at line 38 of file gui.cpp.

◆ GfuiMouse

tMouseInfo GfuiMouse

Definition at line 34 of file gui.cpp.

◆ GfuiMouseHW

int GfuiMouseHW = 0

Definition at line 36 of file gui.cpp.

◆ GfuiMouseVisible

int GfuiMouseVisible = 1
static

Definition at line 33 of file gui.cpp.

◆ GfuiScreen

tGfuiScreen* GfuiScreen

Definition at line 32 of file gui.cpp.

◆ LastTimeClick

double LastTimeClick
static

Definition at line 43 of file gui.cpp.

◆ ScrH

int ScrH
static

Definition at line 40 of file gui.cpp.

◆ ScrW

int ScrW
static

Definition at line 40 of file gui.cpp.

◆ ViewH

int ViewH
static

Definition at line 40 of file gui.cpp.

◆ ViewW

int ViewW
static

Definition at line 40 of file gui.cpp.