X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=skaterift_imgui_dev.c;h=c51acbe082b2d05b6ba3fac8ce92b3ff6632eb04;hb=02e5027d274fc66fecca0572d0998e2c562da7a7;hp=2f1ca571da2a7b5c2e523253425feb7574d4b27a;hpb=bc40c302f1b8313bdd3c773fcfa2f850511c4634;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/skaterift_imgui_dev.c b/skaterift_imgui_dev.c index 2f1ca57..c51acbe 100644 --- a/skaterift_imgui_dev.c +++ b/skaterift_imgui_dev.c @@ -22,9 +22,9 @@ #include "font.h" #include "player.h" #include "entity.c" +#include "workshop.c" static int skaterift_loaded = 0; -static GLuint tex_error; int main( int argc, char *argv[] ) { @@ -59,7 +59,6 @@ VG_STATIC void skaterift_load_post( void *data, u32 len ) VG_STATIC void vg_load(void) { - vg_tex2d_replace_with_error( &tex_error ); vg_bake_shaders(); vg_async_call( skaterift_load_post, NULL, 0 ); } @@ -93,82 +92,39 @@ VG_STATIC void vg_render(void) glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT ); /* Other shite */ - glDisable(GL_BLEND); - glDisable(GL_DEPTH_TEST); + glDisable( GL_BLEND ); + glDisable( GL_DEPTH_TEST ); vg_lines_drawall(); } -VG_STATIC void vg_ui(void) +VG_STATIC void vg_gui(void) { if( !skaterift_loaded ) return; + ui_rect null; ui_rect screen = { 0, 0, vg.window_x, vg.window_y }; - - v4f btn_basic = { 0.8f,0.8f,0.8f,1.0f }; - - ui_rect window = { 0, 0, 1200, 800 }; + ui_rect window = { 0, 0, 1000, 700 }; ui_rect_center( screen, window ); - { - ui_fill( window, 0xff111111 ); - ui_outline( window, 1, 0xffffffff ); - - ui_rect title, panel; - ui_split_px( window, k_ui_axis_h, 28, 0, title, panel ); - ui_fill( title, 0xff333333 ); - ui_text( title, "Workshop tool", 2, k_ui_align_center ); + vg_ui.wants_mouse = 1; - ui_rect sidebar, content; - ui_split_ratio( panel, k_ui_axis_v, 0.25f, 1, sidebar, content ); + ui_fill( window, ui_colour( k_ui_bg+1 ) ); + ui_outline( window, 1, ui_colour( k_ui_bg+7 ) ); - /* entries panel */ - ui_fill( sidebar, 0xff222222 ); + ui_rect title, panel; + ui_split_px( window, k_ui_axis_h, 28, 0, title, panel ); + ui_fill( title, ui_colour( k_ui_bg+7 ) ); + ui_text( title, "Workshop tool", 1, k_ui_align_middle_center, + ui_colourcont(k_ui_bg+7) ); - ui_split_px( sidebar, k_ui_axis_h, 28, 0, title, sidebar ); - ui_text( title, "Your submissions", 1, k_ui_align_middle_center ); + ui_rect quit_button; + ui_split_px( title, k_ui_axis_v, title[2]-title[3], 2, title, quit_button ); - - ui_rect up_button; - ui_split_px( sidebar, k_ui_axis_h, 48, 0, up_button, sidebar ); - - if( ui_button_text( up_button, "^", 2, btn_basic ) ){ - vg_info( "page up\n" ); + if( workshop_form.operation == k_workshop_form_op_none ){ + if( ui_button_text( quit_button, "X", 1 ) ){ + workshop_quit_form(); + return; } - - /* content page */ - ui_rect_pad( content, 8 ); - - ui_rect image_plane; - ui_split_px( content, k_ui_axis_h, 300, 0, image_plane, content ); - ui_fill( image_plane, 0xff000000 ); - - ui_rect img_box; - ui_fit_item( image_plane, (ui_px[2]){ 3, 2 }, img_box ); - ui_image( img_box, tex_error ); - - ui_text( content, "rest of the stuff", 1, k_ui_align_left ); } -#if 0 - ui_box box = { 200, 100, 600, 400 };{ - ui_fill( box, 0xff0000aa ); - ui_outline( box, 1, 0xffffffff ); - - ui_split split = ui_split_ratio( box, k_ui_axis_v, 0.25f, 8 );{ - if( ui_mouseover_rect( split.l.rect ) ) ui_fill( split.l, 0xff00aa00 ); - else ui_fill( split.l, 0xffaa0000 ); - - ui_text( split.l.rect, "Hello world!\n" - "adwjdiwadjwidwjidiadjw\n" - "eeeee", 1, k_ui_align_center ); - }{ - ui_fill( split.r, 0xff002000 ); - split = ui_split_ratio( split.r, k_ui_axis_h, 0.5f, 1 ); - - ui_box img_box = ui_fit_item( split.t, (ui_px[2]){ 30,20 } ); - ui_image( img_box.rect, tex_error ); - - ui_fill( split.b, 0xff00ff00 ); - } - } -#endif + ui_dev_colourview(); }