mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-06 06:32:56 +01:00
Split off MouseInput.h from Input.h (#22564)
* Move declarations from Input.h into new MouseInput.h * Remove unused GetNextKey function from MouseInput.cpp
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <openrct2-ui/input/InputManager.h>
|
||||
#include <openrct2-ui/input/MouseInput.h>
|
||||
#include <openrct2-ui/interface/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "windows/Window.h"
|
||||
|
||||
#include <openrct2-ui/input/InputManager.h>
|
||||
#include <openrct2-ui/input/MouseInput.h>
|
||||
#include <openrct2-ui/input/ShortcutManager.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Input.h>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <SDL.h>
|
||||
#include <openrct2-ui/UiContext.h>
|
||||
#include <openrct2-ui/input/MouseInput.h>
|
||||
#include <openrct2-ui/input/ShortcutManager.h>
|
||||
#include <openrct2-ui/interface/InGameConsole.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "MouseInput.h"
|
||||
|
||||
#include "../UiStringIds.h"
|
||||
#include "../interface/ViewportInteraction.h"
|
||||
|
||||
@@ -1106,8 +1108,6 @@ static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, WindowBase* w, W
|
||||
}
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006ED833
|
||||
@@ -1562,29 +1562,6 @@ static void InputUpdateTooltip(WindowBase* w, WidgetIndex widgetIndex, const Scr
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Keyboard input
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00406CD2
|
||||
*/
|
||||
int32_t GetNextKey()
|
||||
{
|
||||
uint8_t* keysPressed = const_cast<uint8_t*>(ContextGetKeysPressed());
|
||||
for (int32_t i = 0; i < 221; i++)
|
||||
{
|
||||
if (keysPressed[i])
|
||||
{
|
||||
keysPressed[i] = 0;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006ED990
|
||||
|
||||
31
src/openrct2-ui/input/MouseInput.h
Normal file
31
src/openrct2-ui/input/MouseInput.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2024 OpenRCT2 developers
|
||||
*
|
||||
* For a complete list of all authors, please refer to contributors.md
|
||||
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <openrct2/interface/Window.h>
|
||||
|
||||
enum class MouseState : uint32_t
|
||||
{
|
||||
Released,
|
||||
LeftPress,
|
||||
LeftRelease,
|
||||
RightPress,
|
||||
RightRelease
|
||||
};
|
||||
|
||||
extern ScreenCoordsXY gInputDragLast;
|
||||
|
||||
void InputWindowPositionBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords);
|
||||
void GameHandleInput();
|
||||
void GameHandleEdgeScroll();
|
||||
|
||||
void StoreMouseInput(MouseState state, const ScreenCoordsXY& screenCoords);
|
||||
|
||||
void InputScrollViewport(const ScreenCoordsXY& screenCoords);
|
||||
@@ -64,6 +64,7 @@
|
||||
<ClInclude Include="drawing\engines\opengl\TextureCache.h" />
|
||||
<ClInclude Include="drawing\engines\opengl\TransparencyDepth.h" />
|
||||
<ClInclude Include="input\InputManager.h" />
|
||||
<ClInclude Include="input\MouseInput.h" />
|
||||
<ClInclude Include="input\ShortcutIds.h" />
|
||||
<ClInclude Include="input\ShortcutManager.h" />
|
||||
<ClInclude Include="interface\Dropdown.h" />
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include <iterator>
|
||||
#include <openrct2-ui/input/MouseInput.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Editor.h>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "../interface/Viewport.h"
|
||||
|
||||
#include <openrct2-ui/input/MouseInput.h>
|
||||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/LandTool.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
*
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
#include "../interface/Viewport.h"
|
||||
|
||||
#include <openrct2-ui/input/MouseInput.h>
|
||||
#include <openrct2-ui/interface/LandTool.h>
|
||||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
|
||||
@@ -36,15 +36,6 @@ enum INPUT_FLAGS
|
||||
INPUT_FLAG_VIEWPORT_SCROLLING = (1 << 7)
|
||||
};
|
||||
|
||||
enum class MouseState : uint32_t
|
||||
{
|
||||
Released,
|
||||
LeftPress,
|
||||
LeftRelease,
|
||||
RightPress,
|
||||
RightRelease
|
||||
};
|
||||
|
||||
enum class InputState
|
||||
{
|
||||
Reset,
|
||||
@@ -68,8 +59,6 @@ enum PLACE_OBJECT_MODIFIER
|
||||
|
||||
extern uint8_t gInputPlaceObjectModifier;
|
||||
|
||||
extern ScreenCoordsXY gInputDragLast;
|
||||
|
||||
extern WidgetRef gHoverWidget;
|
||||
extern WidgetRef gPressedWidget;
|
||||
|
||||
@@ -82,15 +71,8 @@ extern InputState _inputState;
|
||||
extern uint8_t _inputFlags;
|
||||
extern uint32_t _tooltipNotShownTimeout;
|
||||
|
||||
void InputWindowPositionBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords);
|
||||
|
||||
void TitleHandleKeyboardInput();
|
||||
void GameHandleInput();
|
||||
void GameHandleKeyboardInput();
|
||||
void GameHandleEdgeScroll();
|
||||
int32_t GetNextKey();
|
||||
|
||||
void StoreMouseInput(MouseState state, const ScreenCoordsXY& screenCoords);
|
||||
|
||||
void InputSetFlag(INPUT_FLAGS flag, bool on);
|
||||
bool InputTestFlag(INPUT_FLAGS flag);
|
||||
@@ -104,5 +86,3 @@ InputState InputGetState();
|
||||
void ResetTooltipNotShown();
|
||||
|
||||
void InputResetPlaceObjModifier();
|
||||
|
||||
void InputScrollViewport(const ScreenCoordsXY& screenCoords);
|
||||
|
||||
Reference in New Issue
Block a user