TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
tgfclient.h
Go to the documentation of this file.
1/***************************************************************************
2 tgfclient.h -- Interface file for The Gaming Framework
3 -------------------
4 created : Fri Aug 13 22:32:14 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
25
26#ifndef __TGFCLIENT__H__
27#define __TGFCLIENT__H__
28
29#include <functional>
30
31#include <tgf.h>
32#include <GL/glut.h>
33#include <plib/js.h>
34#include <screen_properties.h>
35
36#define NUM_JOY 8
37
38extern void GfInitClient(void);
39
40/********************
41 * Screen Interface *
42 ********************/
43
44extern unsigned char *GfImgReadPng(const char *filename, int *widthp, int *heightp, float gamma);
45extern int GfImgWritePng(unsigned char *img, const char *filename, int width, int height);
46extern int GfImgWritePngNoGamma(unsigned char *img, const char *filename, int width, int height);
47extern void GfImgFreeTex(GLuint tex);
48extern GLuint GfImgReadTex(char *filename);
49
50extern void GfScrInit(int argc, char *argv[]);
51extern void GfScrShutdown(void);
52extern void *GfScrMenuInit(void *precMenu);
53extern void GfTime2Str(char *result, int resultSize, tdble sec, int sgn);
54extern void GfScrGetSize(int *ScrW, int *ScrH, int *ViewW, int *ViewH);
55extern void GfScrReinit(void*);
56
57
58/*****************************
59 * GUI interface (low-level) *
60 *****************************/
61
62/* Widget type */
63#define GFUI_LABEL 0
64#define GFUI_BUTTON 1
65#define GFUI_GRBUTTON 2
66#define GFUI_SCROLLIST 3
67#define GFUI_SCROLLBAR 4
68#define GFUI_EDITBOX 5
69
70/* Alignment */
71#define GFUI_ALIGN_HL_VB 0x00
72#define GFUI_ALIGN_HL_VC 0x01
73#define GFUI_ALIGN_HL_VT 0x02
74#define GFUI_ALIGN_HC_VB 0x10
75#define GFUI_ALIGN_HC_VC 0x11
76#define GFUI_ALIGN_HC_VT 0x12
77#define GFUI_ALIGN_HR_VB 0x20
78#define GFUI_ALIGN_HR_VC 0x21
79#define GFUI_ALIGN_HR_VT 0x22
80
81/* Mouse action */
82#define GFUI_MOUSE_UP 0
83#define GFUI_MOUSE_DOWN 1
84
85/* Keyboard action */
86#define GFUI_KEY_UP 0
87#define GFUI_KEY_DOWN 1
88
89/* Scroll Bar position */
90#define GFUI_SB_NONE 0
91#define GFUI_SB_RIGHT 1
92#define GFUI_SB_LEFT 2
93#define GFUI_SB_TOP 3
94#define GFUI_SB_BOTTOM 4
95
96/* Scroll bar orientation */
97#define GFUI_HORI_SCROLLBAR 0
98#define GFUI_VERT_SCROLLBAR 1
99
101typedef struct ScrollBarInfo
102{
103 int pos;
104 void *userData;
106
107typedef std::function<void()> tGfuiAction;
108typedef void (*tfuiCallback)(void * /* userdata */);
110typedef int (*tfuiKeyCallback)(unsigned char key, int modifier, int state);
111typedef int (*tfuiSKeyCallback)(int key, int modifier, int state);
112
113
114/* GLUT Callback functions */
115/* should be called explicitely if */
116/* the corresponding GLUT Func is overriden */
117/* after a call to GfuiActivateScreen */
118extern void GfuiDisplay(void);
119extern void GfuiDisplayNothing(void);
120extern void GfuiIdle(void);
121
122/* Screen management */
123extern void *GfuiScreenCreate(void);
124extern void *GfuiScreenCreateExAction(float *bgColor,
125 const tGfuiAction &onActivate,
126 const tGfuiAction &onDeactivate,
127 int mouseAllowed);
139extern void *GfuiScreenCreateEx(float *bgColor,
140 void *userDataOnActivate, tfuiCallback onActivate,
141 void *userDataOnDeactivate, tfuiCallback onDeactivate,
142 int mouseAllowed);
143extern void GfuiScreenRelease(void *screen);
144extern void GfuiScreenActivate(void *screen);
145extern int GfuiScreenIsActive(void *screen);
146extern void GfuiScreenReplace(void *screen);
147extern void GfuiScreenDeactivate(void);
148extern void *GfuiHookCreateAction(const tGfuiAction &onActivate);
156extern void *GfuiHookCreate(void *userDataOnActivate, tfuiCallback onActivate);
157extern void GfuiHookRelease(void *hook);
158extern void GfuiAddKeyAction(void *scr, unsigned char key, const char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased);
169extern void GfuiAddKey(void *scr, unsigned char key, const char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased);
170extern void GfuiRegisterKeyAction(unsigned char key, char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased);
180extern void GfuiRegisterKey(unsigned char key, char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased);
181extern void GfuiAddSKeyAction(void *scr, int key, const char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased);
192extern void GfuiAddSKey(void *scr, int key, const char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased);
193extern void GfuiHelpScreen(void *prevScreen);
194extern void GfuiScreenShot(void *notused);
195extern void GfuiScreenAddBgImg(void *scr, const char *filename);
203extern void GfuiKeyEventRegister(void *scr, tfuiKeyCallback onKeyAction);
222
223/* mouse */
224typedef struct MouseInfo
225{
226 int X;
227 int Y;
228 int button[3];
230
231extern tMouseInfo *GfuiMouseInfo(void);
232extern void GfuiMouseSetPos(int x, int y);
233extern void GfuiMouseHide(void);
234extern void GfuiMouseShow(void);
235extern void GfuiMouseSetHWPresent(void);
236
237/* all widgets */
238#define GFUI_VISIBLE 1
239#define GFUI_INVISIBLE 0
240extern int GfuiVisibilitySet(void *scr, int id, int visible);
241#define GFUI_DISABLE 1
242#define GFUI_ENABLE 0
243extern int GfuiEnable(void *scr, int id, int flag);
244extern void GfuiUnSelectCurrent(void);
245
246/* labels */
247#define GFUI_FONT_BIG 0
248#define GFUI_FONT_LARGE 1
249#define GFUI_FONT_MEDIUM 2
250#define GFUI_FONT_SMALL 3
251#define GFUI_FONT_BIG_C 4
252#define GFUI_FONT_LARGE_C 5
253#define GFUI_FONT_MEDIUM_C 6
254#define GFUI_FONT_SMALL_C 7
255#define GFUI_FONT_DIGIT 8
256extern int GfuiLabelCreate(void *scr, const char *text,
257 int font, int x, int y, int align, int maxlen);
258extern int GfuiLabelCreateEx(void *scr, const char *text, float *fgColor, int font, int x, int y, int align, int maxlen);
259
260extern int GfuiTipCreate(void *scr, const char *text, int maxlen);
261extern int GfuiTitleCreate(void *scr, const char *text, int maxlen);
262
263extern void GfuiLabelSetText(void *scr, int id, const char *text);
264extern void GfuiLabelSetColor(void *scr, int id, float *color);
265
275extern void GfuiPrintString(const char *text, float *fgColor, int font, int x, int y, int align);
281extern int GfuiFontHeight(int font);
288extern int GfuiFontWidth(int font, const char *text);
289
290
291/* buttons */
292#define GFUI_BTNSZ 300
293extern int GfuiButtonCreateAction(void *scr, const char *text, int font,
294 int x, int y, int width, int align, int mouse,
295 const tGfuiAction &onPush,
296 const tGfuiAction &onFocus, const tGfuiAction &onFocusLost);
303extern int GfuiButtonCreate(void *scr, const char *text, int font,
304 int x, int y, int width, int align, int mouse,
305 void *userDataOnPush, tfuiCallback onPush,
306 void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost);
313extern int GfuiLeanButtonCreateAction(void *scr, const char *text, int font,
314 int x, int y, int width, int align, int mouse,
315 const tGfuiAction &onPush,
316 const tGfuiAction &onFocus, const tGfuiAction &onFocusLost);
323extern int GfuiLeanButtonCreate(void *scr, const char *text, int font,
324 int x, int y, int width, int align, int mouse,
325 void *userDataOnPush, tfuiCallback onPush,
326 void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost);
334extern int GfuiButtonStateCreateAction(void *scr, const char *text, int font, int x, int y, int width, int align, int mouse,
335 const tGfuiAction &onPush,
336 const tGfuiAction &onFocus, const tGfuiAction &onFocusLost);
337extern int GfuiButtonStateCreate(void *scr, const char *text, int font, int x, int y, int width, int align, int mouse,
338 void *userDataOnPush, tfuiCallback onPush,
339 void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost);
340extern int GfuiGrButtonCreateAction(void *scr, const char *disabled, const char *enabled, const char *focused, const char *pushed,
341 int x, int y, int align, int mouse,
342 const tGfuiAction &onPush,
343 const tGfuiAction &onFocus, const tGfuiAction &onFocusLost);
350extern int GfuiGrButtonCreate(void *scr, const char *disabled, const char *enabled, const char *focused, const char *pushed,
351 int x, int y, int align, int mouse,
352 void *userDataOnPush, tfuiCallback onPush,
353 void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost);
354
355extern void GfuiButtonSetText(void *scr, int id, const char *text);
356extern int GfuiButtonGetFocused(void);
357
358/* Edit Box */
359extern int GfuiEditboxCreateAction(void *scr, const char *text, int font, int x, int y, int width, int maxlen,
360 const tGfuiAction &onFocus, const tGfuiAction &onFocusLost, int margin = 10);
366extern int GfuiEditboxCreate(void *scr, const char *text, int font, int x, int y, int width, int maxlen,
367 void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost, int margin = 10);
368extern int GfuiEditboxGetFocused(void);
369extern char *GfuiEditboxGetString(void *scr, int id);
370extern void GfuiEditboxSetString(void *scr, int id, const char *text);
371
372/* Scrolling lists */
373extern int GfuiScrollListCreateAction(void *scr, int font, int x, int y, int align,
374 int width, int height, int scrollbar, const tGfuiAction &onSelect);
391extern int GfuiScrollListCreate(void *scr, int font, int x, int y, int align,
392 int width, int height, int scrollbar, void *userDataOnSelect, tfuiCallback onSelect);
393extern int GfuiScrollListInsertElement(void *scr, int Id, char *element, int index, void *userData);
394extern int GfuiScrollListMoveSelectedElement(void *scr, int Id, int delta);
395extern char *GfuiScrollListExtractSelectedElement(void *scr, int Id, void **userData);
396extern char *GfuiScrollListExtractElement(void *scr, int Id, int index, void **userData);
397extern char *GfuiScrollListGetSelectedElement(void *scr, int Id, void **userData);
398extern char *GfuiScrollListGetElement(void *scr, int Id, int index, void **userData);
399
400/* scroll bars */
401extern int GfuiScrollBarCreate(void *scr, int x, int y, int align, int width, int orientation,
402 int min, int max, int len, int start,
403 void *userData, tfuiSBCallback onScroll);
404extern void GfuiScrollBarPosSet(void *scr, int id, int min, int max, int len, int start);
405extern int GfuiScrollBarPosGet(void *scr, int id);
406
407/* Images */
408extern int GfuiStaticImageCreate(void *scr, int x, int y, int w, int h, char *name);
409extern void GfuiStaticImageSet(void *scr, int id, char *name);
410
411/*****************************
412 * Menu Management Interface *
413 *****************************/
414
415extern void *GfuiMenuScreenCreate(const char *title);
416extern void GfuiMenuDefaultKeysAdd(void *scr);
427extern int GfuiMenuButtonCreateAction(void *menu, const char *text, const char *tip, const tGfuiAction &onpush);
428extern int GfuiMenuButtonCreateActionWithDisabledTip(void *menu, const char *text, const char *tip, const char *disabledTip, const tGfuiAction &onpush);
440extern int GfuiMenuButtonCreate(void *menu, const char *text, const char *tip, void *userdata, tfuiCallback onpush);
441extern int GfuiMenuBackQuitButtonCreateAction(void *menu, const char *text, const char *tip, const tGfuiAction &onpush);
454extern int GfuiMenuBackQuitButtonCreate(void *menu, const char *text, const char *tip, void *userdata, tfuiCallback onpush);
455
456
457/*********************
458 * Control interface *
459 *********************/
460
470
471typedef struct
472{
473 int index;
475} tCtrlRef;
476
477
478#define GFCTRL_JOY_UNTESTED -1
479#define GFCTRL_JOY_NONE 0
480#define GFCTRL_JOY_PRESENT 1
481
482#define GFCTRL_JOY_MAXBUTTON 32 /* Size of integer so don't change please */
483
493
494extern tCtrlJoyInfo *GfctrlJoyInit(void);
495extern int GfctrlJoyIsPresent(void);
496extern int GfctrlJoyGetCurrent(tCtrlJoyInfo *joyInfo);
497extern void GfctrlJoyRelease(tCtrlJoyInfo *joyInfo);
498
499
501typedef struct
502{
503 int edgeup[3];
504 int edgedn[3];
505 int button[3];
506 float ax[4];
508
509extern tCtrlMouseInfo *GfctrlMouseInit(void);
512extern void GfctrlMouseCenter(void);
513extern void GfctrlMouseInitCenter(void);
514extern void GfctrlGetRefByName(const char *name, tCtrlRef* ref);
515extern const char *GfctrlGetNameByRef(GfCtrlType type, int index);
516extern const char *GfctrlGetDefaultSection(GfCtrlType type);
517extern bool GfctrlIsEventBlacklisted(void *parmHandle, const char* driversSection, const char* event);
518
524extern int GfuiGlutExtensionSupported(const char *str);
525
526
527#endif /* __TGFCLIENT__H__ */
Scalar min(Scalar x, Scalar y)
Definition Basic.h:49
int sgn(Scalar x)
Definition Basic.h:46
Scalar max(Scalar x, Scalar y)
Definition Basic.h:50
static Vector y[4]
Definition Convex.cpp:56
static int onKeyAction(unsigned char key, int, int state)
static int onSKeyAction(int key, int, int state)
static void onPush(tCmdInfo *cmdInfo)
static void onActivate(void)
static void onFocusLost(void)
static tCtrlMouseInfo mouseInfo
static void onSelect(void *)
int GfctrlJoyGetCurrent(tCtrlJoyInfo *joyInfo)
Get the joystick current values.
Definition control.cpp:348
tCtrlMouseInfo * GfctrlMouseInit(void)
Initialize the mouse control.
Definition control.cpp:398
int GfctrlMouseGetCurrent(tCtrlMouseInfo *mouseInfo)
Get the mouse current values.
Definition control.cpp:425
void GfctrlMouseRelease(tCtrlMouseInfo *mouseInfo)
Release the tCtrlMouseInfo structure.
Definition control.cpp:410
void GfctrlGetRefByName(const char *name, tCtrlRef *ref)
Get a control reference by its name.
Definition control.cpp:123
int GfctrlJoyIsPresent(void)
Check if a joystick is present.
Definition control.cpp:331
const char * GfctrlGetNameByRef(GfCtrlType type, int index)
Get a control name by its reference.
Definition control.cpp:191
tCtrlJoyInfo * GfctrlJoyInit(void)
Initialize the joystick control.
Definition control.cpp:303
void GfctrlJoyRelease(tCtrlJoyInfo *joyInfo)
Release the tCtrlJoyInfo structure.
Definition control.cpp:320
void GfuiMouseSetHWPresent(void)
Force the hardware mouse pointer.
Definition gui.cpp:278
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).
Definition control.cpp:498
void GfctrlMouseInitCenter(void)
Get the reference position.
Definition control.cpp:485
void GfctrlMouseCenter(void)
Recentre the mouse on the screen.
Definition control.cpp:473
float tdble
Floating point type used in TORCS.
Definition tgf.h:47
int GfuiMenuButtonCreateAction(void *menu, const char *text, const char *tip, const tGfuiAction &onpush)
Add a menu button with a focus tip.
Definition guimenu.cpp:165
int GfuiButtonGetFocused(void)
Get the Id of the button focused in the current screen.
void GfuiKeyEventRegisterCurrent(tfuiKeyCallback onKeyAction)
Set the ordinary-key interceptor on the currently active screen.
Definition gui.cpp:786
void * GfuiScreenCreateExAction(float *bgColor, const tGfuiAction &onActivate, const tGfuiAction &onDeactivate, int mouseAllowed)
Create a screen.
Definition gui.cpp:619
void GfuiMouseHide(void)
Disallow the software mouse cursor on the active screen.
Definition gui.cpp:259
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.
void GfuiHelpScreen(void *prevScreen)
Generate a help screen.
Definition guihelp.cpp:47
void GfuiHookRelease(void *hook)
Release the given hook.
Definition gui.cpp:760
void GfuiMenuDefaultKeysAdd(void *scr)
Add the default menu keyboard callback to a screen.
Definition guimenu.cpp:56
void GfuiLabelSetText(void *scr, int id, const char *text)
Change the text of a label.
Definition guilabel.cpp:193
void * GfuiHookCreate(void *userDataOnActivate, tfuiCallback onActivate)
Create a callback-only screen hook.
Definition gui.cpp:748
int GfuiMenuButtonCreate(void *menu, const char *text, const char *tip, void *userdata, tfuiCallback onpush)
Add a menu button using a callback with caller-supplied data.
Definition guimenu.cpp:171
int GfuiFontHeight(int font)
Get the height of an initialized GUI font.
Definition guiobject.cpp:65
void GfuiScreenRelease(void *screen)
Release the given screen.
Definition gui.cpp:670
int GfuiEditboxGetFocused(void)
Get the Id of the editbox focused in the current screen.
Definition guiedit.cpp:142
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.
int GfuiScrollListCreateAction(void *scr, int font, int x, int y, int align, int width, int height, int scrollbar, const tGfuiAction &onSelect)
Create a new scroll list.
int GfuiTitleCreate(void *scr, const char *text, int maxlen)
Add a Title to the screen.
Definition guilabel.cpp:150
void GfuiStaticImageSet(void *scr, int id, char *name)
Replace an image by another one.
Definition guiimage.cpp:90
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)
Create an image button using callbacks with caller-supplied data.
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 GfuiScreenAddBgImg(void *scr, const char *filename)
Add an image background to a screen.
Definition gui.cpp:1058
int GfuiFontWidth(int font, const char *text)
Measure text using an initialized GUI font.
Definition guiobject.cpp:70
int GfuiEditboxCreateAction(void *scr, const char *text, int font, int x, int y, int width, int maxlen, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost, int margin=10)
Add an edit box to a screen.
Definition guiedit.cpp:53
void GfuiSKeyEventRegisterCurrent(tfuiSKeyCallback onSKeyAction)
Set the special-key interceptor on the currently active screen.
Definition gui.cpp:793
void GfuiIdle(void)
Process held-mouse-button repeat actions on the active screen.
Definition gui.cpp:152
void * GfuiMenuScreenCreate(const char *title)
Create a new menu screen.
Definition guimenu.cpp:77
int GfuiScrollListInsertElement(void *scr, int Id, char *element, int index, void *userData)
Insert an element in a scroll list.
int GfuiScrollListCreate(void *scr, int font, int x, int y, int align, int width, int height, int scrollbar, void *userDataOnSelect, tfuiCallback onSelect)
Create a scrolling list using a callback with caller-supplied data.
int GfuiLeanButtonCreateAction(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)
Create a text button without horizontal margins.
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)
Create an edit box using callbacks with caller-supplied data.
Definition guiedit.cpp:127
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)
Create a text button using callbacks with caller-supplied data.
int GfuiVisibilitySet(void *scr, int id, int visible)
Set/unset the visibility attribute of an object.
void GfuiDisplay(void)
Draw the active GUI screen and swap the GLUT buffers.
Definition gui.cpp:175
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
int GfuiMenuButtonCreateActionWithDisabledTip(void *menu, const char *text, const char *tip, const char *disabledTip, const tGfuiAction &onpush)
Add a button to a menu screen.
Definition guimenu.cpp:124
void * GfuiScreenCreateEx(float *bgColor, void *userDataOnActivate, tfuiCallback onActivate, void *userDataOnDeactivate, tfuiCallback onDeactivate, int mouseAllowed)
Create a screen using callbacks with caller-supplied data.
Definition gui.cpp:652
char * GfuiScrollListExtractElement(void *scr, int Id, int index, void **userData)
Extract the specified element from the scroll list.
void GfuiButtonSetText(void *scr, int id, const char *text)
Change the label of a button.
int GfuiEnable(void *scr, int id, int flag)
Enable / Disable an object.
int GfuiMenuBackQuitButtonCreate(void *menu, const char *text, const char *tip, void *userdata, tfuiCallback onpush)
Add the bottom Back/Quit menu button using a callback with caller-supplied data.
Definition guimenu.cpp:219
void GfuiRegisterKey(unsigned char key, char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
Bind an ordinary key on the currently active screen.
Definition gui.cpp:879
void GfuiUnSelectCurrent(void)
Remove focus from the active screen's current widget.
void * GfuiHookCreateAction(const tGfuiAction &onActivate)
Create a callback hook.
Definition gui.cpp:736
void GfuiEditboxSetString(void *scr, int id, const char *text)
Set a new string.
Definition guiedit.cpp:390
char * GfuiScrollListGetSelectedElement(void *scr, int Id, void **userData)
Get the selected element from the scroll list.
char * GfuiEditboxGetString(void *scr, int id)
Get the current text of an edit box.
Definition guiedit.cpp:364
void GfuiScreenReplace(void *screen)
Activate a screen and make it current plus release the current screen.
Definition gui.cpp:549
char * GfuiScrollListExtractSelectedElement(void *scr, int Id, void **userData)
Extract the selected element from the scroll list (removed).
int GfuiTipCreate(void *scr, const char *text, int maxlen)
Add a Tip (generally associated with a button).
Definition guilabel.cpp:135
char * GfuiScrollListGetElement(void *scr, int Id, int index, void **userData)
Get the specified element from the scroll list.
void GfuiScrollBarPosSet(void *scr, int id, int min, int max, int len, int start)
Set new values for position.
void GfuiPrintString(const char *text, float *fgColor, int font, int x, int y, int align)
Draw text immediately in the current OpenGL context without creating a widget.
Definition guiobject.cpp:43
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
int GfuiLabelCreate(void *scr, const char *text, int font, int x, int y, int align, int maxlen)
Add a label to a screen.
Definition guilabel.cpp:121
void GfuiLabelSetColor(void *scr, int id, float *color)
Change the color of a label.
Definition guilabel.cpp:221
void GfuiKeyEventRegister(void *scr, tfuiKeyCallback onKeyAction)
Set the ordinary-key event interceptor for a screen.
Definition gui.cpp:769
int GfuiButtonStateCreateAction(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)
Create a text button that toggles between pressed and released while focused.
int GfuiGrButtonCreateAction(void *scr, const char *disabled, const char *enabled, const char *focused, const char *pushed, int x, int y, int align, int mouse, const tGfuiAction &onPush, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost)
Add a graphical button to a screen.
Definition guibutton.cpp:58
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.
Definition gui.cpp:859
tMouseInfo * GfuiMouseInfo(void)
Get the GUI's current mouse state.
Definition gui.cpp:419
void GfuiMouseShow(void)
Allow the software mouse cursor on the active screen.
Definition gui.cpp:269
void GfuiRegisterKeyAction(unsigned char key, char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased)
Add a Keyboard callback to the current screen.
Definition gui.cpp:873
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.
Definition gui.cpp:989
void * GfuiScreenCreate(void)
Create a new screen.
Definition gui.cpp:588
int GfuiScreenIsActive(void *screen)
Tell if the screen is active or not.
Definition gui.cpp:495
int GfuiScrollBarPosGet(void *scr, int id)
Get the current position of a scroll bar.
int GfuiMenuBackQuitButtonCreateAction(void *menu, const char *text, const char *tip, const tGfuiAction &onpush)
Add the "Back" or "Quit" button at the bottom of the menu screen.
Definition guimenu.cpp:187
void GfuiScreenActivate(void *screen)
Activate a screen and make it current.
Definition gui.cpp:508
void GfuiSKeyEventRegister(void *scr, tfuiSKeyCallback onSKeyAction)
Set the special-key event interceptor for a screen.
Definition gui.cpp:778
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.
int GfuiStaticImageCreate(void *scr, int x, int y, int w, int h, char *name)
Create a new static image.
Definition guiimage.cpp:48
void GfuiDisplayNothing(void)
GLUT display callback that performs no drawing or buffer swap.
Definition gui.cpp:142
int GfuiScrollListMoveSelectedElement(void *scr, int Id, int delta)
Move the selected element within the scroll list.
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)
Create a marginless text button using callbacks with caller-supplied data.
void GfuiScreenDeactivate(void)
Deactivate the current screen.
Definition gui.cpp:565
void GfuiMouseSetPos(int x, int y)
Set the mouse position.
Definition gui.cpp:430
int GfImgWritePngNoGamma(unsigned char *img, const char *filename, int width, int height)
Write a framebuffer capture to a png image on disk without gamma metadata.
Definition img.cpp:292
unsigned char * GfImgReadPng(const char *filename, int *widthp, int *heightp, float gamma)
Load an image from disk to a buffer in RGBA mode.
Definition img.cpp:53
void GfImgFreeTex(GLuint tex)
Free the texture.
Definition img.cpp:302
GLuint GfImgReadTex(char *filename)
Read a png image into a texture.
Definition img.cpp:315
int GfImgWritePng(unsigned char *img, const char *filename, int width, int height)
Write a buffer to a png image on disk.
Definition img.cpp:277
void GfuiScreenShot(void *notused)
Save a screen shot in png format.
Definition gui.cpp:998
void GfTime2Str(char *result, int resultSize, tdble sec, int sgn)
Convert a time in seconds (float) to an ascii string.
Definition tgf.cpp:192
int GfuiGlutExtensionSupported(const char *str)
Query an OpenGL extension through GLUT for the current rendering context.
Definition screen.cpp:1046
void GfScrShutdown(void)
Shutdown the screen.
Definition screen.cpp:501
void * GfScrMenuInit(void *precMenu)
Create and activate the video options menu screen.
Definition screen.cpp:836
void GfScrGetSize(int *ScrW, int *ScrH, int *ViewW, int *ViewH)
Get the screen and viewport sizes.
Definition screen.cpp:529
static int ScrH
Definition gui.cpp:40
static int ViewW
Definition gui.cpp:40
static int ScrW
Definition gui.cpp:40
static int ViewH
Definition gui.cpp:40
int button[3]
Definition tgfclient.h:228
Scroll bar call-back information.
Definition tgfclient.h:102
void * userData
Associated user data.
Definition tgfclient.h:104
int pos
Current scroll bar position.
Definition tgfclient.h:103
Parameter set handle structure, multiple handles can reference the same parameter set.
Definition params.cpp:125
Joystick Information Structure.
Definition tgfclient.h:486
int edgedn[GFCTRL_JOY_MAXBUTTON *NUM_JOY]
Button transition from up to down.
Definition tgfclient.h:490
int levelup[GFCTRL_JOY_MAXBUTTON *NUM_JOY]
Button state (1 = up)
Definition tgfclient.h:491
int edgeup[GFCTRL_JOY_MAXBUTTON *NUM_JOY]
Button transition from down (pressed) to up.
Definition tgfclient.h:489
int oldb[NUM_JOY]
Definition tgfclient.h:487
float ax[_JS_MAX_AXES *NUM_JOY]
Axis values.
Definition tgfclient.h:488
Mouse information structure.
Definition tgfclient.h:502
float ax[4]
mouse axis position (mouse considered as a joystick)
Definition tgfclient.h:506
int edgeup[3]
Button transition from down (pressed) to up.
Definition tgfclient.h:503
int button[3]
Button state (1 = up)
Definition tgfclient.h:505
int edgedn[3]
Button transition from up to down.
Definition tgfclient.h:504
GfCtrlType type
Definition tgfclient.h:474
int index
Definition tgfclient.h:473
void(* tfuiCallback)(void *)
Definition tgfclient.h:108
struct MouseInfo tMouseInfo
int(* tfuiKeyCallback)(unsigned char key, int modifier, int state)
return 1 to prevent normal key computing
Definition tgfclient.h:110
void GfScrInit(int argc, char *argv[])
Definition screen.cpp:284
struct ScrollBarInfo tScrollBarInfo
Scroll bar call-back information.
GfCtrlType
Definition tgfclient.h:461
@ GFCTRL_TYPE_MOUSE_AXIS
Definition tgfclient.h:467
@ GFCTRL_TYPE_JOY_AXIS
Definition tgfclient.h:463
@ GFCTRL_TYPE_KEYBOARD
Definition tgfclient.h:465
@ GFCTRL_TYPE_MOUSE_BUT
Definition tgfclient.h:466
@ GFCTRL_TYPE_SKEYBOARD
Definition tgfclient.h:468
@ GFCTRL_TYPE_JOY_BUT
Definition tgfclient.h:464
@ GFCTRL_TYPE_NOT_AFFECTED
Definition tgfclient.h:462
int(* tfuiSKeyCallback)(int key, int modifier, int state)
return 1 to prevent normal key computing
Definition tgfclient.h:111
const char * GfctrlGetDefaultSection(GfCtrlType type)
Definition control.cpp:284
std::function< void()> tGfuiAction
Definition tgfclient.h:107
void GfScrReinit(void *)
Definition screen.cpp:571
void(* tfuiSBCallback)(tScrollBarInfo *)
Definition tgfclient.h:109
#define GFCTRL_JOY_MAXBUTTON
Definition tgfclient.h:482
void GfInitClient(void)
Definition tgfclient.cpp:31
#define NUM_JOY
Definition tgfclient.h:36