main.c (2149B)
1 2 #include "animation.h" 3 #include "chess.h" 4 #include "debug.h" 5 #include "engine.h" 6 #include "fbo.h" 7 #include "file.h" 8 #include "geometry.h" 9 #include "gl.h" 10 #include "hires.h" 11 #include "ply.h" 12 #include "poisson.h" 13 #include "quickhull.h" 14 #include "render.h" 15 #include "scene.h" 16 #include "slab.h" 17 #include "terrain.h" 18 #include "test_game.h" 19 #include "uniform.h" 20 #include "update.h" 21 #include "util.h" 22 #include "window.h" 23 #include "rogue/rogue.h" 24 25 26 #include <assert.h> 27 #include <time.h> 28 29 int main(void) 30 { 31 int nsamples; 32 33 /* int seed = time(NULL); */ 34 /* int seed = 1588992474; */ 35 int seed = 1589065328; 36 int width = 640; 37 int height = 480; 38 int ok; 39 40 /* int seed = 42; */ 41 printf("seed %d\n", seed); 42 srand(seed); 43 44 struct engine engine; 45 struct test_game game; 46 //struct rogue_game rogue_game; 47 48 engine.seed = seed; 49 50 init_engine(&engine, width, height); 51 /* 52 if (!init_rogue_game(&engine, &rogue_game)) { 53 printf("failed to init game!\n"); 54 return 1; 55 } 56 */ 57 58 init_test_game(&engine, &game); 59 //reset_scene(&engine); 60 default_scene(&game); 61 pbr_scene(&game); 62 63 check_gl(); 64 double last = hires_time_in_seconds(); 65 66 while (!engine.quit) { 67 engine.input.keystates = SDL_GetKeyboardState(NULL); 68 engine.frame++; 69 process_events(&engine.input, engine.frame); 70 if (engine.input.resized_height) { 71 /* 72 printf("handling resize %d %d\n", engine.input.resized_width, 73 engine.input.resized_height); 74 */ 75 handle_resize(&engine, engine.input.resized_width, engine.input.resized_height); 76 } 77 78 //default_config.camera = engine.test_resources.camera_node->mat; 79 double new_time = hires_time_in_seconds(); 80 double frame_time = new_time - last; 81 engine.dt = frame_time; 82 last = new_time; 83 84 // render our game frame here 85 test_game_frame(&engine, &game); 86 //rogue_frame(&engine, &rogue_game); 87 88 /* Swap front and back buffers */ 89 SDL_GL_SwapWindow(engine.window); 90 } 91 92 /* free(slab_buffer); */ 93 /* free_slab_geom(&geom, NULL) */ 94 95 //SDL_GL_DeleteContext(gl); 96 //return 0; 97 } 98