Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Cave-Crawler/main1.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
29 lines (23 sloc)
670 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "GameManager.h" | |
GameManager *gameManager = nullptr; | |
int main(int argc,const char * argv[]) { | |
const int FPS = 60; | |
const int frameDelay = 1000 / FPS; | |
Uint32 frameStart; | |
int frameTime; | |
gameManager = new GameManager(); | |
gameManager->init("Cave Crawler", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, false); | |
while (gameManager->running()) { | |
frameStart = SDL_GetTicks(); | |
gameManager->handleEvents(); | |
gameManager->update(); | |
gameManager->renderer(); | |
frameTime = SDL_GetTicks() - frameStart; | |
if (frameDelay > frameTime) | |
{ | |
SDL_Delay(frameDelay - frameTime); | |
} | |
} | |
gameManager->clean(); | |
return 0; | |
} |