Moved window creation to main().
This commit is contained in:
parent
178a040f54
commit
a5386c7682
3 changed files with 9 additions and 7 deletions
|
@ -25,11 +25,10 @@ const float Game::TICKS_GOAL = 1000 / Game::FPS_GOAL;
|
||||||
/**
|
/**
|
||||||
* Initializes game, including window and objects (sprites).
|
* Initializes game, including window and objects (sprites).
|
||||||
*/
|
*/
|
||||||
Game::Game(const Vector2i& resolution) :
|
Game::Game(sf::RenderWindow& window) :
|
||||||
mWorld(b2Vec2(0, 0)),
|
mWorld(b2Vec2(0, 0)),
|
||||||
mWindow(sf::VideoMode(resolution.x, resolution.y, 32), "Roguelike Shooter",
|
mWindow(window),
|
||||||
sf::Style::Close | sf::Style::Titlebar),
|
mView(Vector2f(0, 0), mWindow.getView().getSize()),
|
||||||
mView(Vector2f(0, 0), Vector2f(resolution)),
|
|
||||||
//mFps("test"),
|
//mFps("test"),
|
||||||
mTileManager(mWorld),
|
mTileManager(mWorld),
|
||||||
mPathfinder(mWorld),
|
mPathfinder(mWorld),
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Collection;
|
||||||
class Game : private sf::NonCopyable, public b2ContactListener {
|
class Game : private sf::NonCopyable, public b2ContactListener {
|
||||||
// Public functions.
|
// Public functions.
|
||||||
public:
|
public:
|
||||||
Game(const Vector2i& resolution);
|
Game(sf::RenderWindow& window);
|
||||||
~Game();
|
~Game();
|
||||||
|
|
||||||
void loop();
|
void loop();
|
||||||
|
@ -56,7 +56,7 @@ private:
|
||||||
|
|
||||||
b2World mWorld;
|
b2World mWorld;
|
||||||
|
|
||||||
sf::RenderWindow mWindow;
|
sf::RenderWindow& mWindow;
|
||||||
sf::Clock mClock;
|
sf::Clock mClock;
|
||||||
sf::View mView;
|
sf::View mView;
|
||||||
//sf::Text mFps;
|
//sf::Text mFps;
|
||||||
|
|
|
@ -15,7 +15,10 @@ int main(int argc, char* argv[]) {
|
||||||
Loader::i().setFolder("resources/");
|
Loader::i().setFolder("resources/");
|
||||||
Loader::i().setSubFolder<sf::Texture>("textures/");
|
Loader::i().setSubFolder<sf::Texture>("textures/");
|
||||||
|
|
||||||
Game game(Vector2i(800, 600));
|
sf::RenderWindow window(sf::VideoMode(800, 600, 32), "Dungeon Gunner",
|
||||||
|
sf::Style::Close | sf::Style::Titlebar);
|
||||||
|
|
||||||
|
Game game(window);
|
||||||
|
|
||||||
game.loop();
|
game.loop();
|
||||||
|
|
||||||
|
|
Reference in a new issue