X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=vg%2Fvg.h;h=b0119ecf03458ac0f3c2abe0c6a3d895c04cb336;hb=3b9fa3ad6ac1ff919f31fafaeceac689c7c4736b;hp=90d8f7010ce685b53c1ecf8ed24960d415e6edeb;hpb=ed4d77304bd5515253b4048fabbc9a4da81a6f44;p=fishladder.git diff --git a/vg/vg.h b/vg/vg.h index 90d8f70..b0119ec 100644 --- a/vg/vg.h +++ b/vg/vg.h @@ -192,6 +192,9 @@ static void vg_init( int argc, char *argv[], const char *window_name ) const unsigned char* glver = glGetString( GL_VERSION ); vg_success( "Load setup complete, OpenGL version: %s\n", glver ); + vg_console_init(); + vg_register_exit( &vg_console_free, "Console" ); + vg_run_gfx_diagnostics(); for( int id = 0; id <= GLFW_JOYSTICK_LAST; id ++ ) @@ -212,7 +215,7 @@ static void vg_init( int argc, char *argv[], const char *window_name ) vg_register_exit( &vg_lines_free, "vg_lines_free" ); ui_default_init(); vg_register_exit( &ui_default_free, "UI" ); - + vg_register(); vg_register_exit( &vg_free, "vg_free" ); @@ -242,7 +245,26 @@ static void vg_init( int argc, char *argv[], const char *window_name ) vg_lines_drawall((float*)vg_pv); - vg_ui(); + { + ui_begin( &ui_global_ctx, vg_window_x, vg_window_y ); + + // TODO: Find a more elegent form for this + int mouse_state = 0; + if( vg_get_button( "primary" ) ) mouse_state = 2; + if( vg_get_button_down( "primary" ) ) mouse_state = 1; + if( vg_get_button_up( "primary" ) ) mouse_state = 3; + + ui_set_mouse( &ui_global_ctx, vg_mouse[0], vg_mouse[1], mouse_state ); + + vg_ui(); + vg_console_draw(); + + ui_resolve( &ui_global_ctx ); + m3x3f view = M3X3_IDENTITY; + m3x3_translate( view, (v3f){ -1.0f, 1.0f, 0.0f } ); + m3x3_scale( view, (v3f){ 1.0f/((float)vg_window_x*0.5f), -1.0f/((float)vg_window_y*0.5f), 1.0f } ); + ui_draw( &ui_global_ctx ); + } glfwSwapBuffers( vg_window );