Files
OpenRCT2-Web/src/openrct2/Input.cpp
T

87 lines
1.8 KiB
C++
Raw Normal View History

2017-06-01 21:55:10 +02:00
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
2014-08-24 18:45:47 +01:00
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
2015-10-20 20:16:30 +02:00
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
2015-10-20 20:16:30 +02:00
*
2014-08-24 18:45:47 +01:00
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
2014-08-24 18:45:47 +01:00
*****************************************************************************/
#pragma endregion
2014-08-24 18:45:47 +01:00
2017-03-25 14:57:02 +00:00
#include "Context.h"
2017-12-12 14:52:57 +01:00
#include "Input.h"
2014-08-24 18:45:47 +01:00
2017-12-07 22:16:20 +01:00
INPUT_STATE _inputState;
uint8 _inputFlags;
uint8 gInputPlaceObjectModifier;
2016-01-04 22:45:51 +00:00
2016-01-05 22:05:00 +00:00
widget_ref gHoverWidget;
2016-01-05 21:46:38 +00:00
widget_ref gPressedWidget;
2017-12-07 22:16:20 +01:00
uint16 _tooltipNotShownTicks;
2016-01-05 00:02:23 +00:00
2017-05-03 15:57:17 +02:00
TOOL_IDX gCurrentToolId;
2016-04-15 18:26:47 +01:00
widget_ref gCurrentToolWidget;
2017-06-11 16:31:54 +01:00
/**
*
* rct2: 0x006E3B43
*/
void title_handle_keyboard_input()
{
2017-06-11 19:04:50 +01:00
context_input_handle_keyboard(true);
2017-06-11 16:31:54 +01:00
}
/**
*
* rct2: 0x006E3B43
*/
void game_handle_keyboard_input()
{
2017-06-11 19:04:50 +01:00
context_input_handle_keyboard(false);
2017-06-11 16:31:54 +01:00
}
2017-02-27 20:20:41 +01:00
void input_set_flag(INPUT_FLAGS flag, bool on)
{
2017-06-06 23:24:18 +02:00
if (on) {
_inputFlags |= flag;
} else {
_inputFlags &= ~flag;
}
2017-02-27 20:20:41 +01:00
}
bool input_test_flag(INPUT_FLAGS flag)
{
2017-06-06 23:24:18 +02:00
return _inputFlags & flag;
2017-02-27 20:20:41 +01:00
}
void input_reset_flags()
{
2017-06-06 23:24:18 +02:00
_inputFlags = 0;
2017-02-27 20:20:41 +01:00
}
void input_set_state(INPUT_STATE state)
{
2017-06-06 23:24:18 +02:00
_inputState = state;
2017-02-27 20:20:41 +01:00
}
INPUT_STATE input_get_state()
{
2017-06-06 23:24:18 +02:00
return _inputState;
2017-02-27 20:20:41 +01:00
}
void reset_tooltip_not_shown()
{
2017-06-06 23:24:18 +02:00
_tooltipNotShownTicks = 0;
2017-02-27 20:20:41 +01:00
}
void input_reset_place_obj_modifier()
{
2017-06-06 23:24:18 +02:00
gInputPlaceObjectModifier = PLACE_OBJECT_MODIFIER_NONE;
2018-03-13 13:14:02 +01:00
}