2 * =============================================================================
4 * Copyright . . . -----, ,----- ,---. .---.
5 * 2021-2023 |\ /| | / | | | | /|
6 * | \ / | +-- / +----- +---' | / |
7 * | \ / | | / | | \ | / |
8 * | \/ | | / | | \ | / |
9 * ' ' '--' [] '----- '----- ' ' '---' SOFTWARE
11 * =============================================================================
17 #define SKATERIFT_APPID 2103940
19 #define VG_TIMESTEP_FIXED (1.0/60.0)
22 #define VG_MSG_V1_SUPPORT
23 #define VG_LOG_SOURCE_INFO
26 static int skaterift_loaded
= 0;
27 static char g_an_buffer
[ 96 ],
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" );
37 static void vg_launch_opt(void){
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(" ' ' '--' [] '----- '----- ' ' '---' "
50 static void skaterift_load_post( void *data
, u32 len
){
54 static void vg_load(void){
56 vg_async_call( skaterift_load_post
, NULL
, 0 );
59 static void vg_pre_update(void){
62 static void vg_fixed_update(void){
65 static void vg_post_update(void){
68 static void vg_framebuffer_resize( int w
, int h
){
72 static void vg_render(void){
73 glBindFramebuffer( GL_FRAMEBUFFER
, 0 );
75 glViewport( 0,0, vg
.window_x
, vg
.window_y
);
76 glDisable( GL_DEPTH_TEST
);
78 glClearColor( 0.0f
, 0.2f
, 0.7f
, 0.0f
);
79 glClear( GL_COLOR_BUFFER_BIT
|GL_DEPTH_BUFFER_BIT
);
82 glDisable( GL_BLEND
);
83 glDisable( GL_DEPTH_TEST
);
87 static struct ui_enum_opt dropdown_options
[] = {
92 static i32 dropdown_value
= 8;
93 static i32 checkbox_value
= 0;
95 static void vg_gui(void){
96 if( !skaterift_loaded
) return;
98 static ui_rect window
;
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
);
107 vg_ui
.wants_mouse
= 1;
109 ui_rect panel
, content
;
110 ui_panel( window
, panel
);
113 ui_tabs( panel
, content
,
114 (const char *[]){ "Controls", "Other", "Nothing" }, 3, &page
);
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
);
122 if( ui_button( content
, "Hello" ) == 1 ){
123 vg_success( "Ding!\n" );
126 else if( page
== 1 ){
127 if( ui_button( content
, "Another button" ) == 1 ){
128 vg_error( "Press\n" );
134 ui_fill( window
, ui_colour( k_ui_bg
+1 ) );
135 ui_outline( window
, 1, ui_colour( k_ui_bg
+7 ) );
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) );
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
);
150 ui_split( panel
, k_ui_axis_h
, 28, 0, tbox
, panel
);
151 ui_textbox( tbox
, g_an_buffer
, 4096, 0, NULL
);