imgui stuff
authorhgn <hgodden00@gmail.com>
Sun, 30 Apr 2023 18:21:34 +0000 (19:21 +0100)
committerhgn <hgodden00@gmail.com>
Sun, 30 Apr 2023 18:21:34 +0000 (19:21 +0100)
menu.h
player.c
render.h
skaterift.c
skaterift_imgui_dev.c [new file with mode: 0644]

diff --git a/menu.h b/menu.h
index 7a5117d2422d56ae0029d19489c25215a8dece48..6612494a8492a899c8733878b68d32a4599459ec 100644 (file)
--- a/menu.h
+++ b/menu.h
@@ -320,6 +320,7 @@ VG_STATIC void menu_btn_map( int event )
 
 VG_STATIC void menu_crap_ui(void)
 {
+#if 0
    if( cl_menu && (game_menu.page == k_menu_page_map) ){
       ui_rect box;
       box[0] = vg.window_x/2 - 150;
@@ -348,6 +349,7 @@ VG_STATIC void menu_crap_ui(void)
          }
       }
    }
+#endif
 }
 
 VG_STATIC void steam_on_game_overlay( CallbackMsg_t *msg )
index 5b64b8d7f99084f5b2c364e6640d681fbf0738dd..0339a8d889f87c0faa08bf6b2443cf2bba9e783b 100644 (file)
--- a/player.c
+++ b/player.c
@@ -38,6 +38,7 @@ VG_STATIC void player_init(void)
 PLAYER_API
 void player__debugtext( int size, const char *fmt, ... )
 {
+#if 0
        char buffer[ 1024 ];
 
    va_list args;
@@ -47,6 +48,7 @@ void player__debugtext( int size, const char *fmt, ... )
 
    ui_text( vg_uictx.cursor, buffer, size, k_text_align_right );
        vg_uictx.cursor[1] += 14*size;
+#endif
 }
 
 /*
@@ -293,6 +295,7 @@ VG_STATIC void gate_rotate_angles( ent_gate *gate, v3f angles, v3f d )
 
 PLAYER_API void player__im_gui( player_instance *player )
 {
+#if 0
    vg_uictx.cursor[0] = vg.window_x - 200;
    vg_uictx.cursor[1] = 0;
    vg_uictx.cursor[2] = 200;
@@ -310,6 +313,7 @@ PLAYER_API void player__im_gui( player_instance *player )
 
    b[2].co[1] = vg_uictx.cursor[1];
    b[3].co[1] = vg_uictx.cursor[1];
+#endif
 }
 
 VG_STATIC void global_skateshop_exit(void);
index a80f78acff6048e8655d6bff56b9f9237972f2c2..b6172283121632b9d18ac0ac6395e300b8c5341f 100644 (file)
--- a/render.h
+++ b/render.h
@@ -593,6 +593,7 @@ VG_STATIC void render_fsquad1(void)
  */
 VG_STATIC void render_view_framebuffer_ui(void)
 {
+#if 0
    int viewing_count = 0;
 
    glBindVertexArray( gpipeline.fsquad.vao );
@@ -643,6 +644,7 @@ VG_STATIC void render_view_framebuffer_ui(void)
          viewing_count ++;
       }
    }
+#endif
 }
 
 VG_STATIC void render_framebuffer_show( struct framebuffer *fb,
index e8b1f4dd5e3dea85dee98e0abfe75372d50f0041..2879ef9d117e43cd37443fc6c95904670d56e421 100644 (file)
  * =============================================================================
  */
 
+#include "skaterift_imgui_dev.c"
+
+#if 0
+
 #define SR_NETWORKED
 #define VG_DEVWINDOW
 #include "common.h"
@@ -486,3 +490,5 @@ VG_STATIC void vg_ui(void)
    
    render_view_framebuffer_ui();
 }
+
+#endif
diff --git a/skaterift_imgui_dev.c b/skaterift_imgui_dev.c
new file mode 100644 (file)
index 0000000..2f1ca57
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * =============================================================================
+ *
+ * Copyright  .        . .       -----, ,----- ,---.   .---.
+ * 2021-2023  |\      /| |           /  |      |    | |    /|
+ *            | \    / | +--        /   +----- +---'  |   / |
+ *            |  \  /  | |         /    |      |   \  |  /  |
+ *            |   \/   | |        /     |      |    \ | /   |
+ *            '        ' '--' [] '----- '----- '     ' '---'  SOFTWARE
+ *
+ * =============================================================================
+ */
+
+#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"
+
+static int skaterift_loaded = 0;
+static GLuint tex_error;
+
+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)
+{
+}
+
+VG_STATIC void vg_preload(void)
+{
+vg_info(" Copyright  .        . .       -----, ,----- ,---.   .---.  \n" );
+vg_info(" 2021-2023  |\\      /| |           /  |      |    | |    /| \n" );
+vg_info("            | \\    / | +--        /   +----- +---'  |   / | \n" );
+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 )
+{
+   skaterift_loaded = 1;
+}
+
+VG_STATIC void vg_load(void)
+{
+   vg_tex2d_replace_with_error( &tex_error );
+   vg_bake_shaders();
+   vg_async_call( skaterift_load_post, NULL, 0 );
+}
+
+VG_STATIC void vg_update(void)
+{
+   steam_update();
+}
+
+VG_STATIC void vg_update_fixed(void)
+{
+}
+
+VG_STATIC void vg_update_post(void)
+{
+}
+
+VG_STATIC void vg_framebuffer_resize( int w, int h )
+{
+   render_fb_resize();
+}
+
+VG_STATIC void vg_render(void)
+{
+   glBindFramebuffer( GL_FRAMEBUFFER, 0 );
+
+   glViewport( 0,0, vg.window_x, vg.window_y );
+   glDisable( GL_DEPTH_TEST );
+
+   glClearColor( 0.0f, 0.2f, 0.7f, 0.0f );
+   glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
+   
+   /* Other shite */
+   glDisable(GL_BLEND);
+   glDisable(GL_DEPTH_TEST);
+   vg_lines_drawall();
+}
+
+VG_STATIC void vg_ui(void)
+{
+   if( !skaterift_loaded ) return;
+
+   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_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 );
+
+      ui_rect sidebar, content;
+      ui_split_ratio( panel, k_ui_axis_v, 0.25f, 1, sidebar, content );
+
+      /* entries panel */
+      ui_fill( sidebar, 0xff222222 );
+
+      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 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" );
+      }
+
+      /* 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
+}