Fission FSN
Loading...
Searching...
No Matches
fsCDragDropComponent.h
Go to the documentation of this file.
1/********************************************************************
2*
3* Created: 22/4/2014 14:16
4*
5* File: fsCDragDropComponent.h
6*
7* Author: Mick Waites
8*
9* Purpose: Short lived sprite based entities which can be
10* dragged around a scene and dropped.
11*
12*********************************************************************/
13
14#ifndef fsCDragDropComponenthdr
15#define fsCDragDropComponenthdr
16
18
20
21class fsCLine;
22struct fsPoint;
23class fsCBrush;
24
25// #define COLLISION_DEBUG_RENDERING
26// #define COLLISION_DEBUG_MESSAGES
27
28
30{
31 friend class fsCComponentFactory;
32
33public:
34
35 static const fsCUniqueId mTypeId;
36
38
39#ifdef COLLISION_DEBUG_MESSAGES
40 static const fsCUniqueId mDragingMsg;
41#endif
42 static fsCEntity* dragDropEntityCreate(const fsStr& pEntName, std::shared_ptr<fsCBrush> pBrush, fsCEntity* pEnt,
43 const fsPoint& pOffset);
44
45 void dragStart(const fsPoint& pPos, fsS32 pPointerIndexForDrag);
46
47protected:
48
49 fsBool acceptingInputGet() const override;
50
51 void onDragMove(const fsPoint& pCurrPos) override;
52 void onDragEnd(const fsPoint& pEndPos) override;
53
54 void renderDo() override;
55 void matrixApplyDo() override;
56
57 static fsIComponent* create(fsCEntity* pParent);
58
60 virtual ~fsCDragDropComponent();
61
62private:
63
64 void spritePositionSet(const fsPoint& pCurrPos) const;
65
66 const fsS32 mTouchFingerVerticalOffset;
67 fsPoint mOffset;
68#ifdef COLLISION_DEBUG_RENDERING
69 fsCLine* mLine;
70#endif
71};
72
73#endif
Definition fsCBrush.h:26
void matrixApplyDo() override
Definition fsCDragDropComponent.cpp:59
void dragStart(const fsPoint &pPos, fsS32 pPointerIndexForDrag)
Definition fsCDragDropComponent.cpp:20
fsBool acceptingInputGet() const override
Definition fsCDragDropComponent.cpp:55
friend class fsCComponentFactory
Definition fsCDragDropComponent.h:31
static const fsCUniqueId mTypeId
Definition fsCDragDropComponent.h:35
virtual ~fsCDragDropComponent()
Definition fsCDragDropComponent.cpp:128
static fsIComponent * create(fsCEntity *pParent)
Definition fsCDragDropComponent.cpp:106
void renderDo() override
Definition fsCDragDropComponent.cpp:66
static const fsCUniqueId mDragEndMsg
Definition fsCDragDropComponent.h:37
void onDragEnd(const fsPoint &pEndPos) override
Definition fsCDragDropComponent.cpp:42
static fsCEntity * dragDropEntityCreate(const fsStr &pEntName, std::shared_ptr< fsCBrush > pBrush, fsCEntity *pEnt, const fsPoint &pOffset)
Definition fsCDragDropComponent.cpp:72
void onDragMove(const fsPoint &pCurrPos) override
Definition fsCDragDropComponent.cpp:34
fsCDragDropComponent(fsCEntity *pParent)
Definition fsCDragDropComponent.cpp:111
Definition fsCEntity.h:39
Definition fsCLine.h:18
Definition fsCUniqueId.h:21
fsIComponent(fsCEntity *pParent)
Definition fsIComponent.cpp:86
fsIGestureHandlingComponent(fsCEntity *pParent, fsBool pHandleTaps, fsBool pHandleDragEvent, fsBool pHandlePinchEvents)
Definition fsIGestureHandlingComponent.cpp:448
Definition fsStr.h:23
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsPoint.h:17