27 #ifndef __TGFCLIENT__H__ 28 #define __TGFCLIENT__H__ 43 extern unsigned char *
GfImgReadPng(
const char *filename,
int *widthp,
int *heightp,
float gamma);
44 extern int GfImgWritePng(
unsigned char *img,
const char *filename,
int width,
int height);
48 extern void GfScrInit(
int argc,
char *argv[]);
63 #define GFUI_GRBUTTON 2 64 #define GFUI_SCROLLIST 3 65 #define GFUI_SCROLLBAR 4 66 #define GFUI_EDITBOX 5 69 #define GFUI_ALIGN_HL_VB 0x00 70 #define GFUI_ALIGN_HL_VC 0x01 71 #define GFUI_ALIGN_HL_VT 0x02 72 #define GFUI_ALIGN_HC_VB 0x10 73 #define GFUI_ALIGN_HC_VC 0x11 74 #define GFUI_ALIGN_HC_VT 0x12 75 #define GFUI_ALIGN_HR_VB 0x20 76 #define GFUI_ALIGN_HR_VC 0x21 77 #define GFUI_ALIGN_HR_VT 0x22 80 #define GFUI_MOUSE_UP 0 81 #define GFUI_MOUSE_DOWN 1 85 #define GFUI_KEY_DOWN 1 88 #define GFUI_SB_NONE 0 89 #define GFUI_SB_RIGHT 1 90 #define GFUI_SB_LEFT 2 92 #define GFUI_SB_BOTTOM 4 95 #define GFUI_HORI_SCROLLBAR 0 96 #define GFUI_VERT_SCROLLBAR 1 158 #define GFUI_VISIBLE 1 159 #define GFUI_INVISIBLE 0 160 extern int GfuiVisibilitySet(void *scr, int id, int visible); 161 #define GFUI_DISABLE 1 162 #define GFUI_ENABLE 0 163 extern int GfuiEnable(
void *scr,
int id,
int flag);
167 #define GFUI_FONT_BIG 0 168 #define GFUI_FONT_LARGE 1 169 #define GFUI_FONT_MEDIUM 2 170 #define GFUI_FONT_SMALL 3 171 #define GFUI_FONT_BIG_C 4 172 #define GFUI_FONT_LARGE_C 5 173 #define GFUI_FONT_MEDIUM_C 6 174 #define GFUI_FONT_SMALL_C 7 175 #define GFUI_FONT_DIGIT 8 177 int font,
int x,
int y,
int align,
int maxlen);
178 extern int GfuiLabelCreateEx(
void *scr,
const char *text,
float *fgColor,
int font,
int x,
int y,
int align,
int maxlen);
180 extern int GfuiTipCreate(
void *scr,
const char *text,
int maxlen);
186 extern void GfuiPrintString(
const char *text,
float *fgColor,
int font,
int x,
int y,
int align);
192 #define GFUI_BTNSZ 300 194 int x,
int y,
int width,
int align,
int mouse,
198 int x,
int y,
int width,
int align,
int mouse,
201 extern int GfuiButtonStateCreate(
void *scr,
const char *text,
int font,
int x,
int y,
int width,
int align,
int mouse,
204 extern int GfuiGrButtonCreate(
void *scr,
const char *disabled,
const char *enabled,
const char *focused,
const char *pushed,
205 int x,
int y,
int align,
int mouse,
213 extern int GfuiEditboxCreate(
void *scr,
const char *text,
int font,
int x,
int y,
int width,
int maxlen,
231 int min,
int max,
int len,
int start,
271 #define GFCTRL_JOY_UNTESTED -1 272 #define GFCTRL_JOY_NONE 0 273 #define GFCTRL_JOY_PRESENT 1 275 #define GFCTRL_JOY_MAXBUTTON 32 int GfctrlMouseGetCurrent(tCtrlMouseInfo *mouseInfo)
Get the mouse current values.
void GfuiMouseShow(void)
Show the mouse cursor.
void GfImgFreeTex(GLuint tex)
Free the texture.
char * GfuiScrollListExtractSelectedElement(void *scr, int Id, void **userData)
Extract the selected element from the scroll list (removed).
char * GfuiEditboxGetString(void *scr, int id)
Get the string.
void * GfScrMenuInit(void *precMenu)
Create and activate the video options menu screen.
int GfuiButtonStateCreate(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 state button to a screen.
int GfuiEditboxGetFocused(void)
Get the Id of the editbox focused in the current screen.
struct MouseInfo tMouseInfo
void GfuiScreenReplace(void *screen)
Activate a screen and make it current plus release the current screen.
tCtrlJoyInfo * GfctrlJoyInit(void)
Initialize the joystick control.
void GfuiUnSelectCurrent(void)
Remove the focus on the current element.
int GfImgWritePng(unsigned char *img, const char *filename, int width, int height)
Write a buffer to a png image on disk.
GLuint GfImgReadTex(char *filename)
Read a png image into a texture.
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.
void GfuiSKeyEventRegister(void *scr, tfuiSKeyCallback onSKeyAction)
Scalar max(Scalar x, Scalar y)
int GfuiMenuButtonCreate(void *menu, const char *text, const char *tip, void *userdata, tfuiCallback onpush)
Add a button to a menu screen.
bool GfctrlIsEventBlacklisted(void *parmHandle, const char *driversSection, const char *event)
Check if given event is blacklisted (used for buttons or axis which fire a button AND move event)...
void GfuiMouseSetPos(int x, int y)
Set the mouse position.
static float ax[_JS_MAX_AXES *NUM_JOY]
int GfuiTipCreate(void *scr, const char *text, int maxlen)
Add a Tip (generally associated with a button).
void GfScrInit(int argc, char *argv[])
void GfuiScrollBarPosSet(void *scr, int id, int min, int max, int len, int start)
Set new values for position.
static void onSelect(void *)
int GfuiScrollListInsertElement(void *scr, int Id, char *element, int index, void *userData)
Insert an element in a scroll list.
Joystick Information Structure.
void GfctrlMouseRelease(tCtrlMouseInfo *mouseInfo)
Release the tCtrlMouseInfo structure.
tCtrlMouseInfo * GfctrlMouseInit(void)
Initialize the mouse control.
void GfuiAddKey(void *scr, unsigned char key, const char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
Add a Keyboard callback to a screen.
char * GfuiScrollListGetSelectedElement(void *scr, int Id, void **userData)
Get the selected element from the scroll list.
void GfuiDisplay(void)
Display function for the GUI to be called during redisplay of glut.
void GfuiScreenRelease(void *screen)
Release the given screen.
int GfuiLabelCreate(void *scr, const char *text, int font, int x, int y, int align, int maxlen)
Add a label to a screen.
static tCtrlMouseInfo mouseInfo
void * GfuiMenuScreenCreate(const char *title)
Create a new menu screen.
void GfuiKeyEventRegisterCurrent(tfuiKeyCallback onKeyAction)
int GfctrlJoyGetCurrent(tCtrlJoyInfo *joyInfo)
Get the joystick current values.
void GfuiKeyEventRegister(void *scr, tfuiKeyCallback onKeyAction)
int(* tfuiSKeyCallback)(int key, int modifier, int state)
return 1 to prevent normal key computing
int GfuiScrollListMoveSelectedElement(void *scr, int Id, int delta)
Move the selected element within the scroll list.
int GfuiEditboxCreate(void *scr, const char *text, int font, int x, int y, int width, int maxlen, void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost, int margin=10)
Add a editbox to a screen.
void GfuiScreenAddBgImg(void *scr, const char *filename)
Add an image background to a screen.
void GfctrlJoyRelease(tCtrlJoyInfo *joyInfo)
Release the tCtrlJoyInfo structure.
int(* tfuiKeyCallback)(unsigned char key, int modifier, int state)
return 1 to prevent normal key computing
int GfuiButtonGetFocused(void)
Get the Id of the button focused in the current screen.
void GfuiIdle(void)
Idle function for the GUI to be called during Idle loop of glut.
static void onPush(void *vi)
void GfuiStaticImageSet(void *scr, int id, char *name)
Replace an image by another one.
void GfuiRegisterKey(unsigned char key, char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
Add a Keyboard callback to the current screen.
char * GfuiScrollListExtractElement(void *scr, int Id, int index, void **userData)
Extract the specified element from the scroll list.
void GfuiDisplayNothing(void)
Dummy display function for glut.
void GfuiMouseSetHWPresent(void)
Force the hardware mouse pointer.
void GfuiButtonSetText(void *scr, int id, const char *text)
Change the label of a button.
void * GfuiScreenCreateEx(float *bgColor, void *userDataOnActivate, tfuiCallback onActivate, void *userDataOnDeactivate, tfuiCallback onDeactivate, int mouseAllowed)
Create a screen.
void GfuiEditboxSetString(void *scr, int id, const char *text)
Set a new string.
void GfuiLabelSetText(void *scr, int id, const char *text)
Change the text of a label.
float tdble
Floating point type used in TORCS.
static void onActivate(void *)
const char * GfctrlGetNameByRef(GfCtrlType type, int index)
Get a control name by its reference.
static void onFocusLost(void *)
unsigned char * GfImgReadPng(const char *filename, int *widthp, int *heightp, float gamma)
Load an image from disk to a buffer in RGBA mode.
void GfuiSKeyEventRegisterCurrent(tfuiSKeyCallback onSKeyAction)
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.
The Gaming Framework API.
Parameter set handle structure, multiple handles can reference the same parameter set...
tMouseInfo * GfuiMouseInfo(void)
Get the mouse information (position and buttons)
int GfuiLeanButtonCreate(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)
void GfuiLabelSetColor(void *scr, int id, float *color)
Change the color of a label.
int GfuiGlutExtensionSupported(const char *str)
void GfuiMenuDefaultKeysAdd(void *scr)
Add the default menu keyboard callback to a screen.
int GfuiFontWidth(int font, const char *text)
int GfuiFontHeight(int font)
int GfuiStaticImageCreate(void *scr, int x, int y, int w, int h, char *name)
Create a new static image.
int GfctrlJoyIsPresent(void)
Check if a joystick is present.
int GfuiScreenIsActive(void *screen)
Tell if the screen is active or not.
void * GfuiHookCreate(void *userDataOnActivate, tfuiCallback onActivate)
Create a callback hook.
void(* tfuiCallback)(void *)
void GfctrlMouseInitCenter(void)
Get the reference position.
void GfuiMouseHide(void)
Hide the mouse cursor.
void GfuiScreenActivate(void *screen)
Activate a screen and make it current.
void GfuiAddSKey(void *scr, int key, const char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
Add a Special Keyboard shortcut to the screen.
int GfuiScrollBarPosGet(void *scr, int id)
Get the current position of a scroll bar.
int GfuiEnable(void *scr, int id, int flag)
Enable / Disable an object.
#define GFCTRL_JOY_MAXBUTTON
void GfctrlGetRefByName(const char *name, tCtrlRef *ref)
Get a control reference by its name.
void GfScrGetSize(int *ScrW, int *ScrH, int *ViewW, int *ViewH)
Get the screen and viewport sizes.
void GfuiHelpScreen(void *prevScreen)
Generate a help screen.
Scalar min(Scalar x, Scalar y)
void GfuiScreenShot(void *notused)
Save a screen shot in png format.
const char * GfctrlGetDefaultSection(GfCtrlType type)
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).
int GfuiTitleCreate(void *scr, const char *text, int maxlen)
Add a Title to the screen.
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.
void GfctrlMouseCenter(void)
Recentre the mouse on the screen.
int GfuiGrButtonCreate(void *scr, const char *disabled, const char *enabled, const char *focused, const 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 * GfuiScreenCreate(void)
Create a new screen.
void GfuiPrintString(const char *text, float *fgColor, int font, int x, int y, int align)
static int onKeyAction(unsigned char key, int, int state)
void GfTime2Str(char *result, int resultSize, tdble sec, int sgn)
Convert a time in seconds (float) to an ascii string.
Mouse information structure.
struct ScrollBarInfo tScrollBarInfo
Scroll bar call-back information.
void GfScrShutdown(void)
Shutdown the screen.
void GfuiHookRelease(void *hook)
Release the given hook.
int GfuiMenuBackQuitButtonCreate(void *menu, const char *text, const char *tip, void *userdata, tfuiCallback onpush)
Add the "Back" or "Quit" button at the bottom of the menu screen.
void(* tfuiSBCallback)(tScrollBarInfo *)
void GfuiScreenDeactivate(void)
Deactivate the current screen.
static int onSKeyAction(int key, int, int state)