Fission FSN
Loading...
Searching...
No Matches
gfCAutoTestPointer.h
Go to the documentation of this file.
1/********************************************************************
2*
3* File: gfCAutoTestPointer.h
4*
5* Purpose: Auto play input - real pointer events, taps and drags
6*
7*********************************************************************/
8
9#ifndef gfCAutoTestPointerhdr
10#define gfCAutoTestPointerhdr
11
12#include <vector>
13
14#include <fsCore/fsBaseTypes.h>
15#include <fsCore/fsPoint.h>
16
17class fsCEntity;
18class fsCUniqueId;
19class fsIComponent;
21
22
23// Positions are pointer space, which is screen space: sPointerMsgParam::mPos
24// goes straight to hitTest(), so aiming at screenPositionGet() needs no conversion.
26{
27public:
28
29 gfCAutoTestPointer(const fsIComponent& pOwner, gfCAutoTestOverlay& pOverlay, fsS32 pDragSteps);
30
31 void tap(const fsPoint& pPos);
32
33 // Drags run a step per update - keyOver() tests the dragged sprite's matrix,
34 // which only refreshes once per update walk. pKeyEnt is the draggable being
35 // picked up, if known, so the drop can be aimed by its icon.
36 void dragBegin(const fsPoint& pFrom, const fsPoint& pTo, fsCEntity* pKeyEnt = nullptr);
37 // True on the step the drag drops.
39 // Changes where the drag in flight will drop - before its first step. It passes
40 // through each of pVia in turn, each leg taking as many steps as a straight drag.
41 void dragRetarget(const fsPoint& pTo, const std::vector<fsPoint>& pVia = {});
42 // Lets the drag run out where it started rather than cutting it short.
43 void dragHold();
44 // Releases an in-flight drag rather than stranding a half-open gesture.
45 void dragAbandon();
46 fsBool dragActiveGet() const { return mDragActive; }
47
48private:
49
50 void event(const fsCUniqueId& pMessageType, const fsPoint& pPos, fsBool pDown);
51 void dragOffsetCompensate();
52
53 const fsIComponent& mOwner;
54 gfCAutoTestOverlay& mOverlay;
55
56 const fsS32 mDragSteps;
57
58 fsBool mDragActive;
59 fsPoint mDragFrom;
60 fsPoint mDragTo;
61 std::vector<fsPoint> mDragVia;
62 fsPoint mDragLastPos;
63 fsS32 mDragStep;
64 fsCEntity* mDragKeyEnt;
65};
66
67#endif
Definition fsCEntity.h:39
Definition fsCUniqueId.h:21
Definition fsIComponent.h:26
Definition gfCAutoTestOverlay.h:22
fsBool dragStepAdvance()
Definition gfCAutoTestPointer.cpp:85
fsBool dragActiveGet() const
Definition gfCAutoTestPointer.h:46
void dragBegin(const fsPoint &pFrom, const fsPoint &pTo, fsCEntity *pKeyEnt=nullptr)
Definition gfCAutoTestPointer.cpp:29
void dragHold()
Definition gfCAutoTestPointer.cpp:49
void tap(const fsPoint &pPos)
Definition gfCAutoTestPointer.cpp:19
void dragRetarget(const fsPoint &pTo, const std::vector< fsPoint > &pVia={})
Definition gfCAutoTestPointer.cpp:43
void dragAbandon()
Definition gfCAutoTestPointer.cpp:55
gfCAutoTestPointer(const fsIComponent &pOwner, gfCAutoTestOverlay &pOverlay, fsS32 pDragSteps)
Definition gfCAutoTestPointer.cpp:113
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsPoint.h:17