After the program has loaded all the files it needs, it exits after a while, when it should give me a red colored screen.
Game.h
#pragma once
#include "stdafx.h"
class Game
{
public:
void start();
private:
bool isExiting();
void gameLoop();
enum GameState{uninitialized, showingSplash, paused, showMenu, playing, exiting};
GameState _gameState;
sf::RenderWindow _mainWindow;
};
Game.cpp
#include "stdafx.h"
#include "Game.h"
void Game::start()
{
if(_gameState != uninitialized)
{
return;
_mainWindow.create(sf::VideoMode(1024, 768, 32), "Pang!");
_gameState = 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;
}
}
}
}
Output
'Pang!.exe': Loaded 'C:\Users\Axel\Desktop\Pang!\Debug\Pang!.exe', Symbols loaded.
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Symbols loaded.
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Program Files (x86)\SearchProtect\SearchProtect\bin\VC32Loader.dll', Cannot find or open the PDB file
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Symbols loaded (source information stripped).
'Pang!.exe': Unloaded 'C:\Program Files (x86)\SearchProtect\SearchProtect\bin\VC32Loader.dll'
'Pang!.exe': Unloaded 'C:\Windows\SysWOW64\version.dll'
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\nvoglv32.dll', Cannot find or open the PDB file
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\ntmarta.dll', Symbols loaded (source information stripped).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\Wldap32.dll', Symbols loaded (source information stripped).
The thread 'Win32 Thread' (0xa78) has exited with code 0 (0x0).
'Pang!.exe': Loaded 'C:\Windows\SysWOW64\powrprof.dll', Symbols loaded (source information stripped).
'Pang!.exe': Unloaded 'C:\Windows\SysWOW64\powrprof.dll'
The thread 'Win32 Thread' (0xe98) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1c74) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1c9c) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1b34) has exited with code 0 (0x0).
The program '[7812] Pang!.exe: Native' has exited with code 0 (0x0).
Im following this tutorial:
http://www.gamefromscratch.com/page/Game-from-Scratch-CPP-Edition-Part-2.aspxIts a bit outdated, but the program i wrote as above works.