diff options
Diffstat (limited to 'src/gui/base.cpp')
| -rw-r--r-- | src/gui/base.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/gui/base.cpp b/src/gui/base.cpp index 1e8a493..79299de 100644 --- a/src/gui/base.cpp +++ b/src/gui/base.cpp @@ -37,8 +37,8 @@ void gui_end() { } void gui_draw( GAME_DATA* game ) { - _gui.gl2d = game->shaders.gl2d; - _gui.gl2d_font = game->shaders.gl2d; + _gui.batch = game->render.batch_2d; + gl_batch_empty( _gui.batch ); _gui.windows.each( fn( GUI_WINDOW** w ) { GUI_WINDOW* wnd = *w; @@ -46,6 +46,8 @@ void gui_draw( GAME_DATA* game ) { wnd->draw_fn( wnd ); } ); + + gl_batch_draw( _gui.batch ); } void gui_input( GAME_DATA* game ) { @@ -59,10 +61,10 @@ void gui_input( GAME_DATA* game ) { } void gui_onframe( GAME_DATA* game ) { _profiled - gui_run_callbacks(); - gui_input( game ); gui_draw( game ); + + gui_run_callbacks(); } void gui_free( GUI_BASE* node ) { @@ -254,15 +256,15 @@ void gui_base_input_fn( void* ptr ) { } void gui_draw_frect( I32 x, I32 y, I32 w, I32 h, CLR col ) { - gl_2d_frect( _gui.gl2d, { (F32)x, (F32)y }, { (F32)w, (F32)h }, col ); + gl_2d_frect( _gui.batch, { (F32)x, (F32)y }, { (F32)w, (F32)h }, col ); } void gui_draw_rect( I32 x, I32 y, I32 w, I32 h, CLR col ) { - gl_2d_rect( _gui.gl2d, { (F32)x, (F32)y }, { (F32)w, (F32)h }, col ); + gl_2d_rect( _gui.batch, { (F32)x, (F32)y }, { (F32)w, (F32)h }, col ); } void gui_draw_line( I32 x0, I32 y0, I32 x1, I32 y1, CLR col ) { - gl_2d_line( _gui.gl2d, { (F32)x0, (F32)y0 }, { (F32)x1, (F32)y1 }, col ); + gl_2d_line( _gui.batch, { (F32)x0, (F32)y0 }, { (F32)x1, (F32)y1 }, col ); } GL_FONT* gui_font_from_idx( U32 fnt ) { @@ -292,7 +294,7 @@ void gui_draw_str_internal( I32 x, I32 y, U8 align, U32 fnt, CLR col, const char case ALIGN_C: x -= (I32)( w * 0.5f ); break; } - gl_font_draw( pfnt, _gui.gl2d_font, { (F32)x, (F32)y }, str, col ); + gl_font_draw( pfnt, _gui.batch, { (F32)x, (F32)y }, str, col ); } void gui_draw_str( I32 x, I32 y, U8 align, U32 fnt, CLR col, const char* fmt, ... ) { @@ -326,7 +328,7 @@ void gui_draw_get_str_bounds( I32* w, I32* h, U32 fnt, const char *fmt, ... ) { void gui_draw_get_clip( I32 *x, I32 *y, I32 *w, I32 *h ) { VEC2 start, dim; - gl_get_clip( _gui.gl2d->gl, &start, &dim ); + gl_get_clip( _gui.batch->gl, &start, &dim ); if( x ) *x = (I32)start.x; if( y ) *y = (I32)start.y; @@ -341,11 +343,11 @@ void gui_draw_set_clip( I32 x, I32 y, I32 w, I32 h ) { dim.x = (F32)w; dim.y = (F32)h; - gl_set_clip( _gui.gl2d->gl, start, dim ); + gl_set_clip( _gui.batch->gl, start, dim ); } void gui_draw_reset_clip() { - gl_reset_clip( _gui.gl2d->gl ); + gl_reset_clip( _gui.batch->gl ); } void gui_draw_push_clip( I32 x, I32 y, I32 w, I32 h ) { @@ -397,7 +399,7 @@ U8 gui_key_down( U8 key ) { } F32 gui_frametime() { - return _gui.gl2d->gl->frametime; + return _gui.batch->gl->frametime; } F32 gui_time() { |
