I removed all non-essential code, but try these 3 files
main:
[
#include "Game.h"
#include <stdlib.h>
#include <time.h>
//DEBUG CODE
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#define DEBUG_NEW new(_CLIENT_BLOCK, __FILE__, __LINE__)
#define new DEBUG_NEW
#endif
int main()
{
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
std::unique_ptr<Game> game(new Game());
srand(time(NULL));
game->Run();
return EXIT_SUCCESS;
}
Game.h
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <sstream>
#include <cmath>
#include <iostream>
class Game
{
public:
Game();
~Game();
void Run();
private:
std::unique_ptr<sf::RenderWindow> window;
//Loading Thread
std::unique_ptr<sf::Thread> CharLoadThread;
};
and Game.cpp
#include "Game.h"
Game::Game()
{
screenSize = sf::Vector2f(1024,768);
window = std::unique_ptr<sf::RenderWindow>(new sf::RenderWindow(sf::VideoMode(static_cast<int>(screenSize.x), static_cast<int>(screenSize.y)), "Re:Volved ver 0.0.04a", sf::Style::Close));
window->setKeyRepeatEnabled(false);
//LoadCharacter();
CharLoadThread = std::unique_ptr<sf::Thread>(new sf::Thread(&Game::LoadCharacter, this));
CharLoadThread->launch();
}
Game::~Game()
{
}
void Game::LoadCharacter()
{
std::cout << "Start Loading\n";
//groundMap = std::make_shared<Map>(MainCamera);
//groundMap->Read();
std::cout << "Map Read\n";
//charDef = std::unique_ptr<CharDef>(new CharDef("skeleton"));
std::cout << "CharDef Loaded\n";
//character = std::unique_ptr<Character>(new Character(sf::Vector2f(500.f, 100.f), *charDef, 0));
std::cout << "Character Loaded\n";
//character->BodypartsInit();
std::cout << "Character Bodyparts Loaded\n";
//enemy = std::unique_ptr<Enemy>(new Enemy(sf::Vector2f(800.f, 100.f), *charDef, 1));
std::cout << "Enemy Loaded\n";
//enemy->BodypartsInit();
std::cout << "Enemy BodyParts Loaded\n";
//sf::Context context;
Loaded = true;
}
void Game::Run()
{
sf::Clock clock;
sf::Time timeSinceLastUpdate = sf::Time::Zero;
static const sf::Time timePerFrame = sf::seconds(1.f / 60.f);
fpsText.setFont(fpsFont);
while (window->isOpen())
{
timeSinceLastUpdate += clock.restart();
while(timeSinceLastUpdate > timePerFrame)
{
timeSinceLastUpdate -= timePerFrame;
std::cout << "Updating\n";
}
}
}
Let me know if this causes any problems for you, I think I have everything in there.