This is my Game.cpp file:
#include "Game.h"
bool quit = false;
// Starts the game
void Game::Start() {
if ( Game::Init() == 1 ) {
std::cout << SDL_GetError();
quit = true;
}
while( !quit ) {
if ( Game::Update() == 1 ) {
std::cout << SDL_GetError();
quit = true;
}
if ( Game::Draw() == 1 ) {
std::cout << SDL_GetError();
quit = true;
}
}
SDL_Quit();
}
int Game::Init() {
SDL_Init( SDL_INIT_EVERYTHING );
return 0;
}
int Game::Update() {
while (SDL_PollEvent( &event ) ) {
if ( event.type == SDL_QUIT ) {
quit = true;
}
}
return 0;
}
int Game::Draw() {
return 0;
}
Game::Start(); is called from main.cpp, but it quits instantly now. I hope somebody can help!
Thanks.