handplants
[carveJwlIkooP6JGAAIwe30JlM.git] / skaterift_imgui_dev.c
index 6247b82d9fe42d0f9420da5386c9b8ae8a91a4e0..187bdf4466a45474af6ff8072ec1ac564d01d035 100644 (file)
@@ -24,7 +24,8 @@
 #include "vg/vg.h"
 
 static int skaterift_loaded = 0;
-static char g_an_buffer[ 4096 ];
+static char g_an_buffer[ 96 ],
+            g_an_buffer2[ 96 ];
 
 int main( int argc, char *argv[] ){
    vg_mem.use_libc_malloc = 0;
@@ -33,10 +34,10 @@ int main( int argc, char *argv[] ){
    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" );
@@ -46,29 +47,29 @@ vg_info("            '        ' '--' [] '----- '----- '     ' '---'  "
         "SOFTWARE\n" );
 }
 
-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){
+static void vg_load(void){
    vg_bake_shaders();
    vg_async_call( skaterift_load_post, NULL, 0 );
 }
 
-VG_STATIC void vg_pre_update(void){
+static void vg_pre_update(void){
 }
 
-VG_STATIC void vg_fixed_update(void){
+static void vg_fixed_update(void){
 }
 
-VG_STATIC void vg_post_update(void){
+static void vg_post_update(void){
 }
 
-VG_STATIC void vg_framebuffer_resize( int w, int h ){
+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 );
@@ -83,7 +84,15 @@ VG_STATIC void vg_render(void){
    vg_lines_drawall();
 }
 
-VG_STATIC void vg_gui(void){
+static struct ui_enum_opt dropdown_options[] = {
+   { 0, "Zero" },
+   { 3, "Three" },
+   { -1, "Minus One" }
+};
+static i32 dropdown_value = 8;
+static i32 checkbox_value = 0;
+
+static void vg_gui(void){
    if( !skaterift_loaded ) return;
 
    static ui_rect window;
@@ -97,14 +106,30 @@ VG_STATIC void vg_gui(void){
 
    vg_ui.wants_mouse = 1;
 
-   ui_rect panel;
-   if( vgi_window( window, "Test window", k_vgi_window_standard, panel ) ){
-      
+   ui_rect panel, content;
+   ui_panel( window, panel );
+
+   static i32 page = 0;
+   ui_tabs( panel, content, 
+            (const char *[]){ "Controls", "Other", "Nothing" }, 3, &page );
+
+   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 );
+
+      if( ui_button( content, "Hello" ) == 1 ){
+         vg_success( "Ding!\n" );
+      }
    }
-   else{
-      /* window close */
+   else if( page == 1 ){
+      if( ui_button( content, "Another button" ) == 1 ){
+         vg_error( "Press\n" );
+      }
    }
 
+
 #if 0
    ui_fill( window, ui_colour( k_ui_bg+1 ) );
    ui_outline( window, 1, ui_colour( k_ui_bg+7 ) );
@@ -117,7 +142,7 @@ VG_STATIC void vg_gui(void){
 
    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 ) ){
+   if( ui_button_text( quit_button, "x", 1 ) == 1 ){
       ui_start_modal( g_an_buffer, UI_MODAL_GOOD );
    }