You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
738 B
C++
43 lines
738 B
C++
3 years ago
|
#include "gamestate.h"
|
||
|
#include "widgets/button.h"
|
||
|
#include "widgets/group.h"
|
||
|
|
||
3 years ago
|
#include "core/game.h"
|
||
3 years ago
|
|
||
|
GameState::GameState(sf::RenderWindow& game_window, const std::shared_ptr<Game>& game,
|
||
|
Callbacks&& callbacks) :
|
||
|
_game(game),
|
||
|
_game_window(game_window),
|
||
|
_onLeaveGameCallback(callbacks.onLeaveGame)
|
||
|
{}
|
||
|
|
||
|
void GameState::input(const sf::Event& event)
|
||
|
{
|
||
|
_game->input({0, event});
|
||
|
}
|
||
|
|
||
3 years ago
|
void GameState::update(const sf::Time& dt)
|
||
3 years ago
|
{
|
||
3 years ago
|
(void)dt;
|
||
|
// !!!!!!!!!!!!!!!!!!!!!!
|
||
|
// TODO.
|
||
|
//
|
||
|
// Oh dude... hang in there
|
||
3 years ago
|
_game->update();
|
||
|
}
|
||
|
|
||
|
void GameState::draw() const
|
||
|
{
|
||
|
_game->draw();
|
||
|
}
|
||
|
|
||
|
void GameState::enter()
|
||
|
{
|
||
|
_game->run();
|
||
|
}
|
||
|
|
||
|
void GameState::leave()
|
||
|
{
|
||
|
_onLeaveGameCallback();
|
||
|
}
|