|
|
|
@ -1,7 +1,6 @@ |
|
|
|
/*******************************************************************************
|
|
|
|
/*******************************************************************************
|
|
|
|
* TODO: |
|
|
|
* TODO: |
|
|
|
* - renderer |
|
|
|
* - renderer |
|
|
|
* - add prefix to interface function names for eg) gooey.h, renderer.h |
|
|
|
|
|
|
|
* - clean up main(), split out initialization and scene loading to new functions |
|
|
|
* - clean up main(), split out initialization and scene loading to new functions |
|
|
|
* - check over renderer, camera, gooey init after changes |
|
|
|
* - check over renderer, camera, gooey init after changes |
|
|
|
* - pass in frame time to camera movement functions to decouple speed from framerate |
|
|
|
* - pass in frame time to camera movement functions to decouple speed from framerate |
|
|
|
@ -191,7 +190,7 @@ processSDLEvents() |
|
|
|
// let gooey have event
|
|
|
|
// let gooey have event
|
|
|
|
// TODO: need to check for both io.WantCaptureKeyboard and io.WantCaptureMouse
|
|
|
|
// TODO: need to check for both io.WantCaptureKeyboard and io.WantCaptureMouse
|
|
|
|
// to fix bug with 'ESC' not passing through while in imgui
|
|
|
|
// to fix bug with 'ESC' not passing through while in imgui
|
|
|
|
bool gooey_wants = gooeyProcessEvent(e); |
|
|
|
bool gooey_wants = gooProcessEvent(e); |
|
|
|
game_state* g = g_game_state; |
|
|
|
game_state* g = g_game_state; |
|
|
|
|
|
|
|
|
|
|
|
switch (e.type) |
|
|
|
switch (e.type) |
|
|
|
@ -269,7 +268,7 @@ cleanUp(SDL_Handles &handles) |
|
|
|
#if 0 |
|
|
|
#if 0 |
|
|
|
shutdownGooey(); |
|
|
|
shutdownGooey(); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
freeBuffers(g_render_state); // renderer.h
|
|
|
|
renFreeBuffers(g_render_state); // renderer.h
|
|
|
|
for (SDL_Surface *surface : handles.texSurfaces) |
|
|
|
for (SDL_Surface *surface : handles.texSurfaces) |
|
|
|
SDL_FreeSurface(surface); |
|
|
|
SDL_FreeSurface(surface); |
|
|
|
meShutdownAssimp(); // mesh.h
|
|
|
|
meShutdownAssimp(); // mesh.h
|
|
|
|
@ -324,12 +323,12 @@ int main(int argc, char* argv[]) |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!initRenderer(g_render_state)) { |
|
|
|
if (!renInit(g_render_state)) { |
|
|
|
LOG(ERROR) << "Unable to initialize graphics, exiting\n"; |
|
|
|
LOG(ERROR) << "Unable to initialize graphics, exiting\n"; |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!initGooey(g_render_state->handles, g_render_state->viewport_dims)) { |
|
|
|
if (!gooInit(g_render_state->handles, g_render_state->viewport_dims)) { |
|
|
|
LOG(ERROR) << "Fooey, No Gooey!\n"; |
|
|
|
LOG(ERROR) << "Fooey, No Gooey!\n"; |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -347,7 +346,7 @@ int main(int argc, char* argv[]) |
|
|
|
|
|
|
|
|
|
|
|
// pre-load textures
|
|
|
|
// pre-load textures
|
|
|
|
const char * path = "../data/coords.layout.flat.png"; |
|
|
|
const char * path = "../data/coords.layout.flat.png"; |
|
|
|
if (!addTexture(g_render_state->handles, path)) |
|
|
|
if (!renAddTexture(g_render_state->handles, path)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LOG(ERROR) << "Error adding " << path << "\n"; |
|
|
|
LOG(ERROR) << "Error adding " << path << "\n"; |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
@ -394,7 +393,7 @@ int main(int argc, char* argv[]) |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!createScene(g_render_state, g_game_state->entities, g_game_state->entity_count)) |
|
|
|
if (!renCreateScene(g_render_state, g_game_state->entities, g_game_state->entity_count)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LOG(ERROR) << "Error in vertex data, exiting\n"; |
|
|
|
LOG(ERROR) << "Error in vertex data, exiting\n"; |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
@ -424,12 +423,12 @@ int main(int argc, char* argv[]) |
|
|
|
cameraMove(r->cam, g->is_moveup, g->is_moveleft, g->is_movedown, g->is_moveright, |
|
|
|
cameraMove(r->cam, g->is_moveup, g->is_moveleft, g->is_movedown, g->is_moveright, |
|
|
|
g->is_moveforward, g->is_movebackward); |
|
|
|
g->is_moveforward, g->is_movebackward); |
|
|
|
|
|
|
|
|
|
|
|
renderFrame(r, g->grid.hex_array, g->entities, g->entity_count); |
|
|
|
renRenderFrame(r, g->grid.hex_array, g->entities, g->entity_count); |
|
|
|
|
|
|
|
|
|
|
|
if (r->is_debug_draw && g->grid.draw_mode == CONE_FILL) |
|
|
|
if (r->is_debug_draw && g->grid.draw_mode == CONE_FILL) |
|
|
|
renderDebug(r, g_polygon_select_vertices); |
|
|
|
renRenderDebug(r, g_polygon_select_vertices); |
|
|
|
|
|
|
|
|
|
|
|
renderGooey(r->handles, &g->grid, r->is_debug_draw, &r->cam); |
|
|
|
gooRender(r->handles, &g->grid, r->is_debug_draw, &r->cam); |
|
|
|
|
|
|
|
|
|
|
|
SDL_GL_SwapWindow(r->handles.window); |
|
|
|
SDL_GL_SwapWindow(r->handles.window); |
|
|
|
|
|
|
|
|
|
|
|
|