2013-12-12 11:58:14 +01:00
|
|
|
#ifndef _TESTGLOBABLS_HPP_
|
|
|
|
#define _TESTGLOBABLS_HPP_
|
|
|
|
|
|
|
|
#include <SFML/Window.hpp>
|
2013-12-20 17:02:46 +01:00
|
|
|
#include <engine/GameWorld.hpp>
|
2013-12-12 11:58:14 +01:00
|
|
|
|
2014-05-25 23:30:50 +02:00
|
|
|
#define ENV_GAME_PATH_NAME ("OPENRW_GAME_PATH")
|
2013-12-12 11:58:14 +01:00
|
|
|
|
|
|
|
class Global
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sf::Window wnd;
|
2013-12-20 17:02:46 +01:00
|
|
|
GameWorld* e;
|
2013-12-12 11:58:14 +01:00
|
|
|
|
|
|
|
Global() {
|
|
|
|
wnd.create(sf::VideoMode(640, 360), "Testing");
|
|
|
|
glewExperimental = GL_TRUE;
|
|
|
|
glewInit();
|
2014-05-25 23:30:50 +02:00
|
|
|
e = new GameWorld(getGamePath());
|
2014-02-28 12:23:51 +01:00
|
|
|
|
|
|
|
e->gameData.loadIMG("/models/gta3");
|
|
|
|
e->load();
|
|
|
|
for(std::map<std::string, std::string>::iterator it = e->gameData.ideLocations.begin();
|
|
|
|
it != e->gameData.ideLocations.end();
|
|
|
|
++it) {
|
|
|
|
e->defineItems(it->second);
|
|
|
|
}
|
2013-12-12 11:58:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
~Global() {
|
|
|
|
wnd.close();
|
2014-02-28 12:23:51 +01:00
|
|
|
delete e;
|
2013-12-12 11:58:14 +01:00
|
|
|
}
|
2014-05-25 23:30:50 +02:00
|
|
|
|
|
|
|
static std::string getGamePath()
|
|
|
|
{
|
|
|
|
// TODO: Is this "the way to do it" on windows.
|
|
|
|
auto v = getenv(ENV_GAME_PATH_NAME);
|
|
|
|
return v ? v : "";
|
|
|
|
}
|
2013-12-12 11:58:14 +01:00
|
|
|
|
|
|
|
static Global& get()
|
|
|
|
{
|
|
|
|
static Global g;
|
|
|
|
return g;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-02-28 12:23:51 +01:00
|
|
|
#endif
|