j
[carveJwlIkooP6JGAAIwe30JlM.git] / skaterift_imgui_dev.c
index b27489b73fcaa5165edb4d4e5cfe5959d2b6b38f..2a3d282366b76c0304a23447cc16c15ee1dce1b4 100644 (file)
 
 #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"
-#include "workshop.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 char g_an_buffer[ 4096 ];
 
-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)
-{
+VG_STATIC void vg_launch_opt(void){
 }
 
-VG_STATIC void vg_preload(void)
-{
+VG_STATIC void vg_preload(void){
 vg_info(" Copyright  .        . .       -----, ,----- ,---.   .---.  \n" );
 vg_info(" 2021-2023  |\\      /| |           /  |      |    | |    /| \n" );
 vg_info("            | \\    / | +--        /   +----- +---'  |   / | \n" );
@@ -47,42 +44,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 )
-{
+VG_STATIC void skaterift_load_post( void *data, u32 len ){
    skaterift_loaded = 1;
 }
 
-VG_STATIC void vg_load(void)
-{
+VG_STATIC void vg_load(void){
    vg_bake_shaders();
    vg_async_call( skaterift_load_post, NULL, 0 );
 }
 
-VG_STATIC void vg_update(void)
-{
-   steam_update();
+VG_STATIC void vg_pre_update(void){
 }
 
-VG_STATIC void vg_update_fixed(void)
-{
+VG_STATIC void vg_fixed_update(void){
 }
 
-VG_STATIC void vg_update_post(void)
-{
+VG_STATIC void vg_post_update(void){
 }
 
-VG_STATIC void vg_framebuffer_resize( int w, int h )
-{
-   render_fb_resize();
+VG_STATIC void vg_framebuffer_resize( int w, int h ){
+   //render_fb_resize();
 }
 
-VG_STATIC void vg_render(void)
-{
+VG_STATIC void vg_render(void){
    glBindFramebuffer( GL_FRAMEBUFFER, 0 );
 
    glViewport( 0,0, vg.window_x, vg.window_y );
@@ -97,16 +83,34 @@ 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;
+
+VG_STATIC void vg_gui(void){
    if( !skaterift_loaded ) return;
 
-   ui_rect null;
-   ui_rect screen = { 0, 0, vg.window_x, vg.window_y };
-   ui_rect window = { 0, 0, 1000, 700 };
-   ui_rect_center( screen, window );
+   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;
+   }
+
    vg_ui.wants_mouse = 1;
 
+   ui_rect panel;
+   ui_panel( window, panel );
+   ui_enum( panel, "Select enum:", dropdown_options, 3, &dropdown_value );
+   ui_checkbox( panel, "Toggly:", &checkbox_value );
+
+#if 0
    ui_fill( window, ui_colour( k_ui_bg+1 ) );
    ui_outline( window, 1, ui_colour( k_ui_bg+7 ) );
 
@@ -118,6 +122,14 @@ 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 ) == 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
 }