.. index:: pair: class; EE::Scene::Action .. _doxid-class_e_e_1_1_scene_1_1_action: class EE::Scene::Action ======================= .. toctree:: :hidden: enum_EE_Scene_Action_ActionType.rst Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class Action { public: // typedefs typedef std::function`&)> :target:`ActionCallback`; typedef :ref:`Uint64` :target:`UniqueID`; // enums enum :ref:`ActionType`; // construction virtual :target:`~Action`(); // methods virtual void :ref:`start`() = 0; virtual void :ref:`stop`() = 0; virtual void :ref:`update`(const :ref:`Time`& time) = 0; virtual bool :ref:`isDone`() = 0; virtual :ref:`Float` :ref:`getCurrentProgress`() = 0; virtual :ref:`Time` :ref:`getTotalTime`() = 0; virtual Action* :ref:`clone`() const; virtual Action* :ref:`reverse`() const; :ref:`Uint32` :ref:`getFlags`() const; void :ref:`setFlags`(const :ref:`Uint32`& flags); :ref:`UniqueID` :ref:`getTag`() const; void :ref:`setTag`(const :ref:`UniqueID`& tag); :ref:`Node`* :ref:`getTarget`() const; :ref:`Uint32` :ref:`addEventListener`(const :ref:`ActionType`& actionType, const :ref:`ActionCallback`& callback); Action* :ref:`on`(const :ref:`ActionType`& actionType, const :ref:`ActionCallback`& callback); void :ref:`removeEventListener`(const :ref:`Uint32`& callbackId); void :ref:`sendEvent`(const :ref:`ActionType`& actionType); void :ref:`setTarget`(:ref:`Node`* target); void :ref:`setId`(const :ref:`Action::UniqueID`& id); const :ref:`Action::UniqueID`& :ref:`getId`(); }; .. _details-class_e_e_1_1_scene_1_1_action: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Methods ------- .. index:: pair: function; start .. _doxid-class_e_e_1_1_scene_1_1_action_1a4e0f5a1c14da25d3e0dbca25109896e8: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void start() = 0 Starts the action. .. index:: pair: function; stop .. _doxid-class_e_e_1_1_scene_1_1_action_1a5355008f8203ee02adc0981b545fcd41: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void stop() = 0 Stops the actions (pause it, it will not reset the animation state). .. index:: pair: function; update .. _doxid-class_e_e_1_1_scene_1_1_action_1a3596d23c780f78198cba1d0f6d16cc78: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void update(const :ref:`Time`& time) = 0 Update the action state (shouldn't be called manually unless you actually now what you are doing) .. index:: pair: function; isDone .. _doxid-class_e_e_1_1_scene_1_1_action_1a872937113f0d83cc50c4dee8404c76d7: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual bool isDone() = 0 .. rubric:: Returns: If the action is completed. .. index:: pair: function; getCurrentProgress .. _doxid-class_e_e_1_1_scene_1_1_action_1ac2147d1f15bb7fc1998f94debd64520b: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual :ref:`Float` getCurrentProgress() = 0 .. rubric:: Returns: The current progress percentage. Normalized between 0 and 1. .. index:: pair: function; getTotalTime .. _doxid-class_e_e_1_1_scene_1_1_action_1a3a8f0d63f79bf16496b6a6147cf67d4a: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual :ref:`Time` getTotalTime() = 0 The total action time. .. index:: pair: function; clone .. _doxid-class_e_e_1_1_scene_1_1_action_1a48f42bea59447b62cfb156893187f6c3: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual Action* clone() const Clones the action. .. index:: pair: function; reverse .. _doxid-class_e_e_1_1_scene_1_1_action_1a65ad7b36c441f1bdd2cb68a13c3c8ec8: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual Action* reverse() const Clones and reverse the action sequence. Note: not all actions can be reversed. .. index:: pair: function; getFlags .. _doxid-class_e_e_1_1_scene_1_1_action_1ab17395e233598c3cff34350f2007a87c: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Uint32` getFlags() const .. rubric:: Returns: The action custom flags. .. index:: pair: function; setFlags .. _doxid-class_e_e_1_1_scene_1_1_action_1af7e0a9058430127834f919fafe872977: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setFlags(const :ref:`Uint32`& flags) Sets the action custom flags. .. index:: pair: function; getTag .. _doxid-class_e_e_1_1_scene_1_1_action_1a9df4e6f9ad45846b12fb1643156eb716: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`UniqueID` getTag() const .. rubric:: Returns: The action tag. .. index:: pair: function; setTag .. _doxid-class_e_e_1_1_scene_1_1_action_1a163c50a6dbadb4062125d04cd4c3edcb: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setTag(const :ref:`UniqueID`& tag) Sets a tag to identify and filter actions. .. index:: pair: function; getTarget .. _doxid-class_e_e_1_1_scene_1_1_action_1a64ac6a00634474cd5d9d5d768780a0f0: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Node`* getTarget() const The target node that the action is being applied. .. index:: pair: function; addEventListener .. _doxid-class_e_e_1_1_scene_1_1_action_1ae5133cc9b3ab7f519944166d965d14df: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Uint32` addEventListener(const :ref:`ActionType`& actionType, const :ref:`ActionCallback`& callback) Adds an event listener for a specific :ref:`Action::ActionType `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - actionType - The action type to receive the event notification. * - callback - The callback to receive the event notification. .. rubric:: Returns: An unique event callback ID. This can be use to remove the event listener with :ref:`Action::removeEventListener `. .. index:: pair: function; on .. _doxid-class_e_e_1_1_scene_1_1_action_1a963751d7f67bdec82564b1e9cd6d1d23: .. ref-code-block:: cpp :class: doxyrest-title-code-block Action* on(const :ref:`ActionType`& actionType, const :ref:`ActionCallback`& callback) Same as :ref:`Action::addEventListener ` .. index:: pair: function; removeEventListener .. _doxid-class_e_e_1_1_scene_1_1_action_1a5f99e8f2c571d95e5f9135785dbf7fe1: .. ref-code-block:: cpp :class: doxyrest-title-code-block void removeEventListener(const :ref:`Uint32`& callbackId) Removes an event listener previusly added. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - callbackId - The ID of the event listener returned by the :ref:`Action::addEventListener ` call. .. index:: pair: function; sendEvent .. _doxid-class_e_e_1_1_scene_1_1_action_1a441341242c87adce9dbe18f22d867e7c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void sendEvent(const :ref:`ActionType`& actionType) Manually emmit an event of type :ref:`Action::ActionType `. .. index:: pair: function; setTarget .. _doxid-class_e_e_1_1_scene_1_1_action_1a5475fa5de3dc9a9287b13ddc9ad9dcb0: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setTarget(:ref:`Node`* target) Sets the action :ref:`EE::Scene::Node ` target. .. index:: pair: function; setId .. _doxid-class_e_e_1_1_scene_1_1_action_1a156a3353959d057df50043de895193d4: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setId(const :ref:`Action::UniqueID`& id) Sets a unique ID to identify the action. .. index:: pair: function; getId .. _doxid-class_e_e_1_1_scene_1_1_action_1a7d2de98df89ad50aca54c31ed57b1e2c: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Action::UniqueID`& getId() .. rubric:: Returns: The unique action ID.