feat: tilting simulation mode

This commit is contained in:
Virt 2024-06-26 17:14:16 +02:00
commit 416f6efc2f
5 changed files with 169 additions and 21 deletions

View file

@ -10,6 +10,8 @@ class CDynamicCursors {
public:
/* hook on onCursorMoved */
void onCursorMoved(CPointerManager* pointers);
/* called on tick */
void onTick(CPointerManager* pointers);
/* hook on renderSoftwareCursorsFor */
void renderSoftware(CPointerManager* pointers, SP<CMonitor> pMonitor, timespec* now, CRegion& damage, std::optional<Vector2D> overridePos);
@ -24,10 +26,19 @@ class CDynamicCursors {
// current angle of the cursor in radiants
double angle;
// calculates the current angle of the cursor, returns whether the angle has changed
bool calculate(Vector2D* pos);
// calculates the current angle of the cursor, and changes the cursor shape
void calculate();
// calculate the angle of the cursor if stick
double calculateStick();
// this is the end of the virtual stick
Vector2D end;
// calculate the angle of the cursor if air
double calculateAir();
// ring buffer of last position samples
std::vector<Vector2D> samples;
int samples_index = 0;
};
inline std::unique_ptr<CDynamicCursors> g_pDynamicCursors;