X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=skaterift_imgui_dev.c;h=187bdf4466a45474af6ff8072ec1ac564d01d035;hb=78cc452a8343821ba47c0905d755657847dafd25;hp=b23f04dca9f6a4277b62a40e67190b8de0168852;hpb=456d49acc5e8a2601b8a86317af78355324d8971;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/skaterift_imgui_dev.c b/skaterift_imgui_dev.c index b23f04d..187bdf4 100644 --- a/skaterift_imgui_dev.c +++ b/skaterift_imgui_dev.c @@ -13,33 +13,31 @@ #define SR_NETWORKED #define VG_DEVWINDOW -#include "common.h" -#include "conf.h" -#include "steam.h" -#include "render.h" -#include "audio.h" -#include "world.h" -#include "font.h" -#include "player.h" -#include "entity.c" + +#define SKATERIFT_APPID 2103940 + +#define VG_TIMESTEP_FIXED (1.0/60.0) +#define VG_3D +#define VG_GAME +#define VG_MSG_V1_SUPPORT +#define VG_LOG_SOURCE_INFO +#include "vg/vg.h" static int skaterift_loaded = 0; -static GLuint tex_error; +static char g_an_buffer[ 96 ], + g_an_buffer2[ 96 ]; -int main( int argc, char *argv[] ) -{ +int main( int argc, char *argv[] ){ vg_mem.use_libc_malloc = 0; vg_set_mem_quota( 160*1024*1024 ); vg_enter( argc, argv, "Voyager Game Engine" ); return 0; } -VG_STATIC void vg_launch_opt(void) -{ +static void vg_launch_opt(void){ } -VG_STATIC void vg_preload(void) -{ +static void vg_preload(void){ vg_info(" Copyright . . . -----, ,----- ,---. .---. \n" ); vg_info(" 2021-2023 |\\ /| | / | | | | /| \n" ); vg_info(" | \\ / | +-- / +----- +---' | / | \n" ); @@ -47,43 +45,31 @@ vg_info(" | \\ / | | / | | \\ | / | \n" ); vg_info(" | \\/ | | / | | \\ | / | \n" ); vg_info(" ' ' '--' [] '----- '----- ' ' '---' " "SOFTWARE\n" ); - - steam_init(); - vg_loader_step( NULL, steam_end ); } -VG_STATIC void skaterift_load_post( void *data, u32 len ) -{ +static void skaterift_load_post( void *data, u32 len ){ skaterift_loaded = 1; } -VG_STATIC void vg_load(void) -{ - vg_tex2d_replace_with_error( &tex_error ); +static void vg_load(void){ vg_bake_shaders(); vg_async_call( skaterift_load_post, NULL, 0 ); } -VG_STATIC void vg_update(void) -{ - steam_update(); +static void vg_pre_update(void){ } -VG_STATIC void vg_update_fixed(void) -{ +static void vg_fixed_update(void){ } -VG_STATIC void vg_update_post(void) -{ +static void vg_post_update(void){ } -VG_STATIC void vg_framebuffer_resize( int w, int h ) -{ - render_fb_resize(); +static void vg_framebuffer_resize( int w, int h ){ + //render_fb_resize(); } -VG_STATIC void vg_render(void) -{ +static void vg_render(void){ glBindFramebuffer( GL_FRAMEBUFFER, 0 ); glViewport( 0,0, vg.window_x, vg.window_y ); @@ -93,85 +79,77 @@ 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(); } -struct workshop_form{ - char title[80]; - char description[512]; -} -static form_test; +static struct ui_enum_opt dropdown_options[] = { + { 0, "Zero" }, + { 3, "Three" }, + { -1, "Minus One" } +}; +static i32 dropdown_value = 8; +static i32 checkbox_value = 0; -VG_STATIC void vg_gui(void) -{ +static void vg_gui(void){ if( !skaterift_loaded ) return; - ui_rect screen = { 0, 0, vg.window_x, vg.window_y }; - - ui_rect window = { 0, 0, 1000, 800 }; - ui_rect_center( screen, window ); - { - ui_fill( window, ui_colour( k_ui_bg+1 ) ); - ui_outline( window, 1, ui_colour( k_ui_bg+7 ) ); + static ui_rect window; + static int once = 1; + if( once ){ + ui_rect screen = { 0, 0, vg.window_x, vg.window_y }; + rect_copy( (ui_rect){ 0, 0, 1000, 700 }, window ); + ui_rect_center( screen, window ); + once = 0; + } - 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) ); + vg_ui.wants_mouse = 1; - ui_rect sidebar, content; - ui_split_ratio( panel, k_ui_axis_v, 0.3f, 1, sidebar, content ); + ui_rect panel, content; + ui_panel( window, panel ); - /* entries panel */ - ui_fill( sidebar, ui_colour( k_ui_bg+2 ) ); + static i32 page = 0; + ui_tabs( panel, content, + (const char *[]){ "Controls", "Other", "Nothing" }, 3, &page ); - ui_split_px( sidebar, k_ui_axis_h, 28, 0, title, sidebar ); - ui_text( title, "Your submissions", 1, k_ui_align_middle_center, 0 ); + if( page == 0 ){ + ui_enum( content, "Select enum:", dropdown_options, 3, &dropdown_value ); + ui_checkbox( content, "Toggly:", &checkbox_value ); + ui_textbox( content, "Single:", g_an_buffer, 96, 1, 0, NULL ); + ui_textbox( content, "Multi:", g_an_buffer2, 96, 5, 0, NULL ); - ui_rect controls; - ui_split_px( sidebar, k_ui_axis_h, 28, 0, controls, sidebar ); - ui_fill( controls, ui_colour( k_ui_bg+1 ) ); - ui_outline( controls, -1, ui_colour( k_ui_bg+4 ) ); + if( ui_button( content, "Hello" ) == 1 ){ + vg_success( "Ding!\n" ); + } + } + else if( page == 1 ){ + if( ui_button( content, "Another button" ) == 1 ){ + vg_error( "Press\n" ); + } + } - ui_rect info; - ui_split_ratio( controls, k_ui_axis_v, 0.25f, 0, info, controls ); - ui_text( info, "page 0/2", 1, k_ui_align_middle_center, 0 ); - ui_rect btn_left, btn_right; - ui_split_ratio( controls, k_ui_axis_v, 0.5f, 2, btn_left, btn_right ); - - if( ui_button_text( btn_left, "prev", 1, k_ui_bg+4 ) ){ - vg_info( "left\n" ); - } +#if 0 + ui_fill( window, ui_colour( k_ui_bg+1 ) ); + ui_outline( window, 1, ui_colour( k_ui_bg+7 ) ); - if( ui_button_text( btn_right, "next", 1, k_ui_bg+4 ) ){ - vg_info( "right\n" ); - } + ui_rect title, panel; + ui_split( 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) ); - /* 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, ui_colour( k_ui_bg+0 ) ); - - ui_rect img_box; - ui_fit_item( image_plane, (ui_px[2]){ 3, 2 }, img_box ); - ui_image( img_box, tex_error ); - - ui_rect title_entry, null, label; - ui_split_px( content, k_ui_axis_h, 8, 0, null, content ); - - ui_split_px( content, k_ui_axis_h, 28, 0, title_entry, content ); - ui_split_px( title_entry, k_ui_axis_v, - ui_text_line_width("Title:")+8, 0, label, title_entry ); - - ui_text( label, "Title:", 1, k_ui_align_middle_left, 0 ); - ui_textbox( title_entry, form_test.title, vg_list_size(form_test.title) ); + ui_rect quit_button; + ui_split( title, k_ui_axis_v, title[2]-title[3], 2, title, quit_button ); + if( ui_button_text( quit_button, "x", 1 ) == 1 ){ + ui_start_modal( g_an_buffer, UI_MODAL_GOOD ); } + ui_rect tbox; + ui_split( panel, k_ui_axis_h, 28, 0, tbox, panel ); + ui_textbox( tbox, g_an_buffer, 4096, 0, NULL ); + ui_dev_colourview(); +#endif }