From b53826079429939cdfbda073608cb85be8ba0738 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 7 Mar 2015 11:29:57 -0500 Subject: Created entity-component system Also tweaked the bloom flicker, tweaked the scanline texture, created a second test map, and created some currently unused sound effects. --- src/main.cpp | 67 ++---------------------------------------------------------- 1 file changed, 2 insertions(+), 65 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index bc7832d..c552d2a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,77 +1,14 @@ #include #include -#include "map.h" -#include "state.h" -#include "mapview.h" #include "renderer.h" #include - -using namespace::std; - -bool quit = false; - -State* curGameState; - -void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if ((key == GLFW_KEY_ESCAPE) && (action == GLFW_PRESS)) - { - quit = true; - } - - if (curGameState != NULL) - { - curGameState->input(key, action); - } -} +#include "game.h" int main() { srand(time(NULL)); - GLFWwindow* window = initRenderer(); - glfwSwapInterval(1); - glfwSetKeyCallback(window, key_callback); - - Map* m = new Map("../maps/embarass.txt"); - //Map* m2 = new Map("../maps/cozy.txt"); - - //m->setLeftMap(m2); - //m2->setRightMap(m); - - curGameState = new MapView(m, 100, 100); - - Texture* buffer = createTexture(GAME_WIDTH, GAME_HEIGHT); - //Texture* buffer = loadTextureFromBMP("../res/title.png"); - - double lastTime = glfwGetTime(); - int nbFrames = 0; - - while (!(quit || glfwWindowShouldClose(window))) - { - double currentTime = glfwGetTime(); - nbFrames++; - if (currentTime - lastTime >= 1.0) - { - // printf and reset timer - printf("%f ms/frame\n", 1000.0/double(nbFrames)); - nbFrames = 0; - lastTime += 1.0; - } - - curGameState->tick(); - - // Do rendering - curGameState->render(buffer); - renderScreen(buffer); - - glfwPollEvents(); - } - - delete curGameState; - delete m; - - destroyRenderer(); + Game::getInstance().execute(); return 0; } -- cgit 1.4.1