This repository has been archived on 2022-12-14. You can view files and clone it, but cannot push or open issues or pull requests.
WaveGGJ17/VaporWaveWars/game.cpp
2017-01-21 20:55:12 +01:00

35 lines
811 B
C++

#include "game.hpp"
Game* Game::instance = nullptr;
Game::Game() {
ASSERT(Game::instance == nullptr); //Two games created
Game::instance = this;
isRunning = true;
}
Game::~Game() {
isRunning = false;
Game::instance = nullptr;
}
Game* Game::i() {
return Game::instance;
}
// Main game loop
void Game::run() {
sf::Clock c;
sf::RenderWindow window(sf::VideoMode(W_WIDTH, W_HEIGHT), "( ( ( Radio Waves ) ) )");
window.setKeyRepeatEnabled(false);
float oldTime = c.getElapsedTime().asSeconds();
while (isRunning) {
float time = c.getElapsedTime().asSeconds();
float deltaTime = time-oldTime;
oldTime = time;
//std::cout << deltaTime << std::endl;
update(deltaTime, &window);
draw( &window);
}
window.close();
}