1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 23:34:37 +01:00

Rework modifier key state into strong enum class (#22558)

* Rework modifier key state into strong enum class

* Move modifier key state into InputManager
This commit is contained in:
Aaron van Geffen
2024-08-14 16:36:05 +02:00
committed by GitHub
parent 0c97e44be0
commit 2a99b2f1f9
12 changed files with 74 additions and 65 deletions

View File

@@ -7,8 +7,9 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "../interface/Theme.h"
#include <openrct2-ui/UiContext.h>
#include <openrct2-ui/input/InputManager.h>
#include <openrct2-ui/interface/Theme.h>
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/windows/Window.h>
#include <openrct2/Context.h>
@@ -96,10 +97,9 @@ static Widget window_map_tooltip_widgets[] = {
StringId stringId;
std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(StringId));
if (_cursorHoldDuration < 25 || stringId == STR_NONE
|| InputTestPlaceObjectModifier(
static_cast<PLACE_OBJECT_MODIFIER>(PLACE_OBJECT_MODIFIER_COPY_Z | PLACE_OBJECT_MODIFIER_SHIFT_Z))
|| WindowFindByClass(WindowClass::Error) != nullptr)
auto& im = GetInputManager();
if (_cursorHoldDuration < 25 || stringId == STR_NONE || im.IsModifierKeyPressed(ModifierKey::ctrl)
|| im.IsModifierKeyPressed(ModifierKey::shift) || WindowFindByClass(WindowClass::Error) != nullptr)
{
WindowCloseByClass(WindowClass::MapTooltip);
}