*
*/
-#define SR_NETWORKED
#define VG_3D
+//#define VG_STATIC static
+#define VG_STATIC
+
+//#define VG_MINIMAL_TEST
+#ifndef VG_MINIMAL_TEST
+
+#define SR_NETWORKED
+
#include "common.h"
#include "steam.h"
#include "render.h"
int main( int argc, char *argv[] )
{
+ vg_mem.use_libc_malloc = 0;
+ vg_set_mem_quota( 128*1024*1024 );
vg_enter( argc, argv, "Voyager Game Engine" );
}
-static void highscores_save_at_exit(void*_)
+VG_STATIC void highscores_save_at_exit(void*_)
{
highscores_serialize_all();
- highscores_free();
}
-void vg_preload(void)
+VG_STATIC void vg_preload(void)
{
+
vg_convar_push( (struct vg_convar){
.name = "cl_ui",
.data = &cl_ui,
vg_loader_highwater( NULL, highscores_save_at_exit, NULL );
- vg_sleep_ms(200);
+ //vg_sleep_ms(200);
steam_init();
vg_loader_highwater( NULL, steam_end, NULL );
vg_loader_highwater( network_init, network_end, NULL );
}
-void vg_load(void)
+VG_STATIC void vg_load(void)
{
- vg_loader_highwater( render_init, render_free, NULL );
- vg_loader_highwater( menu_init, menu_free, NULL );
- vg_loader_highwater( world_init, world_free, NULL );
+ vg_loader_highwater( render_init, NULL, NULL );
+ vg_loader_highwater( menu_init, NULL, NULL );
+ vg_loader_highwater( world_init, NULL, NULL );
vg_loader_highwater( player_init, NULL, NULL );
- if( !vg_bake_shaders() )
- vg_fatal_exit_loop( "Did not load all shaders" );
-
+ vg_bake_shaders();
vg_loader_highwater( audio_init, audio_free, NULL );
+ world_audio_init();
- /* FInal step */
+ /* 'systems' are completely loaded now */
+ strcpy( world.world_name, "models/mp_test.mdl" );
world_load();
vg_console_load_autos();
}
-static void vg_start(void)
+VG_STATIC void vg_start(void)
{
- player_load_model( "ch_jordan", 0 );
reset_player( 1, (const char *[]){ "start" } );
}
-static void draw_origin_axis(void)
+VG_STATIC void draw_origin_axis(void)
{
vg_line( (v3f){ 0.0f, 0.0f, 0.0f }, (v3f){ 1.0f, 0.0f, 0.0f }, 0xffff0000 );
vg_line( (v3f){ 0.0f, 0.0f, 0.0f }, (v3f){ 0.0f, 1.0f, 0.0f }, 0xff00ff00 );
vg_line( (v3f){ 0.0f, 0.0f, 0.0f }, (v3f){ 0.0f, 0.0f, 1.0f }, 0xff0000ff );
}
-void vg_update( int loaded )
+VG_STATIC void vg_update( int loaded )
{
steam_update();
}
}
-static void vg_update_fixed( int loaded )
+VG_STATIC void vg_update_fixed( int loaded )
{
if( loaded )
{
}
}
-static void vg_update_post( int loaded )
+VG_STATIC void vg_update_post( int loaded )
{
if( loaded )
{
}
}
-static void vg_framebuffer_resize( int w, int h )
+VG_STATIC void vg_framebuffer_resize( int w, int h )
{
render_fb_resize();
- gate_fb_resize();
water_fb_resize();
}
-static void render_main_game(void)
+VG_STATIC void render_main_game(void)
{
m4x4f world_4x4;
m4x3_expand( camera_mtx_inverse, world_4x4 );
render_fsquad();
}
-void vg_render(void)
+VG_STATIC void vg_render(void)
{
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
glViewport( 0,0, vg.window_x, vg.window_y );
glViewport( 0,0, vg.window_x, vg.window_y );
}
-void vg_ui(void)
+VG_STATIC void vg_ui(void)
{
#if 0
if( cl_menu )
}
#if 0
-static void run_light_widget( struct light_widget *lw )
+VG_STATIC void run_light_widget( struct light_widget *lw )
{
struct ui_checkbox c1 = { .data=&lw->enabled };
}
#endif
-static void run_debug_info(void)
+VG_STATIC void run_debug_info(void)
{
char buf[40];
snprintf( buf, 40, "%.2fm/s", v3_length( player.phys.rb.v ) );
- gui_text( (ui_px [2]){ 0, 0 }, buf, 1, k_text_align_left );
+ ui_text( (ui_px [2]){ 0, 0 }, buf, 1, k_text_align_left );
snprintf( buf, 40, "%.2f %.2f %.2f m/s",
player.phys.a[0], player.phys.a[1], player.phys.a[2] );
- gui_text( (ui_px [2]){ 0, 20 }, buf, 1, k_text_align_left );
+ ui_text( (ui_px [2]){ 0, 20 }, buf, 1, k_text_align_left );
snprintf( buf, 40, "pos %.2f %.2f %.2f",
player.phys.rb.co[0], player.phys.rb.co[1], player.phys.rb.co[2] );
- gui_text( (ui_px [2]){ 0, 40 }, buf, 1, k_text_align_left );
+ ui_text( (ui_px [2]){ 0, 40 }, buf, 1, k_text_align_left );
if( vg.gamepad_ready )
{
for( int i=0; i<6; i++ )
{
snprintf( buf, 40, "%.2f", vg.gamepad.axes[i] );
- gui_text( (ui_px [2]){ 0, (i+3)*20 }, buf, 1, k_text_align_left );
+ ui_text( (ui_px [2]){ 0, (i+3)*20 }, buf, 1, k_text_align_left );
}
}
else
{
- gui_text( (ui_px [2]){ 0, 60 },
+ ui_text( (ui_px [2]){ 0, 60 },
"Gamepad not ready", 1, k_text_align_left );
}
}
+
+#else
+
+#define VG_TIMESTEP_FIXED (1.0/60.0)
+#define VG_3D
+#define VG_FRAMEBUFFER_RESIZE 1
+#include "vg/vg.h"
+
+int main( int argc, char *argv[] )
+{
+ vg_prealloc_quota( 512*1024*1024 );
+ vg_enter( argc, argv, "Voyager Game Engine" );
+}
+
+VG_STATIC void vg_preload(void)
+{
+vg_info(" Copyright . . . -----, ,----- ,---. .---. \n" );
+vg_info(" 2021-2022 |\\ /| | / | | | | /| \n" );
+vg_info(" | \\ / | +-- / +----- +---' | / | \n" );
+vg_info(" | \\ / | | / | | \\ | / | \n" );
+vg_info(" | \\/ | | / | | \\ | / | \n" );
+vg_info(" ' ' '--' [] '----- '----- ' ' '---' "
+ "SOFTWARE\n" );
+}
+
+VG_STATIC void vg_load(void)
+{
+ vg_bake_shaders();
+ vg_console_load_autos();
+}
+
+VG_STATIC void vg_start(void)
+{
+}
+
+VG_STATIC void vg_update( int loaded )
+{
+}
+
+VG_STATIC void vg_update_fixed( int loaded )
+{
+}
+
+VG_STATIC void vg_update_post( int loaded )
+{
+}
+
+VG_STATIC void vg_framebuffer_resize( int w, int h )
+{
+}
+
+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.11f, 0.35f, 0.37f, 1.0f );
+ glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
+
+ /* Other shite */
+ glDisable(GL_BLEND);
+ glDisable( GL_DEPTH_TEST );
+ vg_lines_drawall( (float *)vg.pv );
+ glViewport( 0,0, vg.window_x, vg.window_y );
+}
+
+VG_STATIC void vg_ui(void)
+{
+}
+
+#endif