torcs - 1.2.2

src/libs/tgfclient/tgfclient.h File Reference


Detailed Description

The Gaming Framework API (client part).

Author:
Eric Espie
Version:
Id
tgfclient.h,v 1.2 2003/06/24 21:02:25 torcs Exp

#include <tgf.h>
#include <GL/glut.h>
#include <js.h>
#include <screen_properties.h>

Include dependency graph for tgfclient.h:

Include dependency graph

Go to the source code of this file.

Compounds

struct  MouseInfo
struct  ScrollBarInfo
 Scroll bar call-back information. More...

struct  tCtrlJoyInfo
 Joystick Information Structure. More...

struct  tCtrlMouseInfo
 Mouse information structure. More...

struct  tCtrlRef

Defines

#define GFUI_LABEL   0
#define GFUI_BUTTON   1
#define GFUI_GRBUTTON   2
#define GFUI_SCROLLIST   3
#define GFUI_SCROLLBAR   4
#define GFUI_EDITBOX   5
#define GFUI_ALIGN_HL_VB   0x00
#define GFUI_ALIGN_HL_VC   0x01
#define GFUI_ALIGN_HL_VT   0x02
#define GFUI_ALIGN_HC_VB   0x10
#define GFUI_ALIGN_HC_VC   0x11
#define GFUI_ALIGN_HC_VT   0x12
#define GFUI_ALIGN_HR_VB   0x20
#define GFUI_ALIGN_HR_VC   0x21
#define GFUI_ALIGN_HR_VT   0x22
#define GFUI_MOUSE_UP   0
#define GFUI_MOUSE_DOWN   1
#define GFUI_KEY_UP   0
#define GFUI_KEY_DOWN   1
#define GFUI_SB_NONE   0
#define GFUI_SB_RIGHT   1
#define GFUI_SB_LEFT   2
#define GFUI_SB_TOP   3
#define GFUI_SB_BOTTOM   4
#define GFUI_HORI_SCROLLBAR   0
#define GFUI_VERT_SCROLLBAR   1
#define GFUI_VISIBLE   1
 Object visibility flag.

#define GFUI_INVISIBLE   0
 Object invisibility flag.

#define GFUI_DISABLE   1
#define GFUI_ENABLE   0
#define GFUI_FONT_BIG   0
#define GFUI_FONT_LARGE   1
#define GFUI_FONT_MEDIUM   2
#define GFUI_FONT_SMALL   3
#define GFUI_FONT_BIG_C   4
#define GFUI_FONT_LARGE_C   5
#define GFUI_FONT_MEDIUM_C   6
#define GFUI_FONT_SMALL_C   7
#define GFUI_FONT_DIGIT   8
#define GFUI_BTNSZ   300
#define GFCTRL_TYPE_NOT_AFFECTED   0
#define GFCTRL_TYPE_JOY_AXIS   1
#define GFCTRL_TYPE_JOY_BUT   2
#define GFCTRL_TYPE_KEYBOARD   3
#define GFCTRL_TYPE_MOUSE_BUT   4
#define GFCTRL_TYPE_MOUSE_AXIS   5
#define GFCTRL_TYPE_SKEYBOARD   6
#define GFCTRL_JOY_UNTESTED   -1
#define GFCTRL_JOY_NONE   0
#define GFCTRL_JOY_PRESENT   1
#define GFCTRL_JOY_MAXBUTTON   32

Typedefs

typedef ScrollBarInfo tScrollBarInfo
 Scroll bar call-back information.

typedef void(* tfuiCallback )(void *)
typedef void(* tfuiSBCallback )(tScrollBarInfo *)
typedef int(* tfuiKeyCallback )(unsigned char key, int modifier, int state)
 return 1 to prevent normal key computing

typedef int(* tfuiSKeyCallback )(int key, int modifier, int state)
 return 1 to prevent normal key computing

typedef MouseInfo tMouseInfo

Functions

void GfInitClient (void)
unsigned char * GfImgReadPng (const char *filename, int *widthp, int *heightp, float gamma)
 Load an image from disk to a buffer in RGBA mode.

int GfImgWritePng (unsigned char *img, const char *filename, int width, int height)
 Write a buffer to a png image on disk.

void GfImgFreeTex (GLuint tex)
 Free the texture.

GLuint GfImgReadTex (char *filename)
 Read a png image into a texture.

void GfScrInit (int argc, char *argv[])
void GfScrShutdown (void)
 Shutdown the screen.

void * GfScrMenuInit (void *precMenu)
 Create and activate the video options menu screen.

char * GfTime2Str (tdble sec, int sgn)
 Convert a time in seconds (float) to an ascii string.

void GfScrGetSize (int *ScrW, int *ScrH, int *ViewW, int *ViewH)
 Get the screen and viewport sizes.

void GfScrReinit (void *)
void GfuiDisplay (void)
 Display function for the GUI to be called during redisplay of glut.

void GfuiDisplayNothing (void)
 Dummy display function for glut.

void GfuiIdle (void)
 Idle function for the GUI to be called during Idle loop of glut.

void * GfuiScreenCreate (void)
 Create a new screen.

void * GfuiScreenCreateEx (float *bgColor, void *userDataOnActivate, tfuiCallback onActivate, void *userDataOnDeactivate, tfuiCallback onDeactivate, int mouseAllowed)
 Create a screen.

void GfuiScreenRelease (void *screen)
 Release the given screen.

void GfuiScreenActivate (void *screen)
 Activate a screen and make it current.

int GfuiScreenIsActive (void *screen)
 Tell if the screen is active or not.

void GfuiScreenReplace (void *screen)
 Activate a screen and make it current plus release the current screen.

void GfuiScreenDeactivate (void)
 Deactivate the current screen.

void * GfuiHookCreate (void *userDataOnActivate, tfuiCallback onActivate)
 Create a callback hook.

void GfuiHookRelease (void *hook)
 Release the given hook.

void GfuiAddKey (void *scr, unsigned char key, char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
 Add a Keyboard callback to a screen.

void GfuiRegisterKey (unsigned char key, char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
 Add a Keyboard callback to the current screen.

void GfuiAddSKey (void *scr, int key, char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
 Add a Special Keyboard shortcut to the screen.

void GfuiHelpScreen (void *prevScreen)
 Generate a help screen.

void GfuiScreenShot (void *notused)
 Save a screen shot in png format.

void GfuiScreenAddBgImg (void *scr, char *filename)
 Add an image background to a screen.

void GfuiKeyEventRegister (void *scr, tfuiKeyCallback onKeyAction)
void GfuiSKeyEventRegister (void *scr, tfuiSKeyCallback onSKeyAction)
void GfuiKeyEventRegisterCurrent (tfuiKeyCallback onKeyAction)
void GfuiSKeyEventRegisterCurrent (tfuiSKeyCallback onSKeyAction)
tMouseInfoGfuiMouseInfo (void)
 Get the mouse information (position and buttons).

void GfuiMouseSetPos (int x, int y)
 Set the mouse position.

void GfuiMouseHide (void)
 Hide the mouse cursor.

void GfuiMouseShow (void)
 Show the mouse cursor.

void GfuiMouseSetHWPresent (void)
 Force the hardware mouse pointer.

int GfuiVisibilitySet (void *scr, int id, int visible)
 Set/unset the visibility attribute of an object.

int GfuiEnable (void *scr, int id, int flag)
 Enable / Disable an object.

void GfuiUnSelectCurrent (void)
 Remove the focus on the current element.

int GfuiLabelCreate (void *scr, char *text, int font, int x, int y, int align, int maxlen)
 Add a label to a screen.

int GfuiLabelCreateEx (void *scr, char *text, float *fgColor, int font, int x, int y, int align, int maxlen)
 Create a new label (extended version).

int GfuiTipCreate (void *scr, char *text, int maxlen)
 Add a Tip (generally associated with a button).

int GfuiTitleCreate (void *scr, char *text, int maxlen)
 Add a Title to the screen.

void GfuiLabelSetText (void *scr, int id, char *text)
 Change the text of a label.

void GfuiLabelSetColor (void *scr, int id, float *color)
 Change the color of a label.

void GfuiPrintString (char *text, float *fgColor, int font, int x, int y, int align)
int GfuiFontHeight (int font)
int GfuiFontWidth (int font, char *text)
int GfuiButtonCreate (void *scr, 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.

int GfuiButtonStateCreate (void *scr, 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 state button to a screen.

int GfuiGrButtonCreate (void *scr, char *disabled, char *enabled, char *focused, char *pushed, int x, int y, int align, int mouse, void *userDataOnPush, tfuiCallback onPush, void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost)
 Add a graphical button to a screen.

void GfuiButtonSetText (void *scr, int id, char *text)
 Change the label of a button.

int GfuiButtonGetFocused (void)
 Get the Id of the button focused in the current screen.

int GfuiEditboxCreate (void *scr, char *text, int font, int x, int y, int width, int maxlen, void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost)
 Add a editbox to a screen.

int GfuiEditboxGetFocused (void)
 Get the Id of the editbox focused in the current screen.

char * GfuiEditboxGetString (void *scr, int id)
 Get the string.

void GfuiEditboxSetString (void *scr, int id, char *text)
 Set a new string.

int GfuiScrollListCreate (void *scr, int font, int x, int y, int align, int width, int height, int scrollbar, void *userDataOnSelect, tfuiCallback onSelect)
 Create a new scroll list.

int GfuiScrollListInsertElement (void *scr, int Id, char *element, int index, void *userData)
 Insert an element in a scroll list.

int GfuiScrollListMoveSelectedElement (void *scr, int Id, int delta)
 Move the selected element within the scroll list.

char * GfuiScrollListExtractSelectedElement (void *scr, int Id, void **userData)
 Extract the selected element from the scroll list (removed).

char * GfuiScrollListExtractElement (void *scr, int Id, int index, void **userData)
 Extract the specified element from the scroll list.

char * GfuiScrollListGetSelectedElement (void *scr, int Id, void **userData)
 Get the selected element from the scroll list.

char * GfuiScrollListGetElement (void *scr, int Id, int index, void **userData)
 Get the specified element from the scroll list.

int GfuiScrollBarCreate (void *scr, int x, int y, int align, int width, int orientation, int min, int max, int len, int start, void *userData, tfuiSBCallback onScroll)
 Create a new scroll bar.

void GfuiScrollBarPosSet (void *scr, int id, int min, int max, int len, int start)
 Set new values for position.

int GfuiScrollBarPosGet (void *scr, int id)
 Get the current position of a scroll bar.

int GfuiStaticImageCreate (void *scr, int x, int y, int w, int h, char *name)
 Create a new static image.

void GfuiStaticImageSet (void *scr, int id, char *name)
 Replace an image by another one.

void * GfuiMenuScreenCreate (char *title)
 Create a new menu screen.

void GfuiMenuDefaultKeysAdd (void *scr)
 Add the default menu keyboard callback to a screen.

int GfuiMenuButtonCreate (void *menu, char *text, char *tip, void *userdata, tfuiCallback onpush)
 Add a button to a menu screen.

int GfuiMenuBackQuitButtonCreate (void *menu, char *text, char *tip, void *userdata, tfuiCallback onpush)
 Add the "Back" or "Quit" button at the bottom of the menu screen.

tCtrlJoyInfoGfctrlJoyInit (void)
 Initialize the joystick control.

int GfctrlJoyIsPresent (void)
 Check if a joystick is present.

int GfctrlJoyGetCurrent (tCtrlJoyInfo *joyInfo)
 Get the joystick current values.

void GfctrlJoyRelease (tCtrlJoyInfo *joyInfo)
 Release the tCtrlJoyInfo structure.

tCtrlMouseInfoGfctrlMouseInit (void)
 Initialize the mouse control.

int GfctrlMouseGetCurrent (tCtrlMouseInfo *mouseInfo)
 Get the mouse current values.

void GfctrlMouseRelease (tCtrlMouseInfo *mouseInfo)
 Release the tCtrlMouseInfo structure.

void GfctrlMouseCenter (void)
 Recentre the mouse on the screen.

void GfctrlMouseInitCenter (void)
 Get the reference position.

tCtrlRefGfctrlGetRefByName (char *name)
 Get a control reference by its name.

char * GfctrlGetNameByRef (int type, int index)
 Get a control name by its reference.


Define Documentation

#define GFCTRL_JOY_MAXBUTTON   32
 

#define GFCTRL_JOY_NONE   0
 

#define GFCTRL_JOY_PRESENT   1
 

#define GFCTRL_JOY_UNTESTED   -1
 

#define GFCTRL_TYPE_JOY_AXIS   1
 

#define GFCTRL_TYPE_JOY_BUT   2
 

#define GFCTRL_TYPE_KEYBOARD   3
 

#define GFCTRL_TYPE_MOUSE_AXIS   5
 

#define GFCTRL_TYPE_MOUSE_BUT   4
 

#define GFCTRL_TYPE_NOT_AFFECTED   0
 

#define GFCTRL_TYPE_SKEYBOARD   6
 

#define GFUI_ALIGN_HC_VB   0x10
 

#define GFUI_ALIGN_HC_VC   0x11
 

#define GFUI_ALIGN_HC_VT   0x12
 

#define GFUI_ALIGN_HL_VB   0x00
 

#define GFUI_ALIGN_HL_VC   0x01
 

#define GFUI_ALIGN_HL_VT   0x02
 

#define GFUI_ALIGN_HR_VB   0x20
 

#define GFUI_ALIGN_HR_VC   0x21
 

#define GFUI_ALIGN_HR_VT   0x22
 

#define GFUI_BTNSZ   300
 

#define GFUI_BUTTON   1
 

#define GFUI_DISABLE   1
 

#define GFUI_EDITBOX   5
 

#define GFUI_ENABLE   0
 

#define GFUI_FONT_BIG   0
 

#define GFUI_FONT_BIG_C   4
 

#define GFUI_FONT_DIGIT   8
 

#define GFUI_FONT_LARGE   1
 

#define GFUI_FONT_LARGE_C   5
 

#define GFUI_FONT_MEDIUM   2
 

#define GFUI_FONT_MEDIUM_C   6
 

#define GFUI_FONT_SMALL   3
 

#define GFUI_FONT_SMALL_C   7
 

#define GFUI_GRBUTTON   2
 

#define GFUI_HORI_SCROLLBAR   0
 

#define GFUI_INVISIBLE   0
 

Object invisibility flag.

#define GFUI_KEY_DOWN   1
 

#define GFUI_KEY_UP   0
 

#define GFUI_LABEL   0
 

#define GFUI_MOUSE_DOWN   1
 

#define GFUI_MOUSE_UP   0
 

#define GFUI_SB_BOTTOM   4
 

#define GFUI_SB_LEFT   2
 

#define GFUI_SB_NONE   0
 

#define GFUI_SB_RIGHT   1
 

#define GFUI_SB_TOP   3
 

#define GFUI_SCROLLBAR   4
 

#define GFUI_SCROLLIST   3
 

#define GFUI_VERT_SCROLLBAR   1
 

#define GFUI_VISIBLE   1
 

Object visibility flag.


Typedef Documentation

typedef void(* tfuiCallback)(void * )
 

typedef int(* tfuiKeyCallback)(unsigned char key, int modifier, int state)
 

return 1 to prevent normal key computing

typedef void(* tfuiSBCallback)(tScrollBarInfo *)
 

typedef int(* tfuiSKeyCallback)(int key, int modifier, int state)
 

return 1 to prevent normal key computing

typedef struct MouseInfo tMouseInfo
 

typedef struct ScrollBarInfo tScrollBarInfo
 

Scroll bar call-back information.


Function Documentation

void GfInitClient void   ) 
 

Here is the call graph for this function:

void GfScrInit int  argc,
char *  argv[]
 

Here is the call graph for this function:

void GfScrReinit void *   ) 
 

Here is the call graph for this function:

int GfuiFontHeight int  font  ) 
 

Here is the call graph for this function:

int GfuiFontWidth int  font,
char *  text
 

Here is the call graph for this function:

void GfuiKeyEventRegister void *  scr,
tfuiKeyCallback  onKeyAction
 

void GfuiKeyEventRegisterCurrent tfuiKeyCallback  onKeyAction  ) 
 

void GfuiPrintString char *  text,
float *  fgColor,
int  font,
int  x,
int  y,
int  align
 

Here is the call graph for this function:

void GfuiSKeyEventRegister void *  scr,
tfuiSKeyCallback  onSKeyAction
 

void GfuiSKeyEventRegisterCurrent tfuiSKeyCallback  onSKeyAction  ) 
 

int GfuiTipCreate void *  scr,
char *  text,
int  maxlen
 

Add a Tip (generally associated with a button).

Parameters:
scr Screen where to add the label
text Text of the label
maxlen Maximum length of the button string (used when the label is changed)
Returns:
label Id
See also:
GfuiSetLabelText

Here is the call graph for this function:


Generated at Thu Feb 26 21:53:12 2004 for torcs by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-1999
TORCS © Eric Espié 1999, 2002.