mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 03:12:36 +01:00
43 lines
969 B
C++
43 lines
969 B
C++
#include "LoadingState.hpp"
|
|
#include "RWGame.hpp"
|
|
|
|
LoadingState::LoadingState(RWGame* game, const std::function<void(void)>& callback)
|
|
: State(game), complete(callback) {
|
|
}
|
|
|
|
void LoadingState::enter() {
|
|
game->newGame();
|
|
}
|
|
|
|
void LoadingState::exit() {
|
|
}
|
|
|
|
void LoadingState::tick(float dt) {
|
|
RW_UNUSED(dt);
|
|
|
|
done();
|
|
complete();
|
|
}
|
|
|
|
bool LoadingState::shouldWorldUpdate() {
|
|
return false;
|
|
}
|
|
|
|
void LoadingState::handleEvent(const SDL_Event& e) {
|
|
State::handleEvent(e);
|
|
}
|
|
|
|
void LoadingState::draw(GameRenderer& r) {
|
|
static auto kLoadingString =
|
|
GameStringUtil::fromString("Loading...", FONT_ARIAL);
|
|
// Display some manner of loading screen.
|
|
TextRenderer::TextInfo ti;
|
|
ti.text = kLoadingString;
|
|
auto size = r.getRenderer().getViewport();
|
|
ti.size = 25.f;
|
|
ti.screenPosition = glm::vec2(50.f, size.y - ti.size - 50.f);
|
|
ti.font = FONT_PRICEDOWN;
|
|
ti.baseColour = glm::u8vec3(255);
|
|
r.text.renderText(ti);
|
|
}
|