modals
[carveJwlIkooP6JGAAIwe30JlM.git] / skaterift_imgui_dev.c
1 /*
2 * =============================================================================
3 *
4 * Copyright . . . -----, ,----- ,---. .---.
5 * 2021-2023 |\ /| | / | | | | /|
6 * | \ / | +-- / +----- +---' | / |
7 * | \ / | | / | | \ | / |
8 * | \/ | | / | | \ | / |
9 * ' ' '--' [] '----- '----- ' ' '---' SOFTWARE
10 *
11 * =============================================================================
12 */
13
14 #define SR_NETWORKED
15 #define VG_DEVWINDOW
16
17 #include "common.h"
18 #if 0
19 #include "conf.h"
20 #include "steam.h"
21 #include "render.h"
22 #include "audio.h"
23 #include "world.h"
24 #include "font.h"
25 #include "player.h"
26 #include "entity.c"
27 #include "workshop.c"
28 #endif
29
30 static int skaterift_loaded = 0;
31 static char g_an_buffer[ 4096 ];
32
33 int main( int argc, char *argv[] )
34 {
35 vg_mem.use_libc_malloc = 0;
36 vg_set_mem_quota( 160*1024*1024 );
37 vg_enter( argc, argv, "Voyager Game Engine" );
38 return 0;
39 }
40
41 VG_STATIC void vg_launch_opt(void)
42 {
43 }
44
45 VG_STATIC void vg_preload(void)
46 {
47 vg_info(" Copyright . . . -----, ,----- ,---. .---. \n" );
48 vg_info(" 2021-2023 |\\ /| | / | | | | /| \n" );
49 vg_info(" | \\ / | +-- / +----- +---' | / | \n" );
50 vg_info(" | \\ / | | / | | \\ | / | \n" );
51 vg_info(" | \\/ | | / | | \\ | / | \n" );
52 vg_info(" ' ' '--' [] '----- '----- ' ' '---' "
53 "SOFTWARE\n" );
54 }
55
56 VG_STATIC void skaterift_load_post( void *data, u32 len )
57 {
58 skaterift_loaded = 1;
59 }
60
61 VG_STATIC void vg_load(void)
62 {
63 vg_bake_shaders();
64 vg_async_call( skaterift_load_post, NULL, 0 );
65 }
66
67 VG_STATIC void vg_update(void)
68 {
69 }
70
71 VG_STATIC void vg_update_fixed(void)
72 {
73 }
74
75 VG_STATIC void vg_update_post(void)
76 {
77 }
78
79 VG_STATIC void vg_framebuffer_resize( int w, int h )
80 {
81 //render_fb_resize();
82 }
83
84 VG_STATIC void vg_render(void)
85 {
86 glBindFramebuffer( GL_FRAMEBUFFER, 0 );
87
88 glViewport( 0,0, vg.window_x, vg.window_y );
89 glDisable( GL_DEPTH_TEST );
90
91 glClearColor( 0.0f, 0.2f, 0.7f, 0.0f );
92 glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
93
94 /* Other shite */
95 glDisable( GL_BLEND );
96 glDisable( GL_DEPTH_TEST );
97 vg_lines_drawall();
98 }
99
100 VG_STATIC void vg_gui(void)
101 {
102 if( !skaterift_loaded ) return;
103
104 ui_rect null;
105 ui_rect screen = { 0, 0, vg.window_x, vg.window_y };
106 ui_rect window = { 0, 0, 1000, 700 };
107 ui_rect_center( screen, window );
108 vg_ui.wants_mouse = 1;
109
110 ui_fill( window, ui_colour( k_ui_bg+1 ) );
111 ui_outline( window, 1, ui_colour( k_ui_bg+7 ) );
112
113 ui_rect title, panel;
114 ui_split( window, k_ui_axis_h, 28, 0, title, panel );
115 ui_fill( title, ui_colour( k_ui_bg+7 ) );
116 ui_text( title, "Workshop tool", 1, k_ui_align_middle_center,
117 ui_colourcont(k_ui_bg+7) );
118
119 ui_rect quit_button;
120 ui_split( title, k_ui_axis_v, title[2]-title[3], 2, title, quit_button );
121 if( ui_button_text( quit_button, "x", 1 ) ){
122 ui_start_modal( g_an_buffer, UI_MODAL_GOOD );
123 }
124
125 ui_rect tbox;
126 ui_split( panel, k_ui_axis_h, 28, 0, tbox, panel );
127 ui_textbox( tbox, g_an_buffer, 4096, 0, NULL );
128
129 ui_dev_colourview();
130 }