mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-05-01 18:13:57 +00:00
Some checks failed
CI / clang-format (push) Has been cancelled
CI / ${{ matrix.name }} (false, --toolchain /usr/local/vitasdk/share/vita.toolchain.cmake, false, false, Ninja, Vita, ubuntu-latest, true, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0, false, false, Visual Studio 17 2022, true, Xbox One, windows-latest, amd64, false, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake, false, devkitpro/devkitarm:latest, false, Ninja, true, Nintendo 3DS, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake, false, devkitpro/devkita64:latest, false, Ninja, Nintendo Switch, true, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, emcmake, false, false, true, Ninja, Emscripten, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, false, Ninja, true, MSVC (arm64), windows-latest, amd64_arm64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, true, Ninja, true, MSVC (x86), windows-latest, amd64_x86, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, false, Ninja, true, MSVC (x64), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, true, false, Ninja, true, MSVC (x64 Debug), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, -DCMAKE_SYSTEM_NAME=iOS, false, false, Xcode, true, iOS, macos-15, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, false, Ninja, Android, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, true, false, Ninja, macOS, macos-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, false, Ninja, true, mingw-w64-x86_64, mingw64, msys2 mingw64, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux (Debug), ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux, ubuntu-latest, true) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (x86_64, ubuntu-latest) (push) Has been cancelled
CI / C++ (push) Has been cancelled
Docker / Publish web port (push) Has been cancelled
CI / Release (push) Has been cancelled
Introduces a third person camera system with orbit camera, input handling (mouse/keyboard/touch/gamepad), display actor cloning, and camera-relative movement. Includes shared character utilities (animator, cloner, customizer) and an IExtraAnimHandler interface for optional animation extensions. Also includes generic base game fixes and extension system improvements.
62 lines
1.5 KiB
C++
62 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <SDL3/SDL_events.h>
|
|
|
|
namespace Extensions
|
|
{
|
|
namespace ThirdPersonCamera
|
|
{
|
|
|
|
class OrbitCamera;
|
|
|
|
class InputHandler {
|
|
public:
|
|
InputHandler();
|
|
|
|
void HandleSDLEvent(SDL_Event* p_event, OrbitCamera& p_orbit, bool p_active);
|
|
|
|
bool TryClaimFinger(const SDL_TouchFingerEvent& p_event);
|
|
bool TryReleaseFinger(SDL_FingerID p_id);
|
|
bool IsFingerTracked(SDL_FingerID p_id) const;
|
|
int GetTouchCount() const { return m_touch.count; }
|
|
SDL_FingerID GetFingerID(int p_idx) const { return m_touch.id[p_idx]; }
|
|
|
|
bool IsLeftButtonHeld() const { return m_leftButtonHeld; }
|
|
bool IsLmbHeldForMovement() const;
|
|
|
|
bool ConsumeAutoDisable();
|
|
bool ConsumeAutoEnable();
|
|
|
|
void ResetTouchState() { m_touch = {}; }
|
|
void SuppressGestures();
|
|
|
|
static constexpr float CAMERA_ZONE_X = 0.5f;
|
|
static constexpr float PINCH_TRANSITION_THRESHOLD = 0.03f;
|
|
static constexpr Uint64 LMB_HOLD_THRESHOLD_MS = 300;
|
|
static constexpr float MOUSE_SENSITIVITY = 0.005f;
|
|
static constexpr float MOUSE_WHEEL_ZOOM_STEP = 0.5f;
|
|
static constexpr float TOUCH_YAW_PITCH_SCALE = 2.0f;
|
|
static constexpr float PINCH_ZOOM_SCALE = 6.0f;
|
|
|
|
private:
|
|
struct TouchState {
|
|
SDL_FingerID id[2];
|
|
float x[2], y[2];
|
|
bool synced[2];
|
|
int count;
|
|
float initialPinchDist;
|
|
float gesturePinchDist;
|
|
} m_touch;
|
|
|
|
bool m_wantsAutoDisable;
|
|
bool m_wantsAutoEnable;
|
|
bool m_rightButtonHeld;
|
|
bool m_leftButtonHeld;
|
|
Uint64 m_leftButtonDownTime;
|
|
float m_savedMouseX;
|
|
float m_savedMouseY;
|
|
};
|
|
|
|
} // namespace ThirdPersonCamera
|
|
} // namespace Extensions
|