2 #ifndef _YI_SCENE_MANAGER_H_ 3 #define _YI_SCENE_MANAGER_H_ 18 #include <glm/fwd.hpp> 26 class CYISceneManagerPriv;
400 std::vector<CYISceneNode *>
GetScenes()
const;
543 template <
class YI_SCENE_NODE_SUBCLASS> YI_SCENE_NODE_SUBCLASS *
GetNode(
const CYIString & name)
const;
550 bool Update(
bool bForceDirty,
bool bForceRender =
false);
746 virtual bool HandleEvent(
const std::shared_ptr<CYIEventDispatcher> &pDispatcher,
CYIEvent *pEvent)
override;
749 struct SCENE_PROPERTIES
765 virtual ~LongPressHandler();
768 uint8_t m_unPointerID;
769 std::unique_ptr<CYITimer> m_pTimer;
770 std::unique_ptr<CYIActionEvent> m_pActionEvent;
790 virtual ~DelayedDownHandler();
791 void OnDelayedDown();
793 uint8_t m_uPointerID;
794 std::unique_ptr<CYITimer> m_pTimer;
795 std::unique_ptr<CYIActionEvent> m_pActionEvent;
797 std::shared_ptr<CYISceneNodeProxy> m_target;
803 bool OnMoveEvent(
const std::shared_ptr<CYIEventDispatcher> &pDispatcher,
CYIActionEvent *pActionEvent,
CYISceneNode *pNewMoveTarget);
804 bool OnDownEvent(
const std::shared_ptr<CYIEventDispatcher> &pDispatcher,
CYIActionEvent *pActionEvent,
CYISceneNode *pNewMoveTarget);
805 bool OnUpEvent(
const std::shared_ptr<CYIEventDispatcher> &pDispatcher,
CYIActionEvent *pActionEvent,
CYISceneNode *pNewMoveTarget);
810 void CancelAllActions();
816 void CancelLastActionForPointer(uint8_t uPointerID);
830 void OnPlayTimeline(
const std::shared_ptr<CYITimelineProxy> &pProxy);
839 void PutRootNodeBefore(std::unique_ptr<CYISceneNode> pNode,
CYISceneNode *pRelativeNode);
840 void PutRootNodeAfter(std::unique_ptr<CYISceneNode> pNode,
CYISceneNode *pRelativeNode);
841 void PutRootNodeAtFront(std::unique_ptr<CYISceneNode> pNode);
842 void PutRootNodeAtBack(std::unique_ptr<CYISceneNode> pNode);
843 void InsertRootNodeAtIndex(
CYISceneNode *pNode, int32_t nLayer);
844 void AddChildAtRealIndex(std::unique_ptr<CYISceneNode> pNode);
846 std::list<std::pair<CYISceneNode *, int32_t>>::iterator rootListFind(
const CYISceneNode *pNode)
848 std::list<std::pair<CYISceneNode *, int32_t>>::iterator it = m_RootSceneNodes.begin(), end = m_RootSceneNodes.end();
850 for (; it != end; ++it)
852 if (it->first == pNode)
861 std::map<CYISceneNode *, SCENE_PROPERTIES>::const_iterator scenePropertyFind(
const CYISceneNode *pView)
const 863 std::map<CYISceneNode *, SCENE_PROPERTIES>::const_iterator it = m_SceneProperties.begin(), end = m_SceneProperties.end();
865 for (; it != end; ++it)
867 if (it->first == pView)
881 std::map<CYIString, CYISceneNode *> m_StagedRootSceneNodes;
886 std::map<CYIString, std::unique_ptr<CYISceneNode>> m_UnstagedRootSceneNodes;
888 std::list<std::pair<CYISceneNode *, int32_t>> m_RootSceneNodes;
889 std::map<CYISceneNode *, SCENE_PROPERTIES> m_SceneProperties;
890 static const SCENE_PROPERTIES s_eDefaultSceneProperties;
908 float m_fCameraScrollAnchorY;
910 CYIFocusState *m_pFocusState;
912 std::vector<IYIRenderer::Command> m_defaultRenderList;
915 bool m_bShuttingDown;
917 std::unique_ptr<CYISceneManagerPriv> m_pPriv;
929 return YiDynamicCast<YI_SCENE_NODE_SUBCLASS>(
GetNode(name));
932 #endif // _YI_SCENE_MANAGER_H_ bool IsReachable(const CYISceneNode *pNode) const
void SetKeyboardCaptureNode(CYISceneNode *pNode)
friend class CYIFocusPriv
Definition: YiSceneManager.h:75
CYISceneNode * GetNode(const CYIString &name) const
uint32_t GetStagedSceneCount() const
LAYER_TYPE
Specifies layering rules on a scene. Transparent scenes may be drawn over other scenes.
Definition: YiSceneManager.h:93
void SetEventCaptureRootNode(CYISceneNode *pNode)
#define YI_DISALLOW_COPY_AND_ASSIGN(TypeName)
Delete the copy constructor and assignment operator (and consequently the move constructor as well) ...
Definition: YiPredef.h:114
A class containing focus search options.
Definition: YiFocusSearchOptions.h:23
bool SendToBack(const CYIString &name)
const int32_t YI_LONG_PRESS_DELAY
Definition: YiSceneManager.h:42
Allows registering of event filters which can be used to perform processing on an event before and af...
Definition: YiEventHandler.h:25
Scene trees composed of CYISceneNode objects are registered with the scene manager in order for them ...
Definition: YiSceneManager.h:73
Definition: YiPredef.h:234
const uint8_t YI_MAX_POINTER_ID
Definition: YiSceneManager.h:40
CYICameraController & GetCameraController()
bool RemoveGlobalEventListener(YI_EVENT_TYPE eEventType, CYIEventHandler *pListener, CYIEventTarget::EVENT_PHASE ePhase=CYIEventTarget::BUBBLE)
A timeline which sources its data from a backing store.
Definition: YiTimeline.h:54
Base class for events.
Definition: YiEvent.h:489
The base class for all view types. Views are containers of renderable elements that often define inte...
Definition: YiSceneView.h:47
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:35
bool UnstageScene(const CYIString &name)
Definition: YiSceneManager.h:106
bool CanBeFocused(const CYISceneView *pView) const
Definition: YiSceneManager.h:96
YI_EVENT_TYPE
The event type of the CYIEvent class instance.
Definition: YiEvent.h:23
bool MoveAfter(const CYIString &nameToMove, const CYIString &nameRelative)
Definition: YiOrthographicCameraSceneNode.h:27
CYISceneNode * GetTrackpadCaptureNode() const
bool MoveForward(const CYIString &name)
bool StageScene(const CYIString &name)
void OnSurfaceSizeChanged()
bool MoveFocus(CYIFocus::FOCUS_DIRECTION eDirection, const CYIFocusSearchOptions &options=CYIFocusSearchOptions())
Material Factory interface for the generation of all things texture and shader related.
Definition: YiMaterialFactory.h:23
virtual ~CYISceneManager()
std::unique_ptr< CYISceneView > LoadScene(const CYIString &filename, SCALE_TYPE scaleType=SCALE_STRETCH, V_ALIGN_TYPE vAlign=V_ALIGN_CENTER, H_ALIGN_TYPE hAlign=H_ALIGN_CENTER, MISSING_CLASS_HANDLING_MODE eMissingHandlingMode=ABORT)
YI_SPECIAL_EVENT_TARGET_TYPE
Definition: YiEventTarget.h:18
CYISignal< const CYIString &, CYISceneNode * > SceneUnstaged
Definition: YiSceneManager.h:734
CYISceneNode * GetKeyboardCaptureNode() const
The base class for an object accessible from script source code.
Definition: YiScriptableObject.h:28
std::vector< CYISceneNode * > GetUnstagedScenes() const
Definition: YiEventTarget.h:44
Definition: YiSceneManager.h:108
Definition: YiSceneManager.h:134
H_ALIGN_TYPE
Horizontal alignment.
Definition: YiSceneManager.h:130
CYISceneNode * GetPointerCaptureNode(uint8_t uPointerID)
Definition: YiSceneManager.h:120
Definition: YiSceneManager.h:122
bool GetSceneProperties(const CYIString &name, LAYER_TYPE &eLayerType, CYIViewport &viewport) const
void SetTrackpadCaptureNode(CYISceneNode *pNode)
std::vector< CYISceneNode * > GetScenes() const
Definition: YiViewport.h:12
const int32_t YI_DELAYED_DOWN_EVENT_DELAY
Definition: YiSceneManager.h:41
CYISceneNode * GetTargetNodeAtScreenLocation(int32_t nScreenX, int32_t nScreenY) const
Encapsulates the origin and direction points of a ray.
Definition: YiRay.h:33
void SetPointerCaptureNode(CYISceneNode *pNode, uint8_t uPointerID)
CYISceneView * GetViewWithFocus() const
SCALE_TYPE
Scaling rules define how the scene adapts to having different dimensions.
Definition: YiSceneManager.h:104
CYISceneNode * GetUnstagedScene(uint32_t uIndex) const
Definition: YiSceneManager.h:109
EVENT_PHASE
Definition: YiEventTarget.h:42
std::unique_ptr< CYITimeline > ImportTimeline(CYISceneNode *pRootNode, const CYIString &filename)
CYISceneNode * GetScene(uint32_t uIndex) const
bool UpdateSceneProperties(const CYIString &name, LAYER_TYPE eLayerType=LAYER_OPAQUE, const CYIViewport *pCustomViewport=nullptr)
A low-precision timer driven by the update loop.
Definition: YiTimer.h:29
bool StageSceneBefore(const CYIString &name, const CYIString &nameRelative)
bool BringToFront(const CYIString &name)
CYISceneNode * GetEventCaptureRootNode()
bool IsSceneStaged(const CYIString &name) const
Definition: YiSceneManager.h:133
Definition: YiSceneManager.h:121
FOCUS_ROOT_RULE
Definition: YiFocus.h:60
Definition: YiSceneManager.h:132
bool AddGlobalEventListener(YI_EVENT_TYPE eEventType, CYIEventHandler *pListener, CYIEventTarget::EVENT_PHASE ePhase=CYIEventTarget::BUBBLE)
bool MoveBackward(const CYIString &name)
bool RequestFocus(const CYISceneView *pViewToFocus, CYIFocus::FOCUS_ROOT_RULE eFocusRootRule=CYIFocus::FOCUS_ROOT_DESCENDANTS_UPDATE_CONTEXT)
A scene node is the base type for all nodes which are used by the scene manager; it is an integral pa...
Definition: YiSceneNode.h:114
bool UpdateSceneLayerIndex(const CYIString &name, int32_t nLayerIndex)
void UpdateUnstagedScenes()
std::vector< CYISceneNode * > GetStagedScenes() const
void SetBackgroundColor(const CYIColor &color)
The abstract runtime representation of a C++ type.
Definition: YiRtti.h:48
bool GetSceneLayerIndex(const CYIString &name, int32_t &nLayerIndex)
uint32_t GetSceneCount() const
bool Layout(CYISceneNode *pNode)
Definition: YiSignalHandler.h:174
Factory for the creation of Vertex and Index buffers.
Definition: YiBufferFactory.h:18
Definition: YiSceneManager.h:144
const CYIColor & GetBackgroundColor()
Factory for the creation of meshes.
Definition: YiMeshFactory.h:20
bool DispatchEvent(const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent, CYISceneNode *pTarget)
bool AddScene(const CYIString &name, std::unique_ptr< CYISceneNode > pSceneNode, int32_t nLayerIndex=0, LAYER_TYPE eLayerType=LAYER_OPAQUE, const CYIViewport *pCustomViewport=nullptr)
FOCUS_DIRECTION
Definition: YiFocus.h:44
const CYIString & GetSceneName(CYISceneNode *pScene) const
bool MoveBefore(const CYIString &nameToMove, const CYIString &nameRelative)
virtual bool HandleEvent(const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent) override
bool StageSceneAtFront(const CYIString &name)
CYISceneNode * GetStagedScene(uint32_t uIndex) const
bool StageSceneAfter(const CYIString &name, const CYIString &nameRelative)
V_ALIGN_TYPE
Vertical alignment.
Definition: YiSceneManager.h:118
void ShowScene(const CYIString &name)
CYISignal< const CYIString &, CYISceneNode * > SceneStaged
Definition: YiSceneManager.h:729
Definition: YiCameraController.h:22
void OnSpecialEventTargetDestroyed(CYISceneNode *pNode)
std::unique_ptr< CYISceneNode > RemoveScene(CYISceneNode *pSceneNode)
bool GetSceneUpdateProperties(CYISceneView *pRoot, SCALE_TYPE &eScaleType, V_ALIGN_TYPE &eVAlign, H_ALIGN_TYPE &eHAlign) const
This file contains the classes and macros used to implement RTTI in You.i Engine. ...
Definition: YiSceneManager.h:110
A class used to represent a color value.
Definition: YiColor.h:31
Definition: YiSceneManager.h:107
friend class CYISceneManagerPriv
Definition: YiSceneManager.h:80
bool Update(bool bForceDirty, bool bForceRender=false)
Definition: YiSceneManager.h:95
MISSING_CLASS_HANDLING_MODE
Optional fallback rules for missing view types during scene loading.
Definition: YiSceneManager.h:142
void UpdateStagedScenes()
void UpdateScene(CYISceneView *pRoot)
const int32_t YI_LONG_PRESS_MOVE_TOLERANCE
Definition: YiSceneManager.h:43
Definition: YiSceneManager.h:145
Stores data related to a user Action event.
Definition: YiActionEvent.h:18
uint32_t GetUnstagedSceneCount() const
void QueueTimelineForPlayback(CYITimeline *pTimeline)
void HideScene(const CYIString &name)
friend class CYISceneNodeUtilityPriv
Definition: YiSceneManager.h:82
bool StageSceneAtBack(const CYIString &name)