24#include "tk/toolkit_priv.h"
26#define INPUT_DELAY conf.repeat_delay
27#define INPUT_FREQ conf.repeat_freq
74 SDL_Event *event,
int x,
int y,
int rx,
int ry );
76static int toolkit_textEvent( Window *wdw, SDL_Event* event );
97 for (Window *wdw =
windows; wdw != NULL; wdw = wdw->next)
98 if (!window_isFlag( wdw, WINDOW_KILL | WINDOW_NORENDER ))
123 wgt->x = wdw->w - wgt->w + x;
129 wgt->y = wdw->h - wgt->h + y;
146 window_rmFlag( wdw, WINDOW_CENTERX );
147 window_rmFlag( wdw, WINDOW_CENTERY );
153 window_setFlag( wdw, WINDOW_CENTERX );
164 window_setFlag( wdw, WINDOW_CENTERY );
205 if ((w == -1) && (h == -1)) {
206 window_setFlag( wdw, WINDOW_FULLSCREEN );
209 window_setFlag( wdw, WINDOW_CENTERX );
210 window_setFlag( wdw, WINDOW_CENTERY );
213 window_rmFlag( wdw, WINDOW_FULLSCREEN );
214 if (window_isFlag( wdw, WINDOW_CENTERX ) && window_isFlag( wdw, WINDOW_CENTERY ))
228 Widget *wgt, *wlast, *wtmp;
229 char *saved_name = NULL;
237 for (wgt=w->widgets; wgt!=NULL; wgt=wgt->next) {
240 if (strcmp(name, wgt->name)!=0) {
246 if (!wgt_isFlag( wgt, WGT_FLAG_KILL )) {
247 WARN(_(
"Trying to create widget '%s' over existing one that hasn't been destroyed"),
254 w->widgets = wgt->next;
256 wlast->next = wgt->next;
259 saved_name = wgt->name;
267 wgt = malloc(
sizeof(Widget) );
270 memset( wgt, 0,
sizeof(Widget) );
271 wgt->type = WIDGET_NULL;
272 wgt->status = WIDGET_STATUS_NORMAL;
274 if (saved_name != NULL)
275 wgt->name = saved_name;
277 wgt->name = strdup(name);
278 wgt->id = ++w->idgen;
282 for (wtmp=w->widgets; wtmp!=NULL; wtmp=wtmp->next)
302 WARN(_(
"Window '%u' not found in list!"), wid );
307 WARN(_(
"Window '%u' not found in list!"), wid );
319 for (Window *w =
windows; w != NULL; w = w->next)
333 for (Window *w =
windows; w != NULL; w = w->next)
334 if (strcmp( w->name, name )==0)
351 WARN(_(
"Widget '%s' not found in window '%u'!"), name, wid );
356 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next)
357 if (strcmp(wgt->name, name)==0)
360 WARN(_(
"Widget '%s' not found in window '%u'!"), name, wid );
443 const char* name,
int *x,
int *y )
466 const char* name,
int x,
int y )
494 const char* name,
int w,
int h )
522 const char* name,
int canfocus )
539 wgt_setFlag( wgt, WGT_FLAG_CANFOCUS );
541 wgt_rmFlag( wgt, WGT_FLAG_CANFOCUS );
556 if (!window_isFlag(n,WINDOW_KILL | WINDOW_NORENDER))
578 for (Widget *w=wgt->next; w!=NULL; w=w->next) {
579 if ((wgt->render==NULL) || wgt_isFlag(w, WGT_FLAG_KILL))
584 if (!((rx < 0) || (rx >= w->w) || (ry < 0) || (ry >= w->h)))
600 for (Window *w =
windows; w != NULL; w = w->next)
601 if ((strcmp(w->name,wdwname)==0) && !window_isFlag(w, WINDOW_KILL))
616 for (Window *w =
windows; w != NULL; w = w->next)
617 if ((w->id==wid) && !window_isFlag(w, WINDOW_KILL))
634 free(wdw->displayname);
635 wdw->displayname = NULL;
636 if (displayname != NULL)
637 wdw->displayname = strdup(displayname);
653 wdw->flags |= WINDOW_DYNAMIC;
655 wdw->flags &= ~WINDOW_DYNAMIC;
672 for (Window *w =
windows; w != NULL; w = w->next)
673 if ((strcmp(w->name,wdwname)==0) && !window_isFlag(w, WINDOW_KILL))
692 const int x,
const int y,
const int w,
const int h )
710 const int x,
const int y,
const int w,
const int h,
unsigned int flags )
712 Window *wdw = calloc( 1,
sizeof(Window) );
714 const int wid = (++
genwid);
718 wdw->name = strdup(name);
719 wdw->displayname = strdup(displayname);
727 wdw->exposed = !window_isFlag(wdw, WINDOW_NOFOCUS);
732 if ((w == -1) && (h == -1)) {
733 window_setFlag( wdw, WINDOW_FULLSCREEN );
764 if ((strcmp( wlast->name, name )==0) && !window_isFlag( wlast, WINDOW_KILL )
765 && !window_isFlag( wlast, WINDOW_NOFOCUS ))
766 WARN( _(
"Window with name '%s' already exists!" ), wlast->name );
768 if (wlast->next == NULL)
797 wdw->parent = parent;
834 wdw->close_fptr = fptr;
855 wdw->accept_fptr = accept;
876 wdw->cancel_fptr = cancel;
896 wdw->focus_fptr = focus;
949 window_rmFlag( wdw, WINDOW_NOBORDER );
951 window_setFlag( wdw, WINDOW_NOBORDER );
961 int (*keyhandler)(
unsigned int,SDL_Keycode,SDL_Keymod,
int) )
969 wdw->keyevent = keyhandler;
978 int (*eventhandler)(
unsigned int,SDL_Event*) )
986 wdw->eventevent = eventhandler;
997 if (widget->cleanup != NULL)
998 widget->cleanup(widget);
1004void widget_setStatus( Widget *wgt, WidgetStatus sts )
1006 if (wgt->status != sts)
1016 for (Window *w =
windows; w != NULL; w = w->next)
1042 for (Window *wdw =
windows; wdw != NULL; wdw = wdw->next) {
1050 if (window_isFlag( wdw, WINDOW_KILL ))
1054 for (Window *w =
windows; w != NULL; w = w->next)
1055 if (w->parent == wid)
1060 window_setFlag( wdw, WINDOW_KILL );
1067 if (wactive == NULL)
1075 for (Window *w =
windows; w != NULL; w = w->next) {
1076 if (!window_isFlag(w, WINDOW_KILL) && (w->focus_fptr!=NULL))
1077 w->focus_fptr( w->id );
1088 for (Window *w =
windows; w != NULL; w = w->next)
1089 if (w->parent == wdw->id)
1092 window_setFlag( wdw, WINDOW_KILL );
1105 if (wdw->close_fptr != NULL)
1106 wdw->close_fptr( wdw->id, wdw->name );
1107 wdw->close_fptr = NULL;
1122 free(wdw->displayname);
1124 while (wgt != NULL) {
1125 Widget *wgtkill = wgt;
1126 wgt = wgtkill->next;
1147 WARN(_(
"window '%d' does not exist"), wid);
1152 for (Widget *wgt=w->widgets; wgt!=NULL; wgt=wgt->next)
1153 if (strcmp(wgtname, wgt->name)==0)
1154 return !wgt_isFlag(wgt, WGT_FLAG_KILL);
1176 for (wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next)
1177 if (strcmp(wgt->name, wgtname)==0)
1181 WARN(_(
"Widget '%s' not found in window '%s'"), wgtname, wdw->displayname );
1188 wgt_rmFlag( wgt, WGT_FLAG_FOCUSED );
1189 wgt_setFlag( wgt, WGT_FLAG_KILL );
1217 int thick,
const glColour*
c,
const glColour* lc )
1220 glColour colours[10];
1223 w += 2 * (b - thick);
1225 h += 2 * (b - thick);
1231 tri[0][2] = x-thick;
1232 tri[0][3] = y-thick;
1239 tri[1][2] = x-thick;
1240 tri[1][3] = y + h+thick;
1247 tri[2][2] = x + w+thick;
1248 tri[2][3] = y + h+thick;
1255 tri[3][2] = x + w+thick;
1256 tri[3][3] = y-thick;
1263 tri[4][2] = x-thick;
1264 tri[4][3] = y-thick;
1272 gl_beginSmoothProgram(gl_view_matrix);
1276 glDrawArrays( GL_TRIANGLE_STRIP, 0, 10 );
1277 gl_endSmoothProgram();
1294 const glColour*
c,
const glColour* lc )
1296 GLshort lines[4][2];
1297 glColour colours[4];
1309 lines[1][1] = y + h;
1312 lines[2][0] = x + w;
1313 lines[2][1] = y + h;
1316 lines[3][0] = x + w;
1324 gl_beginSmoothProgram(gl_view_matrix);
1328 glDrawArrays( GL_LINE_LOOP, 0, 4 );
1329 gl_endSmoothProgram();
1344 const glColour*
c,
const glColour* lc )
1346 GLshort vertex[4][2];
1347 glColour colours[4];
1349 lc = lc == NULL ?
c : lc;
1357 vertex[1][1] = y + h;
1360 vertex[2][0] = x + w;
1364 vertex[3][0] = x + w;
1365 vertex[3][1] = y + h;
1372 gl_beginSmoothProgram(gl_view_matrix);
1376 glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 );
1377 gl_endSmoothProgram();
1394 GLshort vertex[3][2];
1395 glColour colours[3];
1414 gl_beginSmoothProgram(gl_view_matrix);
1418 glDrawArrays( GL_TRIANGLE_STRIP, 0, 3 );
1419 gl_endSmoothProgram();
1437 glClear( GL_DEPTH_BUFFER_BIT );
1479 if (window_isFlag( w, WINDOW_FULLSCREEN )) {
1486 &cFontWhite, -1., w->displayname );
1500 &cFontWhite, -1., w->displayname );
1512 glClear( GL_DEPTH_BUFFER_BIT );
1515 if (!window_isFlag( w, WINDOW_NOBORDER ))
1519 for (Widget *wgt=w->widgets; wgt!=NULL; wgt=wgt->next) {
1520 if (wgt->render==NULL)
1522 if (wgt_isFlag(wgt, WGT_FLAG_KILL))
1526 if (!wgt_isFlag(wgt, WGT_FLAG_DYNAMIC) || !top)
1527 wgt->render( wgt, w->x, w->y );
1529 if (wgt->id == w->focus) {
1530 double wx = w->x + wgt->x - 2;
1531 double wy = w->y + wgt->y - 2;
1532 toolkit_drawOutlineThick( wx, wy, wgt->w+4, wgt->h+4, 0, 2, (wgt->type == WIDGET_BUTTON ? &cGrey70 : &cGrey30), NULL );
1543 for (Widget *wgt=w->widgets; wgt!=NULL; wgt=wgt->next) {
1544 if (wgt->render==NULL)
1546 if (wgt_isFlag(wgt, WGT_FLAG_KILL))
1548 if (wgt_isFlag(wgt, WGT_FLAG_DYNAMIC) || window_isFlag(w, WINDOW_DYNAMIC))
1549 wgt->render( wgt, w->x, w->y );
1550 if (wgt->renderDynamic != NULL)
1551 wgt->renderDynamic( wgt, w->x, w->y );
1563 for (Widget *wgt=w->widgets; wgt!=NULL; wgt=wgt->next)
1564 if ((wgt->renderOverlay != NULL) && !wgt_isFlag(wgt, WGT_FLAG_KILL))
1565 wgt->renderOverlay( wgt, w->x, w->y );
1585 sy = y + (h - 30.) * (1.-pos);
1602 glClearColor( 0., 0., 0., 0. );
1603 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1604 glBlendFuncSeparate( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
1607 for (Window *w =
windows; w!=NULL; w = w->next) {
1608 if (window_isFlag(w, WINDOW_NORENDER | WINDOW_KILL))
1610 if ((w==top) && window_isFlag(w,WINDOW_DYNAMIC))
1617 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1619 glClearColor( 0., 0., 0., 1. );
1622 glUseProgram(shaders.texture.program);
1625 glActiveTexture( GL_TEXTURE0 );
1627 glUniform1i(shaders.texture.sampler, 0);
1630 glEnableVertexAttribArray( shaders.texture.vertex );
1632 0, 2, GL_FLOAT, 0 );
1635 gl_uniformColour(shaders.texture.colour, &cWhite);
1638 gl_uniformMat4(shaders.texture.projection, &ortho);
1639 gl_uniformMat4(shaders.texture.tex_mat, &I);
1642 glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 );
1645 glDisableVertexAttribArray( shaders.texture.vertex );
1646 glBindTexture( GL_TEXTURE_2D, 0 );
1652 if ((top != NULL) && !window_isFlag(top, WINDOW_NORENDER | WINDOW_KILL)) {
1691 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next) {
1692 if (!wgt_isFlag( wgt, WGT_FLAG_RAWINPUT ))
1694 if (wgt->rawevent==NULL)
1696 ret = wgt->rawevent( wgt, event );
1704 if (wdw->eventevent != NULL) {
1705 ret = wdw->eventevent( wdw->id, event );
1714 if (!window_isFlag(wdw, WINDOW_KILL)) {
1716 switch (event->type) {
1717 case SDL_MOUSEMOTION:
1718 case SDL_MOUSEBUTTONDOWN:
1719 case SDL_MOUSEBUTTONUP:
1720 case SDL_MOUSEWHEEL:
1730 ret |= toolkit_textEvent(wdw, event);
1732 case SDL_TEXTEDITING:
1762 int *x,
int *y,
int *rx,
int *ry )
1765 if (event->type==SDL_MOUSEMOTION) {
1766 *x =
event->motion.x;
1767 *y =
event->motion.y;
1769 else if ((event->type==SDL_MOUSEBUTTONDOWN) || (event->type==SDL_MOUSEBUTTONUP)) {
1770 *x =
event->button.x;
1771 *y =
event->button.y;
1773 else if (event->type == SDL_MOUSEWHEEL)
1774 SDL_GetMouseState( x, y );
1784 if (event->type==SDL_MOUSEMOTION) {
1796static int toolkit_mouseEventSingle( Window *w, SDL_Event* event,
1797 Widget *wgt,
int x,
int y,
int rx,
int ry )
1801 if (wgt->type==WIDGET_CUST) {
1802 if (wgt->dat.cst.mouse)
1803 ret = wgt->dat.cst.mouse( w->id, event, x-wgt->x, y-wgt->y, wgt->w, wgt->h, rx, ry,
1804 wgt->dat.cst.userdata );
1810static int toolkit_mouseEventReverse( Window *w, SDL_Event* event,
1811 Widget *wgt,
int x,
int y,
int rx,
int ry )
1813 if (wgt->next!=NULL) {
1814 int ret = toolkit_mouseEventReverse( w, event, wgt->next, x, y, rx, ry );
1819 return toolkit_mouseEventSingle( w, event, wgt, x, y, rx, ry );
1835 if (w->widgets != NULL)
1836 return toolkit_mouseEventReverse( w, event, w->widgets, x, y, rx, ry );
1852 SDL_Event *event,
int x,
int y,
int rx,
int ry )
1862 if (event->type == SDL_MOUSEMOTION)
1863 button =
event->motion.state;
1865 button =
event->button.button;
1868 inbounds = !((x < 0) || (x >= wgt->w) || (y < 0) || (y >= wgt->h));
1872 switch (event->type) {
1873 case SDL_MOUSEMOTION:
1877 if (wgt->status != WIDGET_STATUS_SCROLLING) {
1879 if (wgt->status != WIDGET_STATUS_MOUSEDOWN)
1880 widget_setStatus( wgt, WIDGET_STATUS_MOUSEOVER );
1883 widget_setStatus( wgt, WIDGET_STATUS_NORMAL );
1889 if (wgt_isFlag( wgt, WGT_FLAG_ALWAYSMMOVE ))
1893 if (inbounds && (wgt->mmoveevent != NULL))
1894 ret |= (*wgt->mmoveevent)( wgt, x, y, rx, ry );
1898 case SDL_MOUSEWHEEL:
1903 if (wgt->mwheelevent != NULL)
1904 ret |= (*wgt->mwheelevent)( wgt, event->wheel );
1910 case SDL_MOUSEBUTTONDOWN:
1915 if (button == SDL_BUTTON_LEFT)
1916 widget_setStatus( wgt, WIDGET_STATUS_MOUSEDOWN );
1925 ret |= (*wgt->mdoubleclickevent)( wgt, button, x, y );
1926 else if (wgt->mclickevent != NULL)
1927 ret |= (*wgt->mclickevent)( wgt, button, x, y );
1934 case SDL_MOUSEBUTTONUP:
1937 if (button != SDL_BUTTON_LEFT)
1940 if (wgt->status==WIDGET_STATUS_MOUSEDOWN) {
1942 if ((wgt->type==WIDGET_BUTTON) && ((wgt->dat.btn.disabled==0) ||
1943 (wgt->dat.btn.softdisable))) {
1944 if (wgt->dat.btn.fptr==NULL)
1945 DEBUG(_(
"Toolkit: Button '%s' of Window '%s' "
1946 "doesn't have a function trigger"),
1947 wgt->name, w->displayname );
1949 (*wgt->dat.btn.fptr)(w->id, wgt->name);
1957 if ((wgt->status == WIDGET_STATUS_SCROLLING) && (wgt->scrolldone != NULL))
1958 wgt->scrolldone( wgt );
1962 widget_setStatus( wgt, WIDGET_STATUS_MOUSEOVER );
1964 widget_setStatus( wgt, WIDGET_STATUS_NORMAL );
2055 key =
event->key.keysym.sym;
2056 mod =
event->key.keysym.mod;
2057 rep =
event->key.repeat;
2060 if (event->type == SDL_KEYDOWN)
2062 else if (event->type == SDL_KEYUP)
2073 if (event->type != SDL_KEYDOWN)
2078 if (wgt->keyevent != NULL) {
2087 for ( wgt = wdw->widgets; wgt != NULL; wgt = wgt->next ) {
2088 if ( ( wgt->type == WIDGET_BUTTON ) && ( wgt->dat.btn.key ==
input_key )
2089 && wgt->keyevent != NULL ) {
2090 ret = wgt->keyevent( wgt, SDLK_RETURN,
input_mod, rep );
2100 if (wdw->accept_fptr != NULL) {
2101 wdw->accept_fptr( wdw->id, wdw->name );
2107 if (wdw->cancel_fptr != NULL) {
2108 wdw->cancel_fptr( wdw->id, wdw->name );
2119 if (wdw->keyevent != NULL) {
2126 if (key == SDLK_TAB) {
2127 if (mod & (KMOD_LSHIFT | KMOD_RSHIFT))
2136static int toolkit_textEvent( Window *wdw, SDL_Event* event )
2148 if ((wgt != NULL) && (wgt->textevent != NULL)) {
2149 int ret = (*wgt->textevent)( wgt, event->text.text );
2162 Window *wdw, *wlast;
2171 while (wdw != NULL) {
2172 if (window_isFlag( wdw, WINDOW_KILL )) {
2174 Window *wkill = wdw;
2181 wlast->next = wdw->next;
2188 Widget *wgtlast = NULL;
2189 Widget *wgt = wdw->widgets;
2190 while (wgt != NULL) {
2191 if (wgt_isFlag( wgt, WGT_FLAG_KILL )) {
2193 Widget *wgtkill = wgt;
2195 if (wgtlast == NULL)
2196 wdw->widgets = wgt->next;
2198 wgtlast->next = wgt->next;
2201 wgtkill->next = NULL;
2251 if (expose == wdw->exposed)
2254 wdw->exposed = expose;
2261 if (wdw->focus != -1)
2265 for (Widget *wgt = wdw->widgets; wgt != NULL; wgt = wgt->next)
2266 if (wgt->exposeevent != NULL)
2267 wgt->exposeevent( wgt, expose );
2275 if (wdw->focus == -1)
2278 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next)
2289 int focus = wdw->focus;
2299 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next) {
2300 if (focus == wgt->id) {
2323 next = (wdw->focus == -1);
2324 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next) {
2332 else if (wdw->focus == wgt->id) {
2349 int focus = wdw->focus;
2356 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next) {
2361 if (focus == wgt->id) {
2386 wdw->focus = wgt->id;
2387 wgt_setFlag( wgt, WGT_FLAG_FOCUSED );
2388 if (wgt->focusGain != NULL)
2389 wgt->focusGain( wgt );
2400 if (wdw->focus != wgt->id || !wgt_isFlag( wgt, WGT_FLAG_FOCUSED ))
2404 wgt_rmFlag( wgt, WGT_FLAG_FOCUSED );
2405 if (wgt->focusLose != NULL)
2406 wgt->focusLose( wgt );
2422 return wgt_isFlag(wgt, WGT_FLAG_CANFOCUS);
2433 Window *wlast = NULL;
2434 for (Window *wdw =
windows; wdw!=NULL; wdw = wdw->next)
2435 if (!window_isFlag(wdw, WINDOW_NOFOCUS) &&
2436 !window_isFlag(wdw, WINDOW_KILL))
2450 if (wdw->focus == -1)
2454 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next)
2455 if (wdw->focus == wgt->id)
2505 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next)
2506 if (wgt->id == wdw->focus)
2507 return strdup( wgt->name );
2519 Window *wdw, *wtmp, *wprev, *wlast;
2524 if (wdw == NULL || wdw->next == NULL)
2530 for (wtmp =
windows; wtmp != NULL; wtmp = wtmp->next)
2531 if (wtmp->next == wdw)
2533 else if (wtmp->next == NULL)
2537 wprev->next = wdw->next;
2547 if (wtmp == NULL || wtmp == wdw)
2562 Window *wdw, *wtmp, *wprev;
2567 if (wdw == NULL || wdw ==
windows)
2571 for (wtmp =
windows; wtmp != NULL; wtmp = wtmp->next)
2572 if (wtmp->next == wdw)
2576 wprev->next = wdw->next;
2584 if (wtmp == NULL || wtmp == wdw)
2597 for (Window *w =
windows; w != NULL; w = w->next) {
2602 if (window_isFlag( w, WINDOW_FULLSCREEN )) {
2609 if (w->xrel == -1. && w->yrel == -1.)
2615 if (w->xrel != -1.) {
2618 xdiff = w->x - xorig;
2621 if (w->yrel != -1.) {
2624 ydiff = w->y - yorig;
2628 for (Widget *wgt=w->widgets; wgt!=NULL; wgt=wgt->next) {
2629 if (wgt->type != WIDGET_TABBEDWINDOW)
2632 for (
int i=0; i<wgt->dat.tab.ntabs; i++) {
2633 Window *wtmp =
window_wget( wgt->dat.tab.windows[i] );
2653 size = (
sizeof(GLshort)*2 +
sizeof(GLfloat)*4) * 31;
int dialogue_isOpen(void)
Checks to see if a dialogue is open.
int gl_printHeightRaw(const glFont *ft_font, const int width, const char *text)
Gets the height of a non-formatted string.
int gl_printWidthRaw(const glFont *ft_font, const char *text)
Gets the width that it would take to print some text.
int gl_printMidRaw(const glFont *ft_font, int width, double x, double y, const glColour *c, double outlineR, const char *text)
Displays text centered in position and width.
int gl_printTextRaw(const glFont *ft_font, const int width, const int height, double bx, double by, int line_height, const glColour *c, double outlineR, const char *text)
Prints a block of text that fits in the dimensions given.
mat4 mat4_identity(void)
Creates an identity matrix.
mat4 mat4_ortho(double left, double right, double bottom, double top, double nearVal, double farVal)
Creates an orthographic projection matrix.
Header file with generic functions and naev-specifics.
void gl_defViewport(void)
Resets viewport to default.
void gl_windowToScreenPos(int *sx, int *sy, int wx, int wy)
Translates the window position to screen position.
void gl_vboDestroy(gl_vbo *vbo)
Destroys a VBO.
gl_vbo * gl_vboCreateStream(GLsizei size, const void *data)
Creates a stream vbo.
void gl_vboActivateAttribOffset(gl_vbo *vbo, GLuint index, GLuint offset, GLint size, GLenum type, GLsizei stride)
Activates a VBO's offset.
void gl_vboSubData(gl_vbo *vbo, GLint offset, GLsizei size, const void *data)
Loads some data into the VBO.
void pause_game(void)
Pauses the game.
void unpause_game(void)
Unpauses the game.
GLuint fbo_tex[OPENGL_NUM_FBOS]
GLuint fbo[OPENGL_NUM_FBOS]