Fixes
This commit is contained in:
@ -62,10 +62,8 @@ namespace ia::iae
|
|||||||
|
|
||||||
Vec2 InputManager::GetAxis()
|
Vec2 InputManager::GetAxis()
|
||||||
{
|
{
|
||||||
return Vec2{
|
return Vec2{IsKeyDown(s_axisInputs[3]) + IsKeyDown(s_axisInputs[2]) * -1,
|
||||||
IsKeyDown(s_axisInputs[3]) + IsKeyDown(s_axisInputs[2]) * -1,
|
IsKeyDown(s_axisInputs[1]) + IsKeyDown(s_axisInputs[0]) * -1};
|
||||||
IsKeyDown(s_axisInputs[1]) + IsKeyDown(s_axisInputs[0]) * -1
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID InputManager::SwitchModeToText()
|
VOID InputManager::SwitchModeToText()
|
||||||
@ -155,6 +153,39 @@ namespace ia::iae
|
|||||||
s_axisInputs[2] = leftKey;
|
s_axisInputs[2] = leftKey;
|
||||||
s_axisInputs[3] = rightKey;
|
s_axisInputs[3] = rightKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID InputManager::SetKey(IN InputKey key, IN BOOL state)
|
||||||
|
{
|
||||||
|
s_keys[(UINT8) key] = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID InputManager::SetAxis(IN BOOL up, IN BOOL down, IN BOOL left, IN BOOL right)
|
||||||
|
{
|
||||||
|
s_keys[(UINT8) s_axisInputs[0]] = up;
|
||||||
|
s_keys[(UINT8) s_axisInputs[1]] = down;
|
||||||
|
s_keys[(UINT8) s_axisInputs[2]] = left;
|
||||||
|
s_keys[(UINT8) s_axisInputs[3]] = right;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID InputManager::SetAxisUp(IN BOOL v)
|
||||||
|
{
|
||||||
|
s_keys[(UINT8) s_axisInputs[0]] = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID InputManager::SetAxisDown(IN BOOL v)
|
||||||
|
{
|
||||||
|
s_keys[(UINT8) s_axisInputs[1]] = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID InputManager::SetAxisLeft(IN BOOL v)
|
||||||
|
{
|
||||||
|
s_keys[(UINT8) s_axisInputs[2]] = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID InputManager::SetAxisRight(IN BOOL v)
|
||||||
|
{
|
||||||
|
s_keys[(UINT8) s_axisInputs[3]] = v;
|
||||||
|
}
|
||||||
} // namespace ia::iae
|
} // namespace ia::iae
|
||||||
|
|
||||||
namespace ia::iae
|
namespace ia::iae
|
||||||
@ -233,4 +264,34 @@ namespace ia::iae
|
|||||||
{
|
{
|
||||||
InputManager::BindAxis(upKey, downKey, leftKey, rightKey);
|
InputManager::BindAxis(upKey, downKey, leftKey, rightKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID Engine::SetKey(IN InputKey key, IN BOOL state)
|
||||||
|
{
|
||||||
|
InputManager::SetKey(key, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID Engine::SetAxis(IN BOOL up, IN BOOL down, IN BOOL left, IN BOOL right)
|
||||||
|
{
|
||||||
|
InputManager::SetAxis(up, down, left, right);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID Engine::SetAxisUp(IN BOOL v)
|
||||||
|
{
|
||||||
|
InputManager::SetAxisUp(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID Engine::SetAxisDown(IN BOOL v)
|
||||||
|
{
|
||||||
|
InputManager::SetAxisDown(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID Engine::SetAxisLeft(IN BOOL v)
|
||||||
|
{
|
||||||
|
InputManager::SetAxisLeft(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID Engine::SetAxisRight(IN BOOL v)
|
||||||
|
{
|
||||||
|
InputManager::SetAxisRight(v);
|
||||||
|
}
|
||||||
} // namespace ia::iae
|
} // namespace ia::iae
|
||||||
@ -57,33 +57,33 @@ namespace ia::iae
|
|||||||
|
|
||||||
VOID AddClickListener(IN Rml::Element *element, IN std::function<VOID()> callback)
|
VOID AddClickListener(IN Rml::Element *element, IN std::function<VOID()> callback)
|
||||||
{
|
{
|
||||||
element->AddEventListener("click", this);
|
element->AddEventListener(Rml::EventId::Click, this);
|
||||||
m_clickCallbacks[element->GetId().c_str()] = callback;
|
m_clickCallbacks[element->GetId().c_str()] = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
// VOID AddHoverEnterListener(IN PCCHAR elementId, IN std::function<VOID()> callback)
|
VOID AddPointerDownListener(IN Rml::Element *element, IN std::function<VOID()> callback)
|
||||||
//{
|
{
|
||||||
// m_document->GetElementById(elementId)->AddEventListener("mouseover", this);
|
element->AddEventListener(Rml::EventId::Mousedown, this);
|
||||||
// m_hoverEnterCallbacks[elementId] = callback;
|
m_pointerDownCallbacks[element->GetId().c_str()] = callback;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// VOID AddHoverExitListener(IN PCCHAR elementId, IN std::function<VOID()> callback)
|
VOID AddPointerUpListener(IN Rml::Element *element, IN std::function<VOID()> callback)
|
||||||
//{
|
{
|
||||||
// m_document->GetElementById(elementId)->AddEventListener("mouseout", this);
|
element->AddEventListener(Rml::EventId::Mouseup, this);
|
||||||
// m_hoverExitCallbacks[elementId] = callback;
|
m_pointerUpCallbacks[element->GetId().c_str()] = callback;
|
||||||
//}
|
}
|
||||||
//
|
|
||||||
// VOID AddPointerDownListener(IN PCCHAR elementId, IN std::function<VOID()> callback)
|
VOID AddPointerEnterListener(IN Rml::Element *element, IN std::function<VOID()> callback)
|
||||||
//{
|
{
|
||||||
// m_document->GetElementById(elementId)->AddEventListener("mousedown", this);
|
element->AddEventListener(Rml::EventId::Mouseover, this);
|
||||||
// m_pointerDownCallbacks[elementId] = callback;
|
m_hoverEnterCallbacks[element->GetId().c_str()] = callback;
|
||||||
//}
|
}
|
||||||
//
|
|
||||||
// VOID AddPointerUpListener(IN PCCHAR elementId, IN std::function<VOID()> callback)
|
VOID AddPointerExitListener(IN Rml::Element *element, IN std::function<VOID()> callback)
|
||||||
//{
|
{
|
||||||
// m_document->GetElementById(elementId)->AddEventListener("mouseup", this);
|
element->AddEventListener(Rml::EventId::Mouseout, this);
|
||||||
// m_pointerUpCallbacks[elementId] = callback;
|
m_hoverExitCallbacks[element->GetId().c_str()] = callback;
|
||||||
//}
|
}
|
||||||
|
|
||||||
VOID ProcessEvent(IN Rml::Event &event)
|
VOID ProcessEvent(IN Rml::Event &event)
|
||||||
{
|
{
|
||||||
@ -101,12 +101,14 @@ namespace ia::iae
|
|||||||
m_hoverExitCallbacks[event.GetTargetElement()->GetId().c_str()]();
|
m_hoverExitCallbacks[event.GetTargetElement()->GetId().c_str()]();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Rml::EventId::Mousedown:
|
case Rml::EventId::Mousedown: {
|
||||||
m_pointerDownCallbacks[event.GetTargetElement()->GetId().c_str()]();
|
m_pointerDownCallbacks[event.GetTargetElement()->GetId().c_str()]();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Rml::EventId::Mouseup:
|
case Rml::EventId::Mouseup: {
|
||||||
m_pointerUpCallbacks[event.GetTargetElement()->GetId().c_str()]();
|
m_pointerUpCallbacks[event.GetTargetElement()->GetId().c_str()]();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -490,6 +492,26 @@ namespace ia::iae
|
|||||||
{
|
{
|
||||||
g_eventListener.AddClickListener(g_document->GetElementById(elementId), callback);
|
g_eventListener.AddClickListener(g_document->GetElementById(elementId), callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID UI::AddPointerUpEvent(IN PCCHAR elementId, IN std::function<VOID()> callback)
|
||||||
|
{
|
||||||
|
g_eventListener.AddPointerUpListener(g_document->GetElementById(elementId), callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID UI::AddPointerDownEvent(IN PCCHAR elementId, IN std::function<VOID()> callback)
|
||||||
|
{
|
||||||
|
g_eventListener.AddPointerDownListener(g_document->GetElementById(elementId), callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID UI::AddPointerExitEvent(IN PCCHAR elementId, IN std::function<VOID()> callback)
|
||||||
|
{
|
||||||
|
g_eventListener.AddPointerExitListener(g_document->GetElementById(elementId), callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID UI::AddPointerEnterEvent(IN PCCHAR elementId, IN std::function<VOID()> callback)
|
||||||
|
{
|
||||||
|
g_eventListener.AddPointerEnterListener(g_document->GetElementById(elementId), callback);
|
||||||
|
}
|
||||||
} // namespace ia::iae
|
} // namespace ia::iae
|
||||||
|
|
||||||
namespace ia::iae
|
namespace ia::iae
|
||||||
|
|||||||
@ -46,6 +46,13 @@ namespace ia::iae
|
|||||||
STATIC Handle BindAction(IN CONST String &name, IN InputKey key);
|
STATIC Handle BindAction(IN CONST String &name, IN InputKey key);
|
||||||
STATIC VOID BindAxis(IN InputKey upKey, IN InputKey downKey, IN InputKey leftKey, IN InputKey rightKey);
|
STATIC VOID BindAxis(IN InputKey upKey, IN InputKey downKey, IN InputKey leftKey, IN InputKey rightKey);
|
||||||
|
|
||||||
|
STATIC VOID SetAxisUp(IN BOOL v);
|
||||||
|
STATIC VOID SetAxisDown(IN BOOL v);
|
||||||
|
STATIC VOID SetAxisLeft(IN BOOL v);
|
||||||
|
STATIC VOID SetAxisRight(IN BOOL v);
|
||||||
|
STATIC VOID SetKey(IN InputKey key, IN BOOL state);
|
||||||
|
STATIC VOID SetAxis(IN BOOL up, IN BOOL down, IN BOOL left, IN BOOL right);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
STATIC BOOL s_keys[256];
|
STATIC BOOL s_keys[256];
|
||||||
STATIC BOOL s_prevKeys[256];
|
STATIC BOOL s_prevKeys[256];
|
||||||
|
|||||||
@ -117,6 +117,12 @@ namespace ia::iae
|
|||||||
STATIC BOOL WasInputActionReleased(IN CONST String &action);
|
STATIC BOOL WasInputActionReleased(IN CONST String &action);
|
||||||
STATIC Handle BindInputAction(IN CONST String &name, IN InputKey key);
|
STATIC Handle BindInputAction(IN CONST String &name, IN InputKey key);
|
||||||
STATIC VOID BindInputAxis(IN InputKey upKey, IN InputKey downKey, IN InputKey leftKey, IN InputKey rightKey);
|
STATIC VOID BindInputAxis(IN InputKey upKey, IN InputKey downKey, IN InputKey leftKey, IN InputKey rightKey);
|
||||||
|
STATIC VOID SetAxisUp(IN BOOL v);
|
||||||
|
STATIC VOID SetAxisDown(IN BOOL v);
|
||||||
|
STATIC VOID SetAxisLeft(IN BOOL v);
|
||||||
|
STATIC VOID SetAxisRight(IN BOOL v);
|
||||||
|
STATIC VOID SetKey(IN InputKey key, IN BOOL state);
|
||||||
|
STATIC VOID SetAxis(IN BOOL up, IN BOOL down, IN BOOL left, IN BOOL right);
|
||||||
|
|
||||||
// Utility Functions
|
// Utility Functions
|
||||||
STATIC String ReadTextAsset(IN CONST String& path);
|
STATIC String ReadTextAsset(IN CONST String& path);
|
||||||
|
|||||||
@ -28,6 +28,10 @@ namespace ia::iae
|
|||||||
STATIC VOID SetMarkup(IN CONST String &markup, IN CONST String &styles);
|
STATIC VOID SetMarkup(IN CONST String &markup, IN CONST String &styles);
|
||||||
|
|
||||||
STATIC VOID AddClickEvent(IN PCCHAR elementId, IN std::function<VOID()> callback);
|
STATIC VOID AddClickEvent(IN PCCHAR elementId, IN std::function<VOID()> callback);
|
||||||
|
STATIC VOID AddPointerUpEvent(IN PCCHAR elementId, IN std::function<VOID()> callback);
|
||||||
|
STATIC VOID AddPointerDownEvent(IN PCCHAR elementId, IN std::function<VOID()> callback);
|
||||||
|
STATIC VOID AddPointerExitEvent(IN PCCHAR elementId, IN std::function<VOID()> callback);
|
||||||
|
STATIC VOID AddPointerEnterEvent(IN PCCHAR elementId, IN std::function<VOID()> callback);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
STATIC VOID Initialize();
|
STATIC VOID Initialize();
|
||||||
|
|||||||
BIN
Resources/HUD/gamepad_dir_down.png
Normal file
BIN
Resources/HUD/gamepad_dir_down.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Resources/HUD/gamepad_dir_left.png
Normal file
BIN
Resources/HUD/gamepad_dir_left.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
Resources/HUD/gamepad_dir_right.png
Normal file
BIN
Resources/HUD/gamepad_dir_right.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Resources/HUD/gamepad_dir_up.png
Normal file
BIN
Resources/HUD/gamepad_dir_up.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
10
Vendor/CMakeLists.txt
vendored
10
Vendor/CMakeLists.txt
vendored
@ -1,3 +1,5 @@
|
|||||||
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
# IACore
|
# IACore
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
@ -7,7 +9,6 @@ add_subdirectory(IACore/)
|
|||||||
# SDL3
|
# SDL3
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
set(SDL_TEST_LIBRARY OFF)
|
set(SDL_TEST_LIBRARY OFF)
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
|
||||||
add_subdirectory(SDL/)
|
add_subdirectory(SDL/)
|
||||||
|
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
@ -22,10 +23,15 @@ add_subdirectory(SDL_mixer/)
|
|||||||
add_subdirectory(freetype/)
|
add_subdirectory(freetype/)
|
||||||
add_library(Freetype::Freetype ALIAS freetype)
|
add_library(Freetype::Freetype ALIAS freetype)
|
||||||
|
|
||||||
|
# -----------------------------------------------
|
||||||
|
# LunaSVG
|
||||||
|
# -----------------------------------------------
|
||||||
|
set(LUNASVG_BUILD_EXAMPLES OFF)
|
||||||
|
add_subdirectory(lunasvg/)
|
||||||
|
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
# RmlUI
|
# RmlUI
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
add_subdirectory(lunasvg/)
|
|
||||||
set(RMLUI_SVG_PLUGIN ON)
|
set(RMLUI_SVG_PLUGIN ON)
|
||||||
add_subdirectory(RmlUI/)
|
add_subdirectory(RmlUI/)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user