X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fstandalone%2FMasterState.cpp;h=9cc154387e3f6becb55bf756b5df29606514f2fd;hb=80a9a59d71a7b144c12f64cbef4644751bd54745;hp=0744a7c52260e36f221e033421957ef1b7a15d45;hpb=1d225566f79566e2dbbad8cb2876696f4c074ff5;p=blank.git diff --git a/src/standalone/MasterState.cpp b/src/standalone/MasterState.cpp index 0744a7c..9cc1543 100644 --- a/src/standalone/MasterState.cpp +++ b/src/standalone/MasterState.cpp @@ -67,19 +67,30 @@ MasterState::~MasterState() { void MasterState::OnResume() { if (spawn_index.MissingChunks() > 0) { env.state.Push(&preload); - } - if (config.input.mouse) { - env.window.GrabMouse(); + return; } if (spawn_player) { // TODO: spawn spawn_player = false; } hud.KeepMessages(false); + OnFocus(); } void MasterState::OnPause() { + OnBlur(); +} + +void MasterState::OnFocus() { + if (config.input.mouse) { + env.window.GrabMouse(); + } + interface.Unlock(); +} + +void MasterState::OnBlur() { env.window.ReleaseMouse(); + interface.Lock(); } @@ -196,7 +207,9 @@ void MasterState::Exit() { } void MasterState::OnLineSubmit(const std::string &line) { - hud.PostMessage(line); + if (!line.empty()) { + hud.PostMessage(line); + } } }