[InterfaceState] Now updates parent. This fixes a problem where client froze the game when in pause menu or chat.

This commit is contained in:
Quentin Bazin 2020-02-25 10:03:56 +09:00
parent 7a28b8bf49
commit 27fb5e935a
9 changed files with 8 additions and 17 deletions

View File

@ -41,8 +41,6 @@ class ChatState : public InterfaceState {
void onEvent(const SDL_Event &event) override;
void update() override;
private:
void draw(gk::RenderTarget &target, gk::RenderStates states) const override;

View File

@ -39,6 +39,8 @@ class InterfaceState : public gk::ApplicationState {
void setup();
void onEvent(const SDL_Event &event) override;
void update() override;
void prepareDraw(gk::RenderTarget &target, gk::RenderStates &states) const;
bool m_drawBackground = true;

View File

@ -40,8 +40,6 @@ class PauseMenuState : public InterfaceState {
void onEvent(const SDL_Event &event) override;
void update() override;
private:
void draw(gk::RenderTarget &target, gk::RenderStates states) const override;

View File

@ -39,8 +39,6 @@ class SettingsMenuState : public InterfaceState {
void onEvent(const SDL_Event &event) override;
void update() override;
private:
void doneButtonAction();

View File

@ -91,9 +91,6 @@ void ChatState::onEvent(const SDL_Event &event) {
}
}
void ChatState::update() {
}
void ChatState::draw(gk::RenderTarget &target, gk::RenderStates states) const {
if (m_parent)
target.draw(*m_parent, states);

View File

@ -62,6 +62,11 @@ void InterfaceState::onEvent(const SDL_Event &event) {
}
}
void InterfaceState::update() {
if (m_parent)
m_parent->update();
}
void InterfaceState::prepareDraw(gk::RenderTarget &target, gk::RenderStates &states) const {
states.transform *= getTransform();
states.shader = &m_shader;

View File

@ -79,8 +79,7 @@ void LuaGUIState::onEvent(const SDL_Event &event) {
}
void LuaGUIState::update() {
if (m_parent)
m_parent->update();
InterfaceState::update();
for (auto &it : m_widgets)
it->update();

View File

@ -91,9 +91,6 @@ void PauseMenuState::onEvent(const SDL_Event &event) {
}
}
void PauseMenuState::update() {
}
void PauseMenuState::draw(gk::RenderTarget &target, gk::RenderStates states) const {
if (m_parent)
target.draw(*m_parent, states);

View File

@ -78,9 +78,6 @@ void SettingsMenuState::onEvent(const SDL_Event &event) {
}
}
void SettingsMenuState::update() {
}
void SettingsMenuState::doneButtonAction() {
if (m_state != MenuState::Main) {
m_state = MenuState::Main;