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

84 lines
1.5 KiB
C++
Raw Normal View History

2014-08-24 18:45:47 +01:00
/*****************************************************************************
2020-07-21 15:04:34 +02:00
* Copyright (c) 2014-2020 OpenRCT2 developers
2015-10-20 20:16:30 +02:00
*
2018-06-15 14:07:34 +02:00
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
2015-10-20 20:16:30 +02:00
*
2018-06-15 14:07:34 +02:00
* OpenRCT2 is licensed under the GNU General Public License version 3.
2014-08-24 18:45:47 +01:00
*****************************************************************************/
2017-12-12 14:52:57 +01:00
#include "Input.h"
2014-08-24 18:45:47 +01:00
2018-06-22 23:25:16 +02:00
#include "Context.h"
InputState _inputState;
uint8_t _inputFlags;
uint8_t 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;
uint16_t _tooltipNotShownTicks;
2016-01-05 00:02:23 +00:00
Tool 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)
{
2018-06-22 23:25:16 +02:00
if (on)
{
2017-06-06 23:24:18 +02:00
_inputFlags |= flag;
2018-06-22 23:25:16 +02:00
}
else
{
2017-06-06 23:24:18 +02:00
_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(InputState state)
2017-02-27 20:20:41 +01:00
{
2017-06-06 23:24:18 +02:00
_inputState = state;
2017-02-27 20:20:41 +01:00
}
InputState input_get_state()
2017-02-27 20:20:41 +01:00
{
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
}