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).
|
||||
*/
|
||||
Game::Game(const Vector2i& resolution) :
|
||||
Game::Game(sf::RenderWindow& window) :
|
||||
mWorld(b2Vec2(0, 0)),
|
||||
mWindow(sf::VideoMode(resolution.x, resolution.y, 32), "Roguelike Shooter",
|
||||
sf::Style::Close | sf::Style::Titlebar),
|
||||
mView(Vector2f(0, 0), Vector2f(resolution)),
|
||||
mWindow(window),
|
||||
mView(Vector2f(0, 0), mWindow.getView().getSize()),
|
||||
//mFps("test"),
|
||||
mTileManager(mWorld),
|
||||
mPathfinder(mWorld),
|
||||
|
|
|
@ -29,7 +29,7 @@ class Collection;
|
|||
class Game : private sf::NonCopyable, public b2ContactListener {
|
||||
// Public functions.
|
||||
public:
|
||||
Game(const Vector2i& resolution);
|
||||
Game(sf::RenderWindow& window);
|
||||
~Game();
|
||||
|
||||
void loop();
|
||||
|
@ -56,7 +56,7 @@ private:
|
|||
|
||||
b2World mWorld;
|
||||
|
||||
sf::RenderWindow mWindow;
|
||||
sf::RenderWindow& mWindow;
|
||||
sf::Clock mClock;
|
||||
sf::View mView;
|
||||
//sf::Text mFps;
|
||||
|
|
|
@ -15,7 +15,10 @@ int main(int argc, char* argv[]) {
|
|||
Loader::i().setFolder("resources/");
|
||||
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();
|
||||
|
||||
|
|
Reference in a new issue