forked from NaiJi/project-kyoku
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++
#include "gamestate.h"
|
|
#include "widgets/button.h"
|
|
#include "widgets/group.h"
|
|
|
|
#include "game/game.h"
|
|
|
|
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});
|
|
}
|
|
|
|
void GameState::update(const sf::Time& dt)
|
|
{
|
|
(void)dt;
|
|
// !!!!!!!!!!!!!!!!!!!!!!
|
|
// TODO.
|
|
//
|
|
// Oh dude... hang in there
|
|
_game->update();
|
|
}
|
|
|
|
void GameState::draw() const
|
|
{
|
|
_game->draw();
|
|
}
|
|
|
|
void GameState::enter()
|
|
{
|
|
_game->run();
|
|
}
|
|
|
|
void GameState::leave()
|
|
{
|
|
_onLeaveGameCallback();
|
|
}
|