Files
Mouad-Scriptz-0andClaude Fable 5.1 94087d08b0 feat(libSceVideoOut): capture the host cursor for guest mice and scale their deltas
The console's mouse reports relative motion, so the host cursor can never line
up with the cursor a title draws. While a title has a mouse open and the
window is focused the host cursor is hidden and captured, released on focus
loss or while the pad's mouse-to-stick toggle is on. Motion deltas are scaled
from the presented image's size in window units to the title's display
resolution with sub-pixel carry, so the title's cursor travels as far as the
host pointer would, on scaled desktops and letterboxed windows alike.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-13 14:05:52 +00:00

26 lines
725 B
C++

#ifndef CORE_LIBS_PRX_LIBSCEVIDEOOUT_MOUSEINPUT_HPP
#define CORE_LIBS_PRX_LIBSCEVIDEOOUT_MOUSEINPUT_HPP
#include "SDL_events.h"
#include <cstdint>
class MouseInput {
public:
void HandleEvent(const SDL_Event& event, unsigned windowId);
void SetPresentation(std::uint32_t sourceWidth, std::uint32_t sourceHeight, std::uint32_t presentedWidth, std::uint32_t presentedHeight);
bool CaptureWanted(bool allowed) const;
void UpdateCapture(bool allowed);
private:
std::int32_t scaled(std::int32_t delta, double scale, double& remainder);
bool focused = true;
bool captured = false;
double scaleX = 1.0;
double scaleY = 1.0;
double remainderX = 0.0;
double remainderY = 0.0;
};
#endif