24#include "tk/toolkit_priv.h"
26#define INPUT_DELAY conf.repeat_delay
27#define INPUT_FREQ conf.repeat_freq
76 SDL_Event *event,
int x,
int y,
int rx,
int ry );
78static int toolkit_textEvent( Window *wdw, SDL_Event* event );
98 for (Window *wdw =
windows; wdw != NULL; wdw = wdw->next)
99 if (!window_isFlag( wdw, WINDOW_FADEOUT | WINDOW_KILL | WINDOW_NORENDER ))
124 wgt->x = wdw->w - wgt->w + x;
130 wgt->y = wdw->h - wgt->h + y;
147 window_rmFlag( wdw, WINDOW_CENTERX );
148 window_rmFlag( wdw, WINDOW_CENTERY );
154 window_setFlag( wdw, WINDOW_CENTERX );
165 window_setFlag( wdw, WINDOW_CENTERY );
206 if ((w == -1) && (h == -1)) {
207 window_setFlag( wdw, WINDOW_FULLSCREEN );
210 window_setFlag( wdw, WINDOW_CENTERX );
211 window_setFlag( wdw, WINDOW_CENTERY );
214 window_rmFlag( wdw, WINDOW_FULLSCREEN );
215 if (window_isFlag( wdw, WINDOW_CENTERX ) && window_isFlag( wdw, WINDOW_CENTERY ))
229 Widget *wgt, *wlast, *wtmp;
230 char *saved_name = NULL;
238 for (wgt=w->widgets; wgt!=NULL; wgt=wgt->next) {
241 if (strcmp(name, wgt->name)!=0) {
247 if (!wgt_isFlag( wgt, WGT_FLAG_KILL )) {
248 WARN(_(
"Trying to create widget '%s' over existing one that hasn't been destroyed"),
255 w->widgets = wgt->next;
257 wlast->next = wgt->next;
260 saved_name = wgt->name;
268 wgt = malloc(
sizeof(Widget) );
271 memset( wgt, 0,
sizeof(Widget) );
272 wgt->type = WIDGET_NULL;
273 wgt->status = WIDGET_STATUS_NORMAL;
275 if (saved_name != NULL)
276 wgt->name = saved_name;
278 wgt->name = strdup(name);
279 wgt->id = ++w->idgen;
283 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 )
468 const char* name,
int x,
int y )
496 const char* name,
int w,
int h )
524 const char* name,
int canfocus )
541 wgt_setFlag( wgt, WGT_FLAG_CANFOCUS );
543 wgt_rmFlag( wgt, WGT_FLAG_CANFOCUS );
558 if (!window_isFlag(n,WINDOW_KILL | WINDOW_FADEOUT | WINDOW_NORENDER))
580 for (Widget *w=wgt->next; w!=NULL; w=w->next) {
581 if ((wgt->render==NULL) || wgt_isFlag(w, WGT_FLAG_KILL))
586 if (!((rx < 0) || (rx >= w->w) || (ry < 0) || (ry >= w->h)))
602 for (Window *w =
windows; w != NULL; w = w->next)
603 if ((strcmp(w->name,wdwname)==0) && !window_isFlag(w, WINDOW_KILL | WINDOW_FADEOUT))
618 for (Window *w =
windows; w != NULL; w = w->next)
619 if ((w->id==wid) && !window_isFlag(w, WINDOW_KILL | WINDOW_FADEOUT))
636 free(wdw->displayname);
637 wdw->displayname = NULL;
638 if (displayname != NULL)
639 wdw->displayname = strdup(displayname);
654 wdw->timer_max = wdw->timer = length;
656 if (wdw->timer <= 0.) {
657 if (window_isFlag(wdw, WINDOW_FADEOUT))
659 window_rmFlag(wdw, WINDOW_FADEIN | WINDOW_FADEOUT);
677 for (Window *w =
windows; w != NULL; w = w->next)
678 if ((strcmp(w->name,wdwname)==0) && !window_isFlag(w, WINDOW_KILL | WINDOW_FADEOUT))
697 const int x,
const int y,
const int w,
const int h )
715 const int x,
const int y,
const int w,
const int h,
unsigned int flags )
718 Window *wdw = calloc( 1,
sizeof(Window) );
720 const int wid = (++
genwid);
724 wdw->name = strdup(name);
725 wdw->displayname = strdup(displayname);
732 wdw->flags = flags | WINDOW_FADEIN | WINDOW_FADEDELAY;
733 wdw->exposed = !window_isFlag(wdw, WINDOW_NOFOCUS);
738 if ((old != NULL) && window_isFlag( old, WINDOW_KILL | WINDOW_FADEOUT )) {
740 window_rmFlag( wdw, WINDOW_FADEIN | WINDOW_FADEDELAY );
747 if ((w == -1) && (h == -1)) {
748 window_setFlag( wdw, WINDOW_FULLSCREEN );
779 if ((strcmp( wlast->name, name )==0) && !window_isFlag( wlast, WINDOW_KILL | WINDOW_FADEOUT )
780 && !window_isFlag( wlast, WINDOW_NOFOCUS ))
781 WARN( _(
"Window with name '%s' already exists!" ), wlast->name );
783 if (wlast->next == NULL)
811 wdw->parent = parent;
848 wdw->close_fptr = fptr;
866 wdw->cleanup_fptr = fptr;
887 wdw->accept_fptr = accept;
908 wdw->cancel_fptr = cancel;
961 window_rmFlag( wdw, WINDOW_NOBORDER );
963 window_setFlag( wdw, WINDOW_NOBORDER );
973 int (*keyhandler)(
unsigned int,SDL_Keycode,SDL_Keymod) )
981 wdw->keyevent = keyhandler;
990 int (*eventhandler)(
unsigned int,SDL_Event*) )
998 wdw->eventevent = eventhandler;
1009 if (widget->cleanup != NULL)
1010 widget->cleanup(widget);
1021 for (Window *w =
windows; w != NULL; w = w->next)
1047 for (Window *wdw =
windows; wdw != NULL; wdw = wdw->next) {
1055 if (window_isFlag( wdw, WINDOW_KILL | WINDOW_FADEOUT ))
1059 for (Window *w =
windows; w != NULL; w = w->next)
1060 if (w->parent == wid)
1064 window_rmFlag( wdw, WINDOW_FADEIN );
1065 window_setFlag( wdw, WINDOW_FADEOUT | WINDOW_FADEDELAY );
1069 if (wdw->close_fptr != NULL)
1070 wdw->close_fptr( wdw->id, wdw->name );
1071 wdw->close_fptr = NULL;
1077 if (wactive == NULL)
1092 for (Window *w =
windows; w != NULL; w = w->next)
1093 if (w->parent == wdw->id)
1095 window_setFlag( wdw, WINDOW_KILL );
1108 if (wdw->close_fptr != NULL)
1109 wdw->close_fptr( wdw->id, wdw->name );
1110 wdw->close_fptr = NULL;
1113 if (wdw->cleanup_fptr != NULL)
1114 wdw->cleanup_fptr( wdw->id, wdw->name );
1115 wdw->cleanup_fptr = NULL;
1119 free(wdw->displayname);
1121 while (wgt != NULL) {
1122 Widget *wgtkill = wgt;
1123 wgt = wgtkill->next;
1144 WARN(_(
"window '%d' does not exist"), wid);
1149 for (Widget *wgt=w->widgets; wgt!=NULL; wgt=wgt->next)
1150 if (strcmp(wgtname, wgt->name)==0)
1151 return !wgt_isFlag(wgt, WGT_FLAG_KILL);
1173 for (wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next)
1174 if (strcmp(wgt->name, wgtname)==0)
1178 WARN(_(
"Widget '%s' not found in window '%s'"), wgtname, wdw->displayname );
1185 wgt_rmFlag( wgt, WGT_FLAG_FOCUSED );
1186 wgt_setFlag( wgt, WGT_FLAG_KILL );
1214 int thick,
const glColour*
c,
const glColour* lc )
1217 glColour colours[10];
1220 w += 2 * (b - thick);
1222 h += 2 * (b - thick);
1228 tri[0][2] = x-thick;
1229 tri[0][3] = y-thick;
1236 tri[1][2] = x-thick;
1237 tri[1][3] = y + h+thick;
1244 tri[2][2] = x + w+thick;
1245 tri[2][3] = y + h+thick;
1252 tri[3][2] = x + w+thick;
1253 tri[3][3] = y-thick;
1260 tri[4][2] = x-thick;
1261 tri[4][3] = y-thick;
1269 gl_beginSmoothProgram(gl_view_matrix);
1273 glDrawArrays( GL_TRIANGLE_STRIP, 0, 10 );
1274 gl_endSmoothProgram();
1291 const glColour*
c,
const glColour* lc )
1293 GLshort lines[4][2];
1294 glColour colours[4];
1306 lines[1][1] = y + h;
1309 lines[2][0] = x + w;
1310 lines[2][1] = y + h;
1313 lines[3][0] = x + w;
1321 gl_beginSmoothProgram(gl_view_matrix);
1325 glDrawArrays( GL_LINE_LOOP, 0, 4 );
1326 gl_endSmoothProgram();
1341 const glColour*
c,
const glColour* lc )
1343 GLshort vertex[4][2];
1344 glColour colours[4];
1346 lc = lc == NULL ?
c : lc;
1354 vertex[1][1] = y + h;
1357 vertex[2][0] = x + w;
1361 vertex[3][0] = x + w;
1362 vertex[3][1] = y + h;
1369 gl_beginSmoothProgram(gl_view_matrix);
1373 glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 );
1374 gl_endSmoothProgram();
1391 GLshort vertex[3][2];
1392 glColour colours[3];
1411 gl_beginSmoothProgram(gl_view_matrix);
1415 glDrawArrays( GL_TRIANGLE_STRIP, 0, 3 );
1416 gl_endSmoothProgram();
1434 glClear( GL_DEPTH_BUFFER_BIT );
1476 if (window_isFlag( w, WINDOW_FULLSCREEN )) {
1483 &cFontWhite, -1., w->displayname );
1497 &cFontWhite, -1., w->displayname );
1510 if (window_isFlag( w, WINDOW_KILL ))
1518 glClear( GL_DEPTH_BUFFER_BIT );
1521 if (!window_isFlag( w, WINDOW_NOBORDER ))
1527 for (Widget *wgt=w->widgets; wgt!=NULL; wgt=wgt->next) {
1528 if ((wgt->render != NULL) && !wgt_isFlag(wgt, WGT_FLAG_KILL)) {
1529 wgt->render( wgt, x, y );
1531 if (wgt->id == w->focus) {
1532 double wx = x + wgt->x - 2;
1533 double wy = y + wgt->y - 2;
1534 toolkit_drawOutlineThick( wx, wy, wgt->w+4, wgt->h+4, 0, 2, (wgt->type == WIDGET_BUTTON ? &cGrey70 : &cGrey30), NULL );
1550 if (window_isFlag( w, WINDOW_KILL ))
1560 for (Widget *wgt=w->widgets; wgt!=NULL; wgt=wgt->next)
1561 if ((wgt->renderOverlay != NULL) && !wgt_isFlag(wgt, WGT_FLAG_KILL))
1562 wgt->renderOverlay( wgt, x, y );
1582 sy = y + (h - 30.) * (1.-pos);
1593 for (Window *w =
windows; w!=NULL; w = w->next) {
1594 if (window_isFlag(w, WINDOW_NORENDER | WINDOW_KILL))
1599 if (window_isFlag(w, WINDOW_FADEIN | WINDOW_FADEOUT)) {
1600 if (!window_isFlag(w, WINDOW_FADEDELAY) || (dt <
fps_min))
1602 window_rmFlag( w, WINDOW_FADEDELAY );
1603 if (w->timer > 0.) {
1605 if (window_isFlag(w, WINDOW_FADEIN))
1611 glClearColor( 0., 0., 0., 0. );
1612 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1616 if (window_isFlag(w, WINDOW_FADEOUT)) {
1621 window_rmFlag(w, WINDOW_FADEIN | WINDOW_FADEOUT);
1634 glColour col = { 1., 1., 1., alpha };
1637 glClearColor( 0., 0., 0., 1. );
1639 glUseProgram(shaders.texture.program);
1642 glActiveTexture( GL_TEXTURE0 );
1644 glUniform1i(shaders.texture.sampler, 0);
1647 glEnableVertexAttribArray( shaders.texture.vertex );
1649 0, 2, GL_FLOAT, 0 );
1652 gl_uniformColor(shaders.texture.color, &col);
1655 gl_uniformMat4(shaders.texture.projection, &ortho);
1656 gl_uniformMat4(shaders.texture.tex_mat, &I);
1659 glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 );
1662 glDisableVertexAttribArray( shaders.texture.vertex );
1693 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next) {
1694 if (wgt_isFlag( wgt, WGT_FLAG_RAWINPUT )) {
1695 if (wgt->rawevent != NULL) {
1696 ret = wgt->rawevent( wgt, event );
1704 if (wdw->eventevent != NULL) {
1705 ret = wdw->eventevent( wdw->id, event );
1712 if (!window_isFlag(wdw, WINDOW_KILL | WINDOW_FADEOUT)) {
1714 switch (event->type) {
1715 case SDL_MOUSEMOTION:
1716 case SDL_MOUSEBUTTONDOWN:
1717 case SDL_MOUSEBUTTONUP:
1718 case SDL_MOUSEWHEEL:
1728 ret |= toolkit_textEvent(wdw, event);
1730 case SDL_TEXTEDITING:
1758 int *x,
int *y,
int *rx,
int *ry )
1761 if (event->type==SDL_MOUSEMOTION) {
1762 *x =
event->motion.x;
1763 *y =
event->motion.y;
1765 else if ((event->type==SDL_MOUSEBUTTONDOWN) || (event->type==SDL_MOUSEBUTTONUP)) {
1766 *x =
event->button.x;
1767 *y =
event->button.y;
1769 else if (event->type == SDL_MOUSEWHEEL)
1770 SDL_GetMouseState( x, y );
1780 if (event->type==SDL_MOUSEMOTION) {
1792static int toolkit_mouseEventSingle( Window *w, SDL_Event* event,
1793 Widget *wgt,
int x,
int y,
int rx,
int ry )
1797 if (wgt->type==WIDGET_CUST) {
1798 if (wgt->dat.cst.mouse)
1799 ret = wgt->dat.cst.mouse( w->id, event, x-wgt->x, y-wgt->y, wgt->w, wgt->h, rx, ry,
1800 wgt->dat.cst.userdata );
1806static int toolkit_mouseEventReverse( Window *w, SDL_Event* event,
1807 Widget *wgt,
int x,
int y,
int rx,
int ry )
1809 if (wgt->next!=NULL) {
1810 int ret = toolkit_mouseEventReverse( w, event, wgt->next, x, y, rx, ry );
1815 return toolkit_mouseEventSingle( w, event, wgt, x, y, rx, ry );
1831 if (w->widgets != NULL)
1832 return toolkit_mouseEventReverse( w, event, w->widgets, x, y, rx, ry );
1848 SDL_Event *event,
int x,
int y,
int rx,
int ry )
1858 if (event->type == SDL_MOUSEMOTION)
1859 button =
event->motion.state;
1861 button =
event->button.button;
1864 inbounds = !((x < 0) || (x >= wgt->w) || (y < 0) || (y >= wgt->h));
1868 switch (event->type) {
1869 case SDL_MOUSEMOTION:
1873 if (wgt->status != WIDGET_STATUS_SCROLLING) {
1875 if (wgt->status != WIDGET_STATUS_MOUSEDOWN)
1876 wgt->status = WIDGET_STATUS_MOUSEOVER;
1879 wgt->status = WIDGET_STATUS_NORMAL;
1885 if (wgt_isFlag( wgt, WGT_FLAG_ALWAYSMMOVE ))
1889 if (inbounds && (wgt->mmoveevent != NULL))
1890 ret |= (*wgt->mmoveevent)( wgt, x, y, rx, ry );
1894 case SDL_MOUSEWHEEL:
1899 if (wgt->mwheelevent != NULL)
1900 ret |= (*wgt->mwheelevent)( wgt, event->wheel );
1904 case SDL_MOUSEBUTTONDOWN:
1909 if (button == SDL_BUTTON_LEFT)
1910 wgt->status = WIDGET_STATUS_MOUSEDOWN;
1919 ret |= (*wgt->mdoubleclickevent)( wgt, button, x, y );
1920 else if (wgt->mclickevent != NULL)
1921 ret |= (*wgt->mclickevent)( wgt, button, x, y );
1926 case SDL_MOUSEBUTTONUP:
1929 if (button != SDL_BUTTON_LEFT)
1932 if (wgt->status==WIDGET_STATUS_MOUSEDOWN) {
1934 if ((wgt->type==WIDGET_BUTTON) && ((wgt->dat.btn.disabled==0) ||
1935 (wgt->dat.btn.softdisable))) {
1936 if (wgt->dat.btn.fptr==NULL)
1937 DEBUG(_(
"Toolkit: Button '%s' of Window '%s' "
1938 "doesn't have a function trigger"),
1939 wgt->name, w->displayname );
1941 (*wgt->dat.btn.fptr)(w->id, wgt->name);
1948 if ((wgt->status == WIDGET_STATUS_SCROLLING) && (wgt->scrolldone != NULL))
1949 wgt->scrolldone( wgt );
1953 wgt->status = WIDGET_STATUS_MOUSEOVER;
1955 wgt->status = WIDGET_STATUS_NORMAL;
2051 key =
event->key.keysym.sym;
2052 mod =
event->key.keysym.mod;
2055 if (event->type == SDL_KEYDOWN)
2057 else if (event->type == SDL_KEYUP)
2068 if (event->type != SDL_KEYDOWN)
2073 if (wgt->keyevent != NULL) {
2080 if (
input_key != 0 && !event->key.repeat) {
2082 for ( wgt = wdw->widgets; wgt != NULL; wgt = wgt->next ) {
2083 if ( ( wgt->type == WIDGET_BUTTON ) && ( wgt->dat.btn.key ==
input_key )
2084 && wgt->keyevent != NULL ) {
2085 ret = wgt->keyevent( wgt, SDLK_RETURN,
input_mod );
2095 if (wdw->accept_fptr != NULL) {
2096 wdw->accept_fptr( wdw->id, wdw->name );
2102 if (wdw->cancel_fptr != NULL) {
2103 wdw->cancel_fptr( wdw->id, wdw->name );
2114 if (wdw->keyevent != NULL) {
2121 if (key == SDLK_TAB) {
2122 if (mod & (KMOD_LSHIFT | KMOD_RSHIFT))
2131static int toolkit_textEvent( Window *wdw, SDL_Event* event )
2144 if ((wgt != NULL) && (wgt->textevent != NULL)) {
2145 ret = (*wgt->textevent)( wgt, event->text.text );
2158 Window *wdw, *wlast;
2167 while (wdw != NULL) {
2168 if (window_isFlag( wdw, WINDOW_KILL )) {
2170 Window *wkill = wdw;
2175 wlast->next = wdw->next;
2182 Widget *wgtlast = NULL;
2183 Widget *wgt = wdw->widgets;
2184 while (wgt != NULL) {
2185 if (wgt_isFlag( wgt, WGT_FLAG_KILL )) {
2187 Widget *wgtkill = wgt;
2189 if (wgtlast == NULL)
2190 wdw->widgets = wgt->next;
2192 wgtlast->next = wgt->next;
2195 wgtkill->next = NULL;
2245 if (expose == wdw->exposed)
2248 wdw->exposed = expose;
2255 if (wdw->focus != -1)
2259 for (Widget *wgt = wdw->widgets; wgt != NULL; wgt = wgt->next)
2260 if (wgt->exposeevent != NULL)
2261 wgt->exposeevent( wgt, expose );
2269 if (wdw->focus == -1)
2272 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next)
2283 int focus = wdw->focus;
2293 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next) {
2294 if (focus == wgt->id) {
2317 next = (wdw->focus == -1);
2318 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next) {
2326 else if (wdw->focus == wgt->id) {
2342 int focus = wdw->focus;
2349 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next) {
2354 if (focus == wgt->id) {
2379 wdw->focus = wgt->id;
2380 wgt_setFlag( wgt, WGT_FLAG_FOCUSED );
2381 if (wgt->focusGain != NULL)
2382 wgt->focusGain( wgt );
2391 if (wdw->focus != wgt->id || !wgt_isFlag( wgt, WGT_FLAG_FOCUSED ))
2395 wgt_rmFlag( wgt, WGT_FLAG_FOCUSED );
2396 if (wgt->focusLose != NULL)
2397 wgt->focusLose( wgt );
2411 return wgt_isFlag(wgt, WGT_FLAG_CANFOCUS);
2422 Window *wlast = NULL;
2423 for (Window *wdw =
windows; wdw!=NULL; wdw = wdw->next)
2424 if (!window_isFlag(wdw, WINDOW_NOFOCUS) &&
2425 !window_isFlag(wdw, WINDOW_KILL | WINDOW_FADEOUT))
2439 if (wdw->focus == -1)
2443 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next)
2444 if (wdw->focus == wgt->id)
2494 for (Widget *wgt=wdw->widgets; wgt!=NULL; wgt=wgt->next)
2495 if (wgt->id == wdw->focus)
2496 return strdup( wgt->name );
2508 Window *wdw, *wtmp, *wprev, *wlast;
2513 if (wdw == NULL || wdw->next == NULL)
2519 for (wtmp =
windows; wtmp != NULL; wtmp = wtmp->next)
2520 if (wtmp->next == wdw)
2522 else if (wtmp->next == NULL)
2526 wprev->next = wdw->next;
2536 if (wtmp == NULL || wtmp == wdw)
2550 Window *wdw, *wtmp, *wprev;
2555 if (wdw == NULL || wdw ==
windows)
2559 for (wtmp =
windows; wtmp != NULL; wtmp = wtmp->next)
2560 if (wtmp->next == wdw)
2564 wprev->next = wdw->next;
2572 if (wtmp == NULL || wtmp == wdw)
2584 for (Window *w =
windows; w != NULL; w = w->next) {
2585 int xorig, yorig, xdiff, ydiff;
2589 if (window_isFlag( w, WINDOW_FULLSCREEN )) {
2596 if (w->xrel == -1. && w->yrel == -1.)
2602 if (w->xrel != -1.) {
2605 xdiff = w->x - xorig;
2608 if (w->yrel != -1.) {
2611 ydiff = w->y - yorig;
2615 for (Widget *wgt=w->widgets; wgt!=NULL; wgt=wgt->next) {
2616 if (wgt->type != WIDGET_TABBEDWINDOW)
2619 for (
int i=0; i<wgt->dat.tab.ntabs; i++) {
2620 Window *wtmp =
window_wget( wgt->dat.tab.windows[i] );
2639 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.
double ease_QuadraticInOut(double x)
Simple symmetric quadratic easing.
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]