Files
spice2x-r3d/src/spice2x/touch/touch.h
T
bicarus-devandGitHub ae06652148 touch: avoid calling is_touch_available too early (#289)
## Link to GitHub Issue, if one exists
Fixes #120 

## Description of change
Don't call `is_touch_available` in launcher before RawInput stack is
initialized. This causes us to incorrectly fall back to the Win7/Win8
touch handler.

The desired behavior is to use rawinput touch by default for all games,
unless overridden by the user via `-wintouch`.

Add a bunch of logging so we can spot who's calling
`is_touch_available`.

As a side effect, a handful of games that previously used Win7/8 touch
will now use RawInput touch instead. If this causes any issues, they can
turn `-wintouch` on to force Win7/8 touch logic again.

## Compiling
👍 

## Testing
Test:

* RB
* -wintouch
* TDJ, UFC subscreen and native touch
* overlay, especially in multi-mon
2025-04-04 21:31:18 -07:00

44 lines
1.0 KiB
C++

#pragma once
#include <vector>
#include <windows.h>
struct TouchPoint {
DWORD id;
LONG x, y;
bool mouse;
};
enum TouchEventType {
TOUCH_DOWN,
TOUCH_MOVE,
TOUCH_UP
};
struct TouchEvent {
DWORD id;
LONG x, y;
TouchEventType type;
bool mouse;
};
extern bool SPICETOUCH_CARD_DISABLE;
extern HWND SPICETOUCH_TOUCH_HWND;
extern int SPICETOUCH_TOUCH_X;
extern int SPICETOUCH_TOUCH_Y;
extern int SPICETOUCH_TOUCH_WIDTH;
extern int SPICETOUCH_TOUCH_HEIGHT;
bool is_touch_available(LPCSTR caller);
void touch_attach_wnd(HWND hWnd);
void touch_attach_dx_hook();
void touch_create_wnd(HWND hWnd, bool overlay = false);
void touch_detach();
void touch_write_points(std::vector<TouchPoint> *touch_points);
void touch_remove_points(std::vector<DWORD> *touch_point_ids);
void touch_get_points(std::vector<TouchPoint> &touch_points, bool overlay = false);
void touch_get_events(std::vector<TouchEvent> &touch_events, bool overlay = false);
void update_spicetouch_window_dimensions(HWND hWnd);