2016-05-04 19:24:41 +02:00
|
|
|
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
2014-08-24 19:45:47 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
|
|
|
*
|
2016-05-04 19:24:41 +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
|
2014-08-24 19:45:47 +02: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.
|
2016-05-04 19:24:41 +02:00
|
|
|
*
|
|
|
|
* A full copy of the GNU General Public License can be found in licence.txt
|
2014-08-24 19:45:47 +02:00
|
|
|
*****************************************************************************/
|
2016-05-04 19:24:41 +02:00
|
|
|
#pragma endregion
|
2014-08-24 19:45:47 +02:00
|
|
|
|
|
|
|
#ifndef _INPUT_H_
|
|
|
|
#define _INPUT_H_
|
|
|
|
|
2014-12-16 02:24:13 +01:00
|
|
|
#include "interface/window.h"
|
|
|
|
|
2017-02-27 20:20:41 +01:00
|
|
|
typedef enum INPUT_FLAGS {
|
2014-10-15 23:59:26 +02:00
|
|
|
INPUT_FLAG_WIDGET_PRESSED = (1 << 0),
|
|
|
|
|
2015-05-07 20:31:11 +02:00
|
|
|
// The dropdown can stay open if the mouse is released, set on flag DROPDOWN_FLAG_STAY_OPEN
|
|
|
|
INPUT_FLAG_DROPDOWN_STAY_OPEN = (1 << 1),
|
2014-10-15 23:59:26 +02:00
|
|
|
|
2015-05-07 20:31:11 +02:00
|
|
|
// The mouse has been released and the dropdown is still open
|
|
|
|
// INPUT_FLAG_DROPDOWN_STAY_OPEN is already set if this happens
|
|
|
|
INPUT_FLAG_DROPDOWN_MOUSE_UP = (1 << 2),
|
2014-10-15 23:59:26 +02:00
|
|
|
|
|
|
|
INPUT_FLAG_TOOL_ACTIVE = (1 << 3),
|
|
|
|
|
|
|
|
// Left click on a viewport
|
|
|
|
INPUT_FLAG_4 = (1 << 4),
|
|
|
|
|
|
|
|
INPUT_FLAG_5 = (1 << 5),
|
|
|
|
|
|
|
|
// Some of the map tools (clear, footpath, scenery)
|
|
|
|
// never read as far as I know.
|
|
|
|
INPUT_FLAG_6 = (1 << 6),
|
|
|
|
|
|
|
|
INPUT_FLAG_VIEWPORT_SCROLLING = (1 << 7)
|
2017-02-27 20:20:41 +01:00
|
|
|
} INPUT_FLAGS;
|
2016-01-05 23:33:47 +01:00
|
|
|
|
2016-09-05 21:50:33 +02:00
|
|
|
enum MOUSE_STATE {
|
|
|
|
MOUSE_STATE_RELEASED,
|
|
|
|
MOUSE_STATE_LEFT_PRESS,
|
|
|
|
MOUSE_STATE_LEFT_RELEASE,
|
|
|
|
MOUSE_STATE_RIGHT_PRESS,
|
|
|
|
MOUSE_STATE_RIGHT_RELEASE
|
|
|
|
};
|
|
|
|
|
2017-02-27 20:20:41 +01:00
|
|
|
typedef enum INPUT_STATE {
|
|
|
|
INPUT_STATE_RESET,
|
|
|
|
INPUT_STATE_NORMAL,
|
|
|
|
INPUT_STATE_WIDGET_PRESSED,
|
|
|
|
INPUT_STATE_POSITIONING_WINDOW,
|
|
|
|
INPUT_STATE_VIEWPORT_RIGHT,
|
|
|
|
INPUT_STATE_DROPDOWN_ACTIVE,
|
|
|
|
INPUT_STATE_VIEWPORT_LEFT,
|
|
|
|
INPUT_STATE_SCROLL_LEFT,
|
|
|
|
INPUT_STATE_RESIZING,
|
|
|
|
INPUT_STATE_SCROLL_RIGHT
|
|
|
|
} INPUT_STATE;
|
|
|
|
|
|
|
|
typedef enum PLACE_OBJECT_MODIFIER {
|
|
|
|
PLACE_OBJECT_MODIFIER_NONE = 0,
|
|
|
|
PLACE_OBJECT_MODIFIER_SHIFT_Z = (1 << 0),
|
|
|
|
PLACE_OBJECT_MODIFIER_COPY_Z = (1 << 1),
|
|
|
|
} PLACE_OBJECT_MODIFIER;
|
|
|
|
|
2016-05-12 23:57:40 +02:00
|
|
|
typedef struct widget_ref {
|
2016-01-05 01:02:23 +01:00
|
|
|
rct_windowclass window_classification;
|
|
|
|
rct_windownumber window_number;
|
2016-01-06 00:16:09 +01:00
|
|
|
rct_widgetindex widget_index;
|
2016-01-05 01:02:23 +01:00
|
|
|
} widget_ref;
|
|
|
|
|
2016-01-05 23:33:47 +01:00
|
|
|
extern uint8 gInputPlaceObjectModifier;
|
2016-01-04 23:45:51 +01:00
|
|
|
|
2016-01-06 19:31:25 +01:00
|
|
|
extern sint32 gInputDragLastX;
|
|
|
|
extern sint32 gInputDragLastY;
|
|
|
|
|
2016-01-05 23:05:00 +01:00
|
|
|
extern widget_ref gHoverWidget;
|
2016-01-05 22:46:38 +01:00
|
|
|
extern widget_ref gPressedWidget;
|
|
|
|
|
2016-01-05 01:02:23 +01:00
|
|
|
extern uint16 gTooltipTimeout;
|
|
|
|
extern widget_ref gTooltipWidget;
|
|
|
|
extern sint32 gTooltipCursorX;
|
|
|
|
extern sint32 gTooltipCursorY;
|
|
|
|
|
2017-05-03 15:57:17 +02:00
|
|
|
extern TOOL_IDX gCurrentToolId;
|
2016-04-15 19:26:47 +02:00
|
|
|
extern widget_ref gCurrentToolWidget;
|
|
|
|
|
2017-02-27 20:20:41 +01:00
|
|
|
void input_window_position_begin(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y);
|
|
|
|
|
2014-11-24 18:18:21 +01:00
|
|
|
void title_handle_keyboard_input();
|
2014-08-24 19:45:47 +02:00
|
|
|
void game_handle_input();
|
|
|
|
void game_handle_keyboard_input();
|
|
|
|
|
2017-01-04 22:17:08 +01:00
|
|
|
void store_mouse_input(sint32 state, sint32 x, sint32 y);
|
2014-08-29 10:23:57 +02:00
|
|
|
|
2017-02-27 20:20:41 +01:00
|
|
|
void input_set_flag(INPUT_FLAGS flag, bool on);
|
|
|
|
bool input_test_flag(INPUT_FLAGS flag);
|
|
|
|
void input_reset_flags();
|
|
|
|
|
|
|
|
bool input_test_place_object_modifier(PLACE_OBJECT_MODIFIER modifier);
|
|
|
|
|
|
|
|
void input_set_state(INPUT_STATE state);
|
|
|
|
INPUT_STATE input_get_state();
|
|
|
|
|
|
|
|
void reset_tooltip_not_shown();
|
|
|
|
|
|
|
|
void input_reset_place_obj_modifier();
|
2014-12-16 02:24:13 +01:00
|
|
|
|
2015-12-21 05:03:37 +01:00
|
|
|
#endif
|