2019-04-11 14:40:54 +08:00
|
|
|
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
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:
|
|
|
|
|
|
//
|
|
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
|
|
//
|
|
|
|
|
|
// 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
|
2019-12-23 18:05:08 +08:00
|
|
|
|
#include <kiwano/core/common.h>
|
|
|
|
|
|
#include <kiwano/core/time.h>
|
|
|
|
|
|
#include <kiwano/core/ObjectBase.h>
|
|
|
|
|
|
#include <kiwano/math/math.h>
|
2019-10-11 21:55:29 +08:00
|
|
|
|
#include <kiwano/2d/Transform.h>
|
|
|
|
|
|
#include <kiwano/2d/action/ActionManager.h>
|
2019-11-13 14:33:15 +08:00
|
|
|
|
#include <kiwano/core/TimerManager.h>
|
|
|
|
|
|
#include <kiwano/core/EventDispatcher.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
|
|
|
|
{
|
2019-12-23 18:05:08 +08:00
|
|
|
|
class Stage;
|
2019-08-12 18:30:42 +08:00
|
|
|
|
class Director;
|
2019-08-20 19:32:36 +08:00
|
|
|
|
class RenderTarget;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
KGE_DECLARE_SMART_PTR(Actor);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* \~chinese
|
2019-12-31 10:37:29 +08:00
|
|
|
|
* \defgroup Actors <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
2019-12-23 18:05:08 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* \addtogroup Actors
|
|
|
|
|
|
* @{
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* \~chinese
|
|
|
|
|
|
* @brief <EFBFBD><EFBFBD>ɫ
|
|
|
|
|
|
* @details <EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¡<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>ȹ<EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>Ҳ<EFBFBD>Ƕ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȹ<EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
*/
|
2019-08-12 18:30:42 +08:00
|
|
|
|
class KGE_API Actor
|
2019-08-18 10:23:54 +08:00
|
|
|
|
: public ObjectBase
|
2019-03-31 01:37:06 +08:00
|
|
|
|
, public TimerManager
|
|
|
|
|
|
, public ActionManager
|
|
|
|
|
|
, public EventDispatcher
|
2019-10-30 23:12:18 +08:00
|
|
|
|
, public IntrusiveListItem<ActorPtr>
|
2019-03-31 01:37:06 +08:00
|
|
|
|
{
|
2019-08-12 18:30:42 +08:00
|
|
|
|
friend class Director;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
friend class Transition;
|
2019-10-30 23:12:18 +08:00
|
|
|
|
friend IntrusiveList<ActorPtr>;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
public:
|
2019-12-31 10:37:29 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>ӳ<EFBFBD>Ա<EFBFBD>б<EFBFBD>
|
|
|
|
|
|
using Children = IntrusiveList<ActorPtr>;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ɫ<EFBFBD><C9AB><EFBFBD>»ص<C2BB><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
using UpdateCallback = Function<void(Duration)>;
|
2019-10-21 11:15:22 +08:00
|
|
|
|
|
2019-08-12 18:30:42 +08:00
|
|
|
|
Actor();
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>½<EFBFBD>ɫ
|
|
|
|
|
|
/// @details ÿ֡<C3BF><D6A1><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>ǰ<EFBFBD><C7B0><EFBFBD>øú<C3B8><C3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظú<D8B8><C3BA><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ֽ<EFBFBD>ɫ<EFBFBD>ĸ<EFBFBD><C4B8>´<EFBFBD><C2B4><EFBFBD>
|
|
|
|
|
|
/// @param dt <20><><EFBFBD><EFBFBD>һ<EFBFBD>θ<EFBFBD><CEB8>µ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
virtual void OnUpdate(Duration dt);
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>Ⱦ<EFBFBD><C8BE>ɫ
|
|
|
|
|
|
/// @details ÿ֡<C3BF><D6A1><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>ʱ<EFBFBD><CAB1><EFBFBD>øú<C3B8><C3BA><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD><EFBFBD>ظú<D8B8><C3BA><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// @param rt <20><>ȾĿ<C8BE><C4BF>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
virtual void OnRender(RenderTarget* rt);
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1>ʾ״̬
|
2019-11-07 18:16:28 +08:00
|
|
|
|
bool IsVisible() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1>Ӧ״̬
|
2019-11-07 18:16:28 +08:00
|
|
|
|
bool IsResponsible() const;
|
2019-04-08 14:15:27 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><CDB8><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
bool IsCascadeOpacityEnabled() const;
|
2019-07-29 13:42:13 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD>Ƶ<EFBFBD> Hash ֵ
|
2019-11-07 18:16:28 +08:00
|
|
|
|
size_t GetHashName() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ Z <20><>˳<EFBFBD><CBB3>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
int GetZOrder() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
Point const& GetPosition() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ x <20><><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetPositionX() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ y <20><><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetPositionY() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
Point const& GetScale() const;
|
2019-04-08 14:15:27 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetScaleX() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetScaleY() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD>нǶ<D0BD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
Point const& GetSkew() const;
|
2019-04-08 14:15:27 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>нǶ<D0BD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetSkewX() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>нǶ<D0BD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetSkewY() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1>ת<EFBFBD>Ƕ<EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetRotation() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetWidth() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>߶<EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetHeight() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1>С
|
2019-11-07 18:16:28 +08:00
|
|
|
|
Size const& GetSize() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD>ź<EFBFBD><C5BA>Ŀ<EFBFBD><C4BF><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetScaledWidth() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD>ź<EFBFBD><C5BA>ĸ߶<C4B8>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetScaledHeight() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD>ź<EFBFBD><C5BA>Ĵ<EFBFBD>С
|
2019-11-07 18:16:28 +08:00
|
|
|
|
Size GetScaledSize() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡê<C8A1><C3AA>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
Point const& GetAnchor() const;
|
2019-04-08 14:15:27 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ x <20><><EFBFBD><EFBFBD>ê<EFBFBD><C3AA>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetAnchorX() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ y <20><><EFBFBD><EFBFBD>ê<EFBFBD><C3AA>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetAnchorY() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<C8A1><CDB8><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetOpacity() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1>ʾ<CABE><CDB8><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
float GetDisplayedOpacity() const;
|
2019-07-29 13:42:13 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>任
|
2019-11-07 18:16:28 +08:00
|
|
|
|
Transform GetTransform() const;
|
2019-09-29 22:23:13 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ɫ
|
2019-11-07 18:16:28 +08:00
|
|
|
|
Actor* GetParent() const;
|
2019-09-29 22:23:13 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨
|
2019-11-07 18:16:28 +08:00
|
|
|
|
Stage* GetStage() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD>߿<EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
virtual Rect GetBounds() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD>а<EFBFBD>Χ<EFBFBD><CEA7>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
virtual Rect GetBoundingBox() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1>ά<EFBFBD>任<EFBFBD><E4BBBB><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
Matrix3x2 const& GetTransformMatrix() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1>ά<EFBFBD>任<EFBFBD><E4BBBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
Matrix3x2 const& GetTransformInverseMatrix() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>ý<EFBFBD>ɫ<EFBFBD>Ƿ<EFBFBD><C7B7>ɼ<EFBFBD>
|
|
|
|
|
|
void SetVisible(bool val);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
void SetName(String const& name);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
virtual void SetPosition(Point const& point);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
void SetPosition(float x, float y);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>ú<EFBFBD><C3BA><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
void SetPositionX(float x);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
void SetPositionY(float y);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
void Move(Vec2 const& v);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
void Move(float vx, float vy);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ (1.0, 1.0)
|
|
|
|
|
|
virtual void SetScale(Vec2 const& scale);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ (1.0, 1.0)
|
|
|
|
|
|
void SetScale(float scalex, float scaley);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>ô<EFBFBD><C3B4>нǶȣ<C7B6>Ĭ<EFBFBD><C4AC>Ϊ (0, 0)
|
|
|
|
|
|
virtual void SetSkew(Vec2 const& skew);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>ô<EFBFBD><C3B4>нǶȣ<C7B6>Ĭ<EFBFBD><C4AC>Ϊ (0, 0)
|
|
|
|
|
|
void SetSkew(float skewx, float skewy);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD>Ƕȣ<C7B6>Ĭ<EFBFBD><C4AC>Ϊ 0
|
|
|
|
|
|
virtual void SetRotation(float rotation);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>ê<EFBFBD><C3AA>λ<EFBFBD>ã<EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ (0, 0), <20><>Χ [0, 1]
|
|
|
|
|
|
virtual void SetAnchor(Vec2 const& anchor);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>ê<EFBFBD><C3AA>λ<EFBFBD>ã<EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ (0, 0), <20><>Χ [0, 1]
|
|
|
|
|
|
void SetAnchor(float anchorx, float anchory);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>Ŀ<DEB8><C4BF><EFBFBD>
|
|
|
|
|
|
virtual void SetWidth(float width);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>ĸ߶<C4B8>
|
|
|
|
|
|
virtual void SetHeight(float height);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>Ĵ<DEB8>С
|
|
|
|
|
|
virtual void SetSize(Size const& size);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>Ĵ<DEB8>С
|
|
|
|
|
|
void SetSize(float width, float height);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><CDB8><EFBFBD>ȣ<EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ 1.0, <20><>Χ [0, 1]
|
|
|
|
|
|
virtual void SetOpacity(float opacity);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><CDB8><EFBFBD><EFBFBD>
|
|
|
|
|
|
void SetCascadeOpacityEnabled(bool enabled);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>ö<EFBFBD>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><EFBFBD>任
|
|
|
|
|
|
void SetTransform(Transform const& transform);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD> Z <20><>˳<EFBFBD><CBB3><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ 0
|
|
|
|
|
|
void SetZOrder(int zorder);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>ý<EFBFBD>ɫ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>Ĭ<EFBFBD><C4AC>Ϊ false
|
|
|
|
|
|
/// @details <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>Ľ<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Hover | Out | Click <20><>Ϣ
|
|
|
|
|
|
void SetResponsible(bool enable);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD>ɫ
|
|
|
|
|
|
void AddChild(ActorPtr child, int zorder = 0);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD>ɫ
|
|
|
|
|
|
void AddChild(Actor* child, int zorder = 0);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD>ӽ<EFBFBD>ɫ
|
|
|
|
|
|
void AddChildren(Vector<ActorPtr> const& children);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ӽ<EFBFBD>ɫ
|
|
|
|
|
|
Actor* GetChild(String const& name) const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ӽ<EFBFBD>ɫ
|
|
|
|
|
|
Vector<ActorPtr> GetChildren(String const& name) const;
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡȫ<C8A1><C8AB><EFBFBD>ӽ<EFBFBD>ɫ
|
2019-10-31 20:34:38 +08:00
|
|
|
|
Children& GetAllChildren();
|
|
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡȫ<C8A1><C8AB><EFBFBD>ӽ<EFBFBD>ɫ
|
2019-10-21 11:15:22 +08:00
|
|
|
|
Children const& GetAllChildren() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>Ƴ<EFBFBD><C6B3>ӽ<EFBFBD>ɫ
|
|
|
|
|
|
void RemoveChild(ActorPtr child);
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>Ƴ<EFBFBD><C6B3>ӽ<EFBFBD>ɫ
|
|
|
|
|
|
void RemoveChild(Actor* child);
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ӽ<EFBFBD>ɫ
|
|
|
|
|
|
void RemoveChildren(String const& child_name);
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD>н<EFBFBD>ɫ
|
2019-03-31 01:37:06 +08:00
|
|
|
|
void RemoveAllChildren();
|
|
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>Ӹ<EFBFBD><D3B8><EFBFBD>ɫ<EFBFBD>Ƴ<EFBFBD>
|
2019-03-31 01:37:06 +08:00
|
|
|
|
void RemoveFromParent();
|
|
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>жϵ<D0B6><CFB5>Ƿ<EFBFBD><C7B7>ڽ<EFBFBD>ɫ<EFBFBD><C9AB>
|
2019-08-20 21:15:15 +08:00
|
|
|
|
virtual bool ContainsPoint(const Point& point) const;
|
2019-08-14 00:28:25 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ͣ<EFBFBD><CDA3>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
void PauseUpdating();
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
void ResumeUpdating();
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ͣ
|
2019-11-07 18:16:28 +08:00
|
|
|
|
bool IsUpdatePausing() const;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD>ʱ<EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
void SetCallbackOnUpdate(UpdateCallback const& cb);
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ʱ<EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
UpdateCallback GetCallbackOnUpdate() const;
|
2019-07-31 10:12:59 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>Ⱦ<EFBFBD><C8BE>ɫ<EFBFBD>߽<EFBFBD>
|
2019-11-07 18:16:28 +08:00
|
|
|
|
void ShowBorder(bool show);
|
|
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20>ַ<EFBFBD><D6B7>¼<EFBFBD>
|
2019-11-14 13:18:16 +08:00
|
|
|
|
void Dispatch(Event& evt) override;
|
2019-11-07 18:16:28 +08:00
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ê<EFBFBD><C3AA>
|
|
|
|
|
|
static void SetDefaultAnchor(float anchor_x, float anchor_y);
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-12-30 14:24:29 +08:00
|
|
|
|
/// \~chinese
|
2019-12-31 10:37:29 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD>ɫ
|
2019-04-14 22:37:05 +08:00
|
|
|
|
virtual void Update(Duration dt);
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-30 14:24:29 +08:00
|
|
|
|
/// \~chinese
|
2019-12-31 10:37:29 +08:00
|
|
|
|
/// @brief <20><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD>ɫ
|
2019-08-20 19:32:36 +08:00
|
|
|
|
virtual void Render(RenderTarget* rt);
|
2019-08-14 00:28:25 +08:00
|
|
|
|
|
2019-12-30 14:24:29 +08:00
|
|
|
|
/// \~chinese
|
2019-12-31 10:37:29 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD>ɫ<EFBFBD>ı߽<C4B1>
|
2019-08-20 19:32:36 +08:00
|
|
|
|
virtual void RenderBorder(RenderTarget* rt);
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-12-30 14:24:29 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ȾĿ<C8BE><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2019-08-27 15:29:32 +08:00
|
|
|
|
virtual bool CheckVisibilty(RenderTarget* rt) const;
|
|
|
|
|
|
|
2019-12-30 14:24:29 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><>Ⱦǰ<C8BE><C7B0>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ȾĿ<C8BE><C4BF>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CheckVisibilty <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>øú<C3B8><C3BA><EFBFBD>
|
|
|
|
|
|
virtual void PrepareToRender(RenderTarget* rt);
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
2019-12-31 10:37:29 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC>Ķ<EFBFBD>ά<EFBFBD>任<EFBFBD><E4BBBB><EFBFBD><EFBFBD>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD>ɫ
|
2019-03-31 01:37:06 +08:00
|
|
|
|
void UpdateTransform() const;
|
|
|
|
|
|
|
2019-12-30 14:24:29 +08:00
|
|
|
|
/// \~chinese
|
2019-12-31 10:37:29 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><CDB8><EFBFBD><EFBFBD>
|
2019-03-31 01:37:06 +08:00
|
|
|
|
void UpdateOpacity();
|
|
|
|
|
|
|
2019-12-30 14:24:29 +08:00
|
|
|
|
/// \~chinese
|
2019-12-31 10:37:29 +08:00
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD>ɫ<EFBFBD><C9AB>Z<EFBFBD><5A>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2019-06-06 12:56:38 +08:00
|
|
|
|
void Reorder();
|
|
|
|
|
|
|
2019-12-30 14:24:29 +08:00
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>ýڵ<C3BD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨
|
2019-08-20 19:32:36 +08:00
|
|
|
|
void SetStage(Stage* stage);
|
2019-07-31 10:12:59 +08:00
|
|
|
|
|
2019-10-31 20:34:38 +08:00
|
|
|
|
private:
|
2019-04-08 14:15:27 +08:00
|
|
|
|
bool visible_;
|
|
|
|
|
|
bool update_pausing_;
|
2019-07-29 13:42:13 +08:00
|
|
|
|
bool cascade_opacity_;
|
2019-07-31 10:12:59 +08:00
|
|
|
|
bool show_border_;
|
2019-08-27 15:29:32 +08:00
|
|
|
|
bool hover_;
|
|
|
|
|
|
bool pressed_;
|
|
|
|
|
|
bool responsible_;
|
2019-09-29 22:23:13 +08:00
|
|
|
|
int z_order_;
|
|
|
|
|
|
float opacity_;
|
|
|
|
|
|
float displayed_opacity_;
|
2019-08-12 18:30:42 +08:00
|
|
|
|
Actor* parent_;
|
|
|
|
|
|
Stage* stage_;
|
2019-10-12 11:26:41 +08:00
|
|
|
|
size_t hash_name_;
|
2019-04-08 14:15:27 +08:00
|
|
|
|
Point anchor_;
|
|
|
|
|
|
Size size_;
|
|
|
|
|
|
Children children_;
|
|
|
|
|
|
UpdateCallback cb_update_;
|
2019-07-29 12:58:17 +08:00
|
|
|
|
Transform transform_;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
|
2019-08-19 09:28:59 +08:00
|
|
|
|
bool is_fast_transform_;
|
2019-08-27 15:29:32 +08:00
|
|
|
|
mutable bool visible_in_rt_;
|
|
|
|
|
|
mutable bool dirty_visibility_;
|
2019-08-19 09:28:59 +08:00
|
|
|
|
mutable bool dirty_transform_;
|
|
|
|
|
|
mutable bool dirty_transform_inverse_;
|
2019-08-14 23:36:29 +08:00
|
|
|
|
mutable Matrix3x2 transform_matrix_;
|
|
|
|
|
|
mutable Matrix3x2 transform_matrix_inverse_;
|
2019-03-31 01:37:06 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2019-12-23 18:05:08 +08:00
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-11-07 18:16:28 +08:00
|
|
|
|
inline void Actor::OnUpdate(Duration dt)
|
|
|
|
|
|
{
|
|
|
|
|
|
KGE_NOT_USED(dt);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void Actor::OnRender(RenderTarget* rt)
|
|
|
|
|
|
{
|
|
|
|
|
|
KGE_NOT_USED(rt);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline bool Actor::IsVisible() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return visible_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline bool Actor::IsResponsible() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return responsible_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline bool Actor::IsCascadeOpacityEnabled() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return cascade_opacity_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline size_t Actor::GetHashName() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return hash_name_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline int Actor::GetZOrder() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return z_order_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline Point const& Actor::GetPosition() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return transform_.position;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetPositionX() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetPosition().x;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetPositionY() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetPosition().y;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline Point const& Actor::GetScale() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return transform_.scale;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetScaleX() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetScale().x;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetScaleY() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetScale().y;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline Point const& Actor::GetSkew() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return transform_.skew;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetSkewX() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetSkew().x;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetSkewY() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetSkew().y;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetRotation() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return transform_.rotation;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetWidth() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetSize().x;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetHeight() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetSize().y;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline Size const& Actor::GetSize() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return size_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetScaledWidth() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetWidth() * GetScaleX();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetScaledHeight() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetHeight() * GetScaleY();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline Size Actor::GetScaledSize() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return Size{ GetScaledWidth(), GetScaledHeight() };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline Point const& Actor::GetAnchor() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return anchor_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetAnchorX() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetAnchor().x;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetAnchorY() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetAnchor().y;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetOpacity() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return opacity_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline float Actor::GetDisplayedOpacity() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return displayed_opacity_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline Transform Actor::GetTransform() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return transform_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline Actor* Actor::GetParent() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return parent_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline Stage* Actor::GetStage() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return stage_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void Actor::PauseUpdating()
|
|
|
|
|
|
{
|
|
|
|
|
|
update_pausing_ = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void Actor::ResumeUpdating()
|
|
|
|
|
|
{
|
|
|
|
|
|
update_pausing_ = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline bool Actor::IsUpdatePausing() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return update_pausing_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void Actor::SetCallbackOnUpdate(UpdateCallback const& cb)
|
|
|
|
|
|
{
|
|
|
|
|
|
cb_update_ = cb;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline Actor::UpdateCallback Actor::GetCallbackOnUpdate() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return cb_update_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void Actor::ShowBorder(bool show)
|
|
|
|
|
|
{
|
|
|
|
|
|
show_border_ = show;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void Actor::SetPosition(float x, float y)
|
|
|
|
|
|
{
|
|
|
|
|
|
SetPosition(Point{ x, y });
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void Actor::Move(float vx, float vy)
|
|
|
|
|
|
{
|
|
|
|
|
|
Move(Vec2{ vx, vy });
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void Actor::SetScale(float scalex, float scaley)
|
|
|
|
|
|
{
|
|
|
|
|
|
SetScale(Vec2{ scalex, scaley });
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void Actor::SetAnchor(float anchorx, float anchory)
|
|
|
|
|
|
{
|
|
|
|
|
|
SetAnchor(Vec2{ anchorx, anchory });
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void Actor::SetSize(float width, float height)
|
|
|
|
|
|
{
|
|
|
|
|
|
SetSize(Size{ width, height });
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void Actor::SetSkew(float skewx, float skewy)
|
|
|
|
|
|
{
|
|
|
|
|
|
SetSkew(Vec2{ skewx, skewy });
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-03-31 01:37:06 +08:00
|
|
|
|
}
|