| 
									
										
										
										
											2019-04-11 14:40:54 +08:00
										 |  |  |  | // Copyright (c) 2016-2018 Kiwano - Nomango
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | //
 | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | // Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
					
						
							|  |  |  |  | // of this software and associated documentation files (the "Software"), to deal
 | 
					
						
							|  |  |  |  | // in the Software without restriction, including without limitation the rights
 | 
					
						
							|  |  |  |  | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
					
						
							|  |  |  |  | // copies of the Software, and to permit persons to whom the Software is
 | 
					
						
							|  |  |  |  | // furnished to do so, subject to the following conditions:
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | //
 | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | // The above copyright notice and this permission notice shall be included in
 | 
					
						
							|  |  |  |  | // all copies or substantial portions of the Software.
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | //
 | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
					
						
							|  |  |  |  | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
					
						
							|  |  |  |  | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
					
						
							|  |  |  |  | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
					
						
							|  |  |  |  | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
					
						
							|  |  |  |  | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
					
						
							|  |  |  |  | // THE SOFTWARE.
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | #pragma once
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | #include <kiwano/core/ObjectBase.h>
 | 
					
						
							|  |  |  |  | #include <kiwano/core/Time.h>
 | 
					
						
							|  |  |  |  | #include <kiwano/core/TimerManager.h>
 | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  | #include <kiwano/core/EventDispatcher.h>
 | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  | #include <kiwano/math/Math.h>
 | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  | #include <kiwano/2d/action/ActionManager.h>
 | 
					
						
							|  |  |  |  | #include <kiwano/2d/Component.h>
 | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-11 14:40:54 +08:00
										 |  |  |  | namespace kiwano | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | class Stage; | 
					
						
							|  |  |  |  | class Director; | 
					
						
							|  |  |  |  | class RenderContext; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-22 17:24:31 +08:00
										 |  |  |  | namespace physics | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | class PhysicBody; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-22 17:24:31 +08:00
										 |  |  |  | KGE_DECLARE_SMART_PTR(Actor); | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | /// \~chinese
 | 
					
						
							|  |  |  |  | /// @brief 角色列表
 | 
					
						
							|  |  |  |  | typedef IntrusiveList<ActorPtr> ActorList; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * \~chinese | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |  * \defgroup Actors 基础角色 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |  */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * \addtogroup Actors | 
					
						
							|  |  |  |  |  * @{ | 
					
						
							|  |  |  |  |  */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * \~chinese | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |  * @brief 角色 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |  * @details | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |  * 角色是舞台上最基本的元素,是完成渲染、更新、事件分发等功能的最小单位,也是动画、定时器、事件监听等功能的载体 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |  */ | 
					
						
							|  |  |  |  | class KGE_API Actor | 
					
						
							| 
									
										
										
										
											2020-02-20 18:22:52 +08:00
										 |  |  |  |     : public ObjectBase | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     , public TimerManager | 
					
						
							|  |  |  |  |     , public ActionManager | 
					
						
							|  |  |  |  |     , public EventDispatcher | 
					
						
							| 
									
										
										
										
											2020-02-15 17:32:32 +08:00
										 |  |  |  |     , protected IntrusiveListValue<ActorPtr> | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     friend class Director; | 
					
						
							|  |  |  |  |     friend class Transition; | 
					
						
							|  |  |  |  |     friend IntrusiveList<ActorPtr>; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 角色更新回调函数
 | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  |     typedef Function<void(Duration)> UpdateCallback; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 创建角色
 | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     static ActorPtr Create(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     Actor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     virtual ~Actor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 更新角色
 | 
					
						
							|  |  |  |  |     /// @details 每帧画面刷新前调用该函数,重载该函数以实现角色的更新处理
 | 
					
						
							|  |  |  |  |     /// @param dt 距上一次更新的时间间隔
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     virtual void OnUpdate(Duration dt); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 渲染角色
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     /// @details
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// 每帧画面刷新时调用该函数,默认不进行渲染,重载该函数以实现具体渲染过程
 | 
					
						
							|  |  |  |  |     /// @param ctx 渲染上下文
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     virtual void OnRender(RenderContext& ctx); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取显示状态
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     bool IsVisible() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取响应状态
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     bool IsResponsible() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 是否启用级联透明度
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     bool IsCascadeOpacityEnabled() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取名称的 Hash 值
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     size_t GetHashName() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取 Z 轴顺序
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     int GetZOrder() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取坐标
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  |     virtual Point GetPosition() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取 x 坐标
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     float GetPositionX() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取 y 坐标
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     float GetPositionY() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 获取大小
 | 
					
						
							|  |  |  |  |     virtual Size GetSize() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取宽度
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     float GetWidth() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取高度
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     float GetHeight() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取缩放后的宽度
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     float GetScaledWidth() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取缩放后的高度
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     float GetScaledHeight() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取缩放后的大小
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     Size GetScaledSize() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取锚点
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  |     virtual Point GetAnchor() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取 x 方向锚点
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     float GetAnchorX() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取 y 方向锚点
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     float GetAnchorY() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取透明度
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  |     virtual float GetOpacity() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取显示透明度
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     float GetDisplayedOpacity() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取旋转角度
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  |     virtual float GetRotation() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取缩放比例
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  |     virtual Point GetScale() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取横向缩放比例
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     float GetScaleX() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取纵向缩放比例
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     float GetScaleY() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取错切角度
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  |     virtual Point GetSkew() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取横向错切角度
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     float GetSkewX() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取纵向错切角度
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     float GetSkewY() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取变换
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     Transform GetTransform() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取父角色
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     Actor* GetParent() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取所在舞台
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     Stage* GetStage() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取边框
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     virtual Rect GetBounds() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取外切包围盒
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     virtual Rect GetBoundingBox() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取二维变换矩阵
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  |     const Matrix3x2& GetTransformMatrix() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取二维变换的逆矩阵
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  |     const Matrix3x2& GetTransformInverseMatrix() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-22 17:24:31 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 获取变换到父角色的二维变换矩阵
 | 
					
						
							|  |  |  |  |     const Matrix3x2& GetTransformMatrixToParent() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置角色是否可见
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void SetVisible(bool val); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置名称
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     void SetName(const String& name); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置坐标
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     virtual void SetPosition(const Point& point); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置坐标
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void SetPosition(float x, float y); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置横坐标
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void SetPositionX(float x); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置纵坐标
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void SetPositionY(float y); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 移动坐标
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     void Move(const Vec2& v); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 移动坐标
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void Move(float vx, float vy); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置缩放比例,默认为 (1.0, 1.0)
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     virtual void SetScale(const Vec2& scale); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置缩放比例,默认为 (1.0, 1.0)
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void SetScale(float scalex, float scaley); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置错切角度,默认为 (0, 0)
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     virtual void SetSkew(const Vec2& skew); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置错切角度,默认为 (0, 0)
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void SetSkew(float skewx, float skewy); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置旋转角度,默认为 0
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     virtual void SetRotation(float rotation); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置锚点位置,默认为 (0, 0), 范围 [0, 1]
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     virtual void SetAnchor(const Vec2& anchor); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置锚点位置,默认为 (0, 0), 范围 [0, 1]
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void SetAnchor(float anchorx, float anchory); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 修改大小
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     virtual void SetSize(const Size& size); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 修改大小
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void SetSize(float width, float height); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 修改宽度
 | 
					
						
							|  |  |  |  |     void SetWidth(float width); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 修改高度
 | 
					
						
							|  |  |  |  |     void SetHeight(float height); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置透明度,默认为 1.0, 范围 [0, 1]
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     virtual void SetOpacity(float opacity); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 启用或禁用级联透明度
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void SetCascadeOpacityEnabled(bool enabled); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置二维仿射变换
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     void SetTransform(const Transform& transform); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置 Z 轴顺序,默认为 0
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void SetZOrder(int zorder); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置角色是否可响应,默认为 false
 | 
					
						
							|  |  |  |  |     /// @details 可响应的角色会收到鼠标的 Hover | Out | Click 消息
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void SetResponsible(bool enable); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 添加子角色
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void AddChild(ActorPtr child, int zorder = 0); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 添加多个子角色
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     void AddChildren(const Vector<ActorPtr>& children); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取名称相同的子角色
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     ActorPtr GetChild(const String& name) const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取所有名称相同的子角色
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     Vector<ActorPtr> GetChildren(const String& name) const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取全部子角色
 | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  |     ActorList& GetAllChildren(); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取全部子角色
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     const ActorList& GetAllChildren() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 移除子角色
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void RemoveChild(ActorPtr child); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 移除所有名称相同的子角色
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     void RemoveChildren(const String& child_name); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 移除所有角色
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void RemoveAllChildren(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 从父角色移除
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void RemoveFromParent(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 添加组件
 | 
					
						
							|  |  |  |  |     /// @param component 组件
 | 
					
						
							|  |  |  |  |     Component* AddComponent(ComponentPtr component); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 获取所有组件
 | 
					
						
							|  |  |  |  |     ComponentList& GetAllComponents(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 获取所有组件
 | 
					
						
							|  |  |  |  |     const ComponentList& GetAllComponents() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-19 11:50:05 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 移除组件
 | 
					
						
							|  |  |  |  |     void RemoveComponent(ComponentPtr component); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 移除组件
 | 
					
						
							|  |  |  |  |     /// @param name 组件名称
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     void RemoveComponents(const String& name); | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 移除所有组件
 | 
					
						
							|  |  |  |  |     void RemoveAllComponents(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 暂停角色更新
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void PauseUpdating(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 继续角色更新
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void ResumeUpdating(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 角色更新是否暂停
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     bool IsUpdatePausing() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置更新时的回调函数
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  |     void SetCallbackOnUpdate(const UpdateCallback& cb); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 获取更新时的回调函数
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     UpdateCallback GetCallbackOnUpdate() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-22 17:24:31 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 获取物理身体,仅当kiwano-physics包启用时生效
 | 
					
						
							|  |  |  |  |     physics::PhysicBody* GetPhysicBody() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 设置物理身体,仅当kiwano-physics包启用时生效
 | 
					
						
							|  |  |  |  |     void SetPhysicBody(physics::PhysicBody* body); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 判断点是否在角色内
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     virtual bool ContainsPoint(const Point& point) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-22 17:24:31 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 将世界坐标系点转换为局部坐标系点
 | 
					
						
							|  |  |  |  |     Point ConvertToLocal(const Point& point) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 将局部坐标系点转换为世界坐标系点
 | 
					
						
							|  |  |  |  |     Point ConvertToWorld(const Point& point) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 渲染角色边界
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void ShowBorder(bool show); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 分发事件
 | 
					
						
							|  |  |  |  |     /// @param evt 事件
 | 
					
						
							|  |  |  |  |     /// @return 是否继续分发该事件
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     virtual bool DispatchEvent(Event* evt); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置默认锚点
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     static void SetDefaultAnchor(float anchor_x, float anchor_y); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | protected: | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 更新自身和所有子角色
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     virtual void Update(Duration dt); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 渲染自身和所有子角色
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     virtual void Render(RenderContext& ctx); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 绘制自身和所有子角色的边界
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     virtual void RenderBorder(RenderContext& ctx); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 检查是否在渲染上下文的视区内
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     virtual bool CheckVisibility(RenderContext& ctx) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 渲染前初始化渲染上下文状态,仅当 CheckVisibility 返回真时调用该函数
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     virtual void PrepareToRender(RenderContext& ctx); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 更新自己的二维变换,并通知所有子角色
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void UpdateTransform() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 更新自己和所有子角色的透明度
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void UpdateOpacity(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 将所有子角色按Z轴顺序排序
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void Reorder(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 设置节点所在舞台
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     void SetStage(Stage* stage); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:32:04 +08:00
										 |  |  |  |     /// @brief 处理事件
 | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  |     bool HandleEvent(Event* evt); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-19 11:50:05 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 更新组件
 | 
					
						
							|  |  |  |  |     void UpdateComponents(Duration dt); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-23 14:56:14 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief 渲染组件
 | 
					
						
							|  |  |  |  |     void RenderComponents(RenderContext& ctx); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | private: | 
					
						
							|  |  |  |  |     bool           visible_; | 
					
						
							|  |  |  |  |     bool           update_pausing_; | 
					
						
							|  |  |  |  |     bool           cascade_opacity_; | 
					
						
							|  |  |  |  |     bool           show_border_; | 
					
						
							|  |  |  |  |     bool           hover_; | 
					
						
							|  |  |  |  |     bool           pressed_; | 
					
						
							|  |  |  |  |     bool           responsible_; | 
					
						
							|  |  |  |  |     int            z_order_; | 
					
						
							|  |  |  |  |     float          opacity_; | 
					
						
							|  |  |  |  |     float          displayed_opacity_; | 
					
						
							|  |  |  |  |     Actor*         parent_; | 
					
						
							|  |  |  |  |     Stage*         stage_; | 
					
						
							|  |  |  |  |     size_t         hash_name_; | 
					
						
							|  |  |  |  |     Point          anchor_; | 
					
						
							|  |  |  |  |     Size           size_; | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  |     ActorList      children_; | 
					
						
							|  |  |  |  |     ComponentList  components_; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     UpdateCallback cb_update_; | 
					
						
							|  |  |  |  |     Transform      transform_; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     bool              is_fast_transform_; | 
					
						
							|  |  |  |  |     mutable bool      visible_in_rt_; | 
					
						
							|  |  |  |  |     mutable bool      dirty_visibility_; | 
					
						
							|  |  |  |  |     mutable bool      dirty_transform_; | 
					
						
							|  |  |  |  |     mutable bool      dirty_transform_inverse_; | 
					
						
							|  |  |  |  |     mutable Matrix3x2 transform_matrix_; | 
					
						
							|  |  |  |  |     mutable Matrix3x2 transform_matrix_inverse_; | 
					
						
							| 
									
										
										
										
											2020-02-22 17:24:31 +08:00
										 |  |  |  |     mutable Matrix3x2 transform_matrix_to_parent_; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     physics::PhysicBody* physic_body_; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /** @} */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline void Actor::OnUpdate(Duration dt) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     KGE_NOT_USED(dt); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline void Actor::OnRender(RenderContext& ctx) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     KGE_NOT_USED(ctx); | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline bool Actor::IsVisible() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return visible_; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline bool Actor::IsResponsible() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return responsible_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-07-29 13:42:13 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline bool Actor::IsCascadeOpacityEnabled() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return cascade_opacity_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-01-09 08:45:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline size_t Actor::GetHashName() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return hash_name_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-01-09 08:45:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline int Actor::GetZOrder() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return z_order_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-01-09 08:45:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  | inline Point Actor::GetPosition() const | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     return transform_.position; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-01-09 08:45:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetPositionX() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return GetPosition().x; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-01-09 08:45:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetPositionY() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return GetPosition().y; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-01-09 08:45:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  | inline Point Actor::GetScale() const | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     return transform_.scale; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-01-09 08:45:00 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetScaleX() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return GetScale().x; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-09-29 22:23:13 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetScaleY() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return GetScale().y; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-09-29 22:23:13 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  | inline Point Actor::GetSkew() const | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     return transform_.skew; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetSkewX() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return GetSkew().x; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetSkewY() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return GetSkew().y; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetRotation() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return transform_.rotation; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetWidth() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return GetSize().x; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetHeight() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return GetSize().y; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  | inline Size Actor::GetSize() const | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     return size_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetScaledWidth() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return GetWidth() * GetScaleX(); | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetScaledHeight() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return GetHeight() * GetScaleY(); | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline Size Actor::GetScaledSize() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return Size{ GetScaledWidth(), GetScaledHeight() }; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  | inline Point Actor::GetAnchor() const | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     return anchor_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetAnchorX() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return GetAnchor().x; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetAnchorY() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return GetAnchor().y; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetOpacity() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return opacity_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline float Actor::GetDisplayedOpacity() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return displayed_opacity_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline Transform Actor::GetTransform() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return transform_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline Actor* Actor::GetParent() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return parent_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline Stage* Actor::GetStage() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return stage_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline void Actor::PauseUpdating() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     update_pausing_ = true; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline void Actor::ResumeUpdating() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     update_pausing_ = false; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline bool Actor::IsUpdatePausing() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return update_pausing_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  | inline void Actor::SetCallbackOnUpdate(const UpdateCallback& cb) | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     cb_update_ = cb; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline Actor::UpdateCallback Actor::GetCallbackOnUpdate() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return cb_update_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-22 17:24:31 +08:00
										 |  |  |  | inline physics::PhysicBody* Actor::GetPhysicBody() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return physic_body_; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline void Actor::SetPhysicBody(physics::PhysicBody* body) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     physic_body_ = body; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline void Actor::ShowBorder(bool show) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     show_border_ = show; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline void Actor::SetPosition(float x, float y) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  |     this->SetPosition(Point(x, y)); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline void Actor::SetPositionX(float x) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     this->SetPosition(Point(x, transform_.position.y)); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline void Actor::SetPositionY(float y) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     this->SetPosition(Point(transform_.position.x, y)); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-19 12:09:50 +08:00
										 |  |  |  | inline void Actor::Move(const Vec2& v) | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     this->SetPosition(transform_.position.x + v.x, transform_.position.y + v.y); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline void Actor::Move(float vx, float vy) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  |     this->Move(Vec2(vx, vy)); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline void Actor::SetScale(float scalex, float scaley) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  |     this->SetScale(Vec2(scalex, scaley)); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline void Actor::SetAnchor(float anchorx, float anchory) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  |     this->SetAnchor(Vec2(anchorx, anchory)); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline void Actor::SetSize(float width, float height) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  |     this->SetSize(Size(width, height)); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline void Actor::SetWidth(float width) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     this->SetSize(Size(width, size_.y)); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline void Actor::SetHeight(float height) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     this->SetSize(Size(size_.x, height)); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-11-07 18:16:28 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | inline void Actor::SetSkew(float skewx, float skewy) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-02-18 12:53:18 +08:00
										 |  |  |  |     this->SetSkew(Vec2(skewx, skewy)); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-02-17 12:06:29 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | }  // namespace kiwano
 |