better nametag
[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 #define SKATERIFT_APPID 2103940
18
19 #define VG_TIMESTEP_FIXED (1.0/60.0)
20 #define VG_3D
21 #define VG_GAME
22 #define VG_MSG_V1_SUPPORT
23 #define VG_LOG_SOURCE_INFO
24 #include "vg/vg.h"
25
26 static int skaterift_loaded = 0;
27 static char g_an_buffer[ 96 ],
28 g_an_buffer2[ 96 ];
29
30 int main( int argc, char *argv[] ){
31 vg_mem.use_libc_malloc = 0;
32 vg_set_mem_quota( 160*1024*1024 );
33 vg_enter( argc, argv, "Voyager Game Engine" );
34 return 0;
35 }
36
37 static void vg_launch_opt(void){
38 }
39
40 static void vg_preload(void){
41 vg_info(" Copyright . . . -----, ,----- ,---. .---. \n" );
42 vg_info(" 2021-2023 |\\ /| | / | | | | /| \n" );
43 vg_info(" | \\ / | +-- / +----- +---' | / | \n" );
44 vg_info(" | \\ / | | / | | \\ | / | \n" );
45 vg_info(" | \\/ | | / | | \\ | / | \n" );
46 vg_info(" ' ' '--' [] '----- '----- ' ' '---' "
47 "SOFTWARE\n" );
48 }
49
50 static void skaterift_load_post( void *data, u32 len ){
51 skaterift_loaded = 1;
52 }
53
54 static void vg_load(void){
55 vg_bake_shaders();
56 vg_async_call( skaterift_load_post, NULL, 0 );
57 }
58
59 static void vg_pre_update(void){
60 }
61
62 static void vg_fixed_update(void){
63 }
64
65 static void vg_post_update(void){
66 }
67
68 static void vg_framebuffer_resize( int w, int h ){
69 //render_fb_resize();
70 }
71
72 static void vg_render(void){
73 glBindFramebuffer( GL_FRAMEBUFFER, 0 );
74
75 glViewport( 0,0, vg.window_x, vg.window_y );
76 glDisable( GL_DEPTH_TEST );
77
78 glClearColor( 0.0f, 0.2f, 0.7f, 0.0f );
79 glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
80
81 /* Other shite */
82 glDisable( GL_BLEND );
83 glDisable( GL_DEPTH_TEST );
84 vg_lines_drawall();
85 }
86
87 static struct ui_enum_opt dropdown_options[] = {
88 { 0, "Zero" },
89 { 3, "Three" },
90 { -1, "Minus One" }
91 };
92 static i32 dropdown_value = 8;
93 static i32 checkbox_value = 0;
94
95 static void vg_gui(void){
96 if( !skaterift_loaded ) return;
97
98 static ui_rect window;
99 static int once = 1;
100 if( once ){
101 ui_rect screen = { 0, 0, vg.window_x, vg.window_y };
102 rect_copy( (ui_rect){ 0, 0, 1000, 700 }, window );
103 ui_rect_center( screen, window );
104 once = 0;
105 }
106
107 vg_ui.wants_mouse = 1;
108
109 ui_rect panel, content;
110 ui_panel( window, panel );
111
112 static i32 page = 0;
113 ui_tabs( panel, content,
114 (const char *[]){ "Controls", "Other", "Nothing" }, 3, &page );
115
116 if( page == 0 ){
117 ui_enum( content, "Select enum:", dropdown_options, 3, &dropdown_value );
118 ui_checkbox( content, "Toggly:", &checkbox_value );
119 ui_textbox( content, "Single:", g_an_buffer, 96, 1, 0, NULL );
120 ui_textbox( content, "Multi:", g_an_buffer2, 96, 5, 0, NULL );
121
122 if( ui_button( content, "Hello" ) == 1 ){
123 vg_success( "Ding!\n" );
124 }
125 }
126 else if( page == 1 ){
127 if( ui_button( content, "Another button" ) == 1 ){
128 vg_error( "Press\n" );
129 }
130 }
131
132
133 #if 0
134 ui_fill( window, ui_colour( k_ui_bg+1 ) );
135 ui_outline( window, 1, ui_colour( k_ui_bg+7 ) );
136
137 ui_rect title, panel;
138 ui_split( window, k_ui_axis_h, 28, 0, title, panel );
139 ui_fill( title, ui_colour( k_ui_bg+7 ) );
140 ui_text( title, "Workshop tool", 1, k_ui_align_middle_center,
141 ui_colourcont(k_ui_bg+7) );
142
143 ui_rect quit_button;
144 ui_split( title, k_ui_axis_v, title[2]-title[3], 2, title, quit_button );
145 if( ui_button_text( quit_button, "x", 1 ) == 1 ){
146 ui_start_modal( g_an_buffer, UI_MODAL_GOOD );
147 }
148
149 ui_rect tbox;
150 ui_split( panel, k_ui_axis_h, 28, 0, tbox, panel );
151 ui_textbox( tbox, g_an_buffer, 4096, 0, NULL );
152
153 ui_dev_colourview();
154 #endif
155 }