Fission FSN
Loading...
Searching...
No Matches
gfCParkLensComponent.h
Go to the documentation of this file.
1/********************************************************************
2*
3* File: gfCParkLensComponent.h
4*
5* Purpose: Pan/zoom lens over the park's tile-map view (Phase 1).
6* Drives the fsCView entity's scale (zoom) and position
7* (pan) from drag/pinch gestures - the whole park, being
8* children of the view, comes along. Sits on its own
9* full-canvas hit-test entity so it catches gestures across
10* the screen; its target is the view, not itself.
11*
12* Phase 2 (deferred): reconciling gesture taps with the
13* existing tap-to-deploy components, and a desktop
14* mouse-wheel zoom.
15*
16*********************************************************************/
17
18#ifndef gfCParkLensComponenthdr
19#define gfCParkLensComponenthdr
20
22#include <fsCore/fsPoint.h>
23
25
26class fsCEntity;
28
29namespace fsNTileMap { class fsCView; }
30
32{
33 friend class fsCComponentFactory;
34
35public:
36
37 static const fsCUniqueId mTypeId;
38
39 // Sets the zoom range and scroll bounds. pViewportSize is the on-screen
40 // canvas; pContentSize is the map's full on-screen size at min zoom (map
41 // pixels x the view's render scale) - both axes pan across it. See
42 // fsCDrag::scrollRangeCalculate for how the two sizes bound the pan range.
43 void configure(const fsPoint& pViewportSize, const fsPoint& pContentSize,
44 fsF32 pMinZoom, fsF32 pMaxZoom);
45
46 // Call once after configure(): the view this lens pans by scrolling.
47 void viewSet(fsNTileMap::fsCView* const pView);
48
49 // Call once: notified synchronously right after each scroll (see updateDo).
50 void levelSet(gfCParkLevelComponent* const pLevel);
51
52 virtual ~gfCParkLensComponent();
53
54protected:
55
56 // A transform-only stand-in, not the camera or view (see updateDo).
57 fsCEntity* const targetGetDo() override;
58
59 // Phase 1: the park is always pannable/zoomable while the level is up.
60 fsBool acceptingInputGet() const override { return true; }
61
62 void updateDo(fsS32 pDeltaMs) override;
63
64 static fsIComponent* create(fsCEntity* pParent);
65
66 gfCParkLensComponent(fsCEntity* pParent, fsBool pHandleTaps, fsBool pHandleDragEvent,
67 fsBool pHandlePinchEvents);
68
69private:
70
71 fsNTileMap::fsCView* mView = nullptr;
72 gfCParkLevelComponent* mLevel = nullptr;
73 fsCEntity* mCamera = nullptr;
74 fsCEntity* mPanProxy = nullptr;
75 fsPoint mLastProxyPos;
76};
77
78#endif
Definition fsCEntity.h:39
Definition fsCUniqueId.h:21
Definition fsIComponent.h:26
Definition fsCView.h:28
fsCEntity *const targetGetDo() override
Definition gfCParkLensComponent.cpp:48
void configure(const fsPoint &pViewportSize, const fsPoint &pContentSize, fsF32 pMinZoom, fsF32 pMaxZoom)
Definition gfCParkLensComponent.cpp:14
friend class fsCComponentFactory
Definition gfCParkLensComponent.h:33
gfCParkLensComponent(fsCEntity *pParent, fsBool pHandleTaps, fsBool pHandleDragEvent, fsBool pHandlePinchEvents)
Definition gfCParkLensComponent.cpp:103
virtual ~gfCParkLensComponent()
Definition gfCParkLensComponent.cpp:109
static const fsCUniqueId mTypeId
Definition gfCParkLensComponent.h:37
fsBool acceptingInputGet() const override
Definition gfCParkLensComponent.h:60
void updateDo(fsS32 pDeltaMs) override
Definition gfCParkLensComponent.cpp:58
void viewSet(fsNTileMap::fsCView *const pView)
Definition gfCParkLensComponent.cpp:28
void levelSet(gfCParkLevelComponent *const pLevel)
Definition gfCParkLensComponent.cpp:43
static fsIComponent * create(fsCEntity *pParent)
Definition gfCParkLensComponent.cpp:95
Definition gfCParkLevelComponent.h:41
gfILensComponent(fsCEntity *pParent, fsBool pHandleTaps, fsBool pHandleDragEvent, fsBool pHandlePinchEvents)
Definition gfILensComponent.cpp:353
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
float fsF32
Definition fsBaseTypes.h:28
Definition fsILayer.h:21
Definition fsPoint.h:17