I know i have posted VERY similar code before, but i accidently deleted the project i was working in, so i had to redo the tutorial. Also, the error is completely different from what i can tell.
Bascially, when i try to make the screen red, its white instead, like if i didnt give it a color.
Game.cpp
#include "stdafx.h"
#include "Game.h"
Game::Game()
{
sf::RenderWindow _mainWindow(sf::VideoMode(1024, 768, 32), "Pang!");
_gameState = uninitialized;
start();
}
void Game::start(void)
{
if(_gameState != uninitialized)
return;
_gameState = Game::playing;
while(!isExiting())
{
gameLoop();
}
_mainWindow.close();
}
bool Game::isExiting()
{
if(_gameState == exiting)
{
return true;
}
else
{
return false;
}
}
void Game::gameLoop()
{
sf::Event currentEvent;
while(_mainWindow.pollEvent(currentEvent))
{
switch(_gameState)
{
case playing:
_mainWindow.clear(sf::Color::Red);
_mainWindow.display();
if(currentEvent.type == sf::Event::Closed)
{
_gameState = exiting;
}
}
}
}
Game.h
#include "stdafx.h"
class Game
{
public:
Game();
void start();
private:
bool isExiting();
void gameLoop();
enum GameState{uninitialized, showingSplash, paused, showingMenu, playing, exiting};
GameState _gameState;
sf::RenderWindow _mainWindow;
};
When i debug, it stops at
while(_mainWindow.pollEvent(currentEvent))