diff --git a/Doxyfile b/Doxyfile
index 561ccec7..000da894 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -19,7 +19,7 @@ EXTRACT_PRIVATE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = NO
-HIDE_UNDOC_MEMBERS = YES
+HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
SHOW_INCLUDE_FILES = YES
@@ -61,12 +61,8 @@ PREDEFINED = KGE_API=
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
SEARCH_INCLUDES = YES
-INCLUDE_PATH = src/
-INCLUDE_FILE_PATTERNS = *.h \
- *.hh \
- *.hxx \
- *.hpp \
- *.h++
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
diff --git a/projects/kiwano/kiwano.vcxproj b/projects/kiwano/kiwano.vcxproj
index 9b035779..5cba8576 100644
--- a/projects/kiwano/kiwano.vcxproj
+++ b/projects/kiwano/kiwano.vcxproj
@@ -11,15 +11,14 @@
+
-
-
@@ -28,7 +27,7 @@
-
+
@@ -102,7 +101,7 @@
-
+
diff --git a/projects/kiwano/kiwano.vcxproj.filters b/projects/kiwano/kiwano.vcxproj.filters
index e78486cc..8429e755 100644
--- a/projects/kiwano/kiwano.vcxproj.filters
+++ b/projects/kiwano/kiwano.vcxproj.filters
@@ -25,9 +25,6 @@
{9314f30d-5742-48b6-94e5-e3b4284106f6}
-
- {86e2d0f2-a9d0-4456-b6a5-d480228bbf82}
-
{30333461-e9bc-4709-84bd-ce6e0e1a3079}
@@ -45,18 +42,12 @@
2d
-
- 2d
-
2d
2d
-
- 2d
-
2d
@@ -150,9 +141,6 @@
2d
-
- common
-
2d
@@ -276,6 +264,12 @@
platform
+
+ 2d
+
+
+ core
+
@@ -293,9 +287,6 @@
2d
-
- 2d
-
2d
@@ -458,5 +449,8 @@
platform
+
+ 2d
+
\ No newline at end of file
diff --git a/src/kiwano-audio/AudioEngine.h b/src/kiwano-audio/AudioEngine.h
index 9d0fb384..158810a9 100644
--- a/src/kiwano-audio/AudioEngine.h
+++ b/src/kiwano-audio/AudioEngine.h
@@ -19,7 +19,7 @@
// THE SOFTWARE.
#pragma once
-#include
+#include
#include
#include
#include
@@ -52,12 +52,12 @@ namespace kiwano
void DestroyComponent() override;
- protected:
+ private:
AudioEngine();
~AudioEngine();
- protected:
+ private:
IXAudio2* x_audio2_;
IXAudio2MasteringVoice* mastering_voice_;
};
diff --git a/src/kiwano-audio/Sound.h b/src/kiwano-audio/Sound.h
index 85e4add4..a247d307 100644
--- a/src/kiwano-audio/Sound.h
+++ b/src/kiwano-audio/Sound.h
@@ -84,7 +84,7 @@ namespace kiwano
float volume /* 1 为原始音量, 大于 1 为放大音量, 0 为最小音量 */
);
- protected:
+ private:
bool opened_;
bool playing_;
Transcoder transcoder_;
diff --git a/src/kiwano-audio/SoundPlayer.h b/src/kiwano-audio/SoundPlayer.h
index c7d3d91e..1b3f94f8 100644
--- a/src/kiwano-audio/SoundPlayer.h
+++ b/src/kiwano-audio/SoundPlayer.h
@@ -93,7 +93,7 @@ namespace kiwano
// 清除缓存
void ClearCache();
- protected:
+ private:
float volume_;
using SoundMap = Map;
diff --git a/src/kiwano-audio/Transcoder.cpp b/src/kiwano-audio/Transcoder.cpp
index 4ddd43e4..ed3705dd 100644
--- a/src/kiwano-audio/Transcoder.cpp
+++ b/src/kiwano-audio/Transcoder.cpp
@@ -23,7 +23,7 @@
#endif
#include
-#include
+#include
#include
#include
#include
diff --git a/src/kiwano-imgui/ImGuiLayer.h b/src/kiwano-imgui/ImGuiLayer.h
index 59921cc7..f2928783 100644
--- a/src/kiwano-imgui/ImGuiLayer.h
+++ b/src/kiwano-imgui/ImGuiLayer.h
@@ -54,7 +54,7 @@ namespace kiwano
public:
void OnRender(RenderTarget* rt) override;
- protected:
+ private:
Map pipelines_;
};
}
diff --git a/src/kiwano-imgui/ImGuiModule.cpp b/src/kiwano-imgui/ImGuiModule.cpp
index 1d79f6a7..d0fa9a0f 100644
--- a/src/kiwano-imgui/ImGuiModule.cpp
+++ b/src/kiwano-imgui/ImGuiModule.cpp
@@ -1,6 +1,6 @@
// Copyright (C) 2019 Nomango
-#include
+#include
#include
#include
#include
diff --git a/src/kiwano-imgui/ImGuiModule.h b/src/kiwano-imgui/ImGuiModule.h
index 5ec0e712..17fa3db5 100644
--- a/src/kiwano-imgui/ImGuiModule.h
+++ b/src/kiwano-imgui/ImGuiModule.h
@@ -19,8 +19,8 @@
// THE SOFTWARE.
#pragma once
+#include
#include
-#include
namespace kiwano
{
diff --git a/src/kiwano-network/HttpClient.h b/src/kiwano-network/HttpClient.h
index 17ccaf6a..5e69be8d 100644
--- a/src/kiwano-network/HttpClient.h
+++ b/src/kiwano-network/HttpClient.h
@@ -19,7 +19,7 @@
// THE SOFTWARE.
#pragma once
-#include
+#include
#include
#include
#include
diff --git a/src/kiwano-network/HttpRequest.h b/src/kiwano-network/HttpRequest.h
index a2617058..706e66f1 100644
--- a/src/kiwano-network/HttpRequest.h
+++ b/src/kiwano-network/HttpRequest.h
@@ -19,7 +19,7 @@
// THE SOFTWARE.
#pragma once
-#include
+#include
#include
#include
@@ -73,7 +73,7 @@ namespace kiwano
void SetResponseCallback(ResponseCallback const& callback);
ResponseCallback const& GetResponseCallback() const;
- protected:
+ private:
Type type_;
String url_;
String data_;
diff --git a/src/kiwano-network/HttpResponse.hpp b/src/kiwano-network/HttpResponse.hpp
index a2d043b0..5de8be60 100644
--- a/src/kiwano-network/HttpResponse.hpp
+++ b/src/kiwano-network/HttpResponse.hpp
@@ -56,7 +56,7 @@ namespace kiwano
String const& GetError() const;
void SetError(String const& error_buffer);
- protected:
+ private:
bool succeed_;
long response_code_;
HttpRequestPtr request_;
diff --git a/src/kiwano-physics/Body.h b/src/kiwano-physics/Body.h
index e9f25989..4a4e575b 100644
--- a/src/kiwano-physics/Body.h
+++ b/src/kiwano-physics/Body.h
@@ -161,10 +161,10 @@ namespace kiwano
void UpdateActor();
void UpdateFromActor();
- protected:
+ private:
void UpdateFixtureFilter(b2Fixture* fixture);
- protected:
+ private:
Actor* actor_;
World* world_;
b2Body* body_;
diff --git a/src/kiwano-physics/Contact.h b/src/kiwano-physics/Contact.h
index 0f0ee915..cf537862 100644
--- a/src/kiwano-physics/Contact.h
+++ b/src/kiwano-physics/Contact.h
@@ -72,7 +72,7 @@ namespace kiwano
const b2Contact* GetB2Contact() const { return contact_; }
void SetB2Contact(b2Contact* contact) { contact_ = contact; }
- protected:
+ private:
b2Contact* contact_;
};
@@ -104,7 +104,7 @@ namespace kiwano
const b2ContactEdge* GetB2ContactEdge() const { return edge_; }
void SetB2ContactEdge(b2ContactEdge* edge) { edge_ = edge; }
- protected:
+ private:
b2ContactEdge* edge_;
};
diff --git a/src/kiwano-physics/ContactEvent.h b/src/kiwano-physics/ContactEvent.h
index a01068f3..5dbdb460 100644
--- a/src/kiwano-physics/ContactEvent.h
+++ b/src/kiwano-physics/ContactEvent.h
@@ -26,8 +26,13 @@ namespace kiwano
{
namespace physics
{
+ /**
+ * \addtogroup Events
+ * @{
+ */
+
/// \~chinese
- /// @brief 接触开始事件
+ /// @brief 物理接触开始事件
class KGE_API ContactBeginEvent
: public Event
{
@@ -41,7 +46,7 @@ namespace kiwano
};
/// \~chinese
- /// @brief 接触结束事件
+ /// @brief 物理接触结束事件
class KGE_API ContactEndEvent
: public Event
{
@@ -53,5 +58,7 @@ namespace kiwano
ContactEndEvent();
ContactEndEvent(Contact const& contact);
};
+
+ /** @} */
}
}
diff --git a/src/kiwano-physics/Fixture.h b/src/kiwano-physics/Fixture.h
index 2097d5a2..f1edb18e 100644
--- a/src/kiwano-physics/Fixture.h
+++ b/src/kiwano-physics/Fixture.h
@@ -91,7 +91,7 @@ namespace kiwano
const b2Fixture* GetB2Fixture() const { return fixture_; }
void SetB2Fixture(b2Fixture* fixture) { fixture_ = fixture; }
- protected:
+ private:
b2Fixture* fixture_;
};
}
diff --git a/src/kiwano-physics/Joint.cpp b/src/kiwano-physics/Joint.cpp
index 05b209d7..c9ecd758 100644
--- a/src/kiwano-physics/Joint.cpp
+++ b/src/kiwano-physics/Joint.cpp
@@ -126,14 +126,14 @@ namespace kiwano
void DistanceJoint::SetLength(float length)
{
- KGE_ASSERT(raw_joint_ && world_);
- raw_joint_->SetLength(world_->Stage2World(length));
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ raw_joint_->SetLength(GetWorld()->Stage2World(length));
}
float DistanceJoint::GetLength() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetLength());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetLength());
}
//
@@ -181,14 +181,14 @@ namespace kiwano
void FrictionJoint::SetMaxTorque(float length)
{
- KGE_ASSERT(raw_joint_ && world_);
- raw_joint_->SetMaxTorque(world_->Stage2World(length));
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ raw_joint_->SetMaxTorque(GetWorld()->Stage2World(length));
}
float FrictionJoint::GetMaxTorque() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetMaxTorque());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetMaxTorque());
}
//
@@ -279,14 +279,14 @@ namespace kiwano
void MotorJoint::SetMaxTorque(float length)
{
- KGE_ASSERT(raw_joint_ && world_);
- raw_joint_->SetMaxTorque(world_->Stage2World(length));
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ raw_joint_->SetMaxTorque(GetWorld()->Stage2World(length));
}
float MotorJoint::GetMaxTorque() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetMaxTorque());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetMaxTorque());
}
//
@@ -326,32 +326,32 @@ namespace kiwano
float PrismaticJoint::GetJointTranslation() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetJointTranslation());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetJointTranslation());
}
float PrismaticJoint::GetJointSpeed() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetJointSpeed());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetJointSpeed());
}
float PrismaticJoint::GetLowerLimit() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetLowerLimit());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetLowerLimit());
}
float PrismaticJoint::GetUpperLimit() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetUpperLimit());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetUpperLimit());
}
void PrismaticJoint::SetLimits(float lower, float upper)
{
- KGE_ASSERT(raw_joint_ && world_);
- raw_joint_->SetLimits(world_->Stage2World(lower), world_->Stage2World(upper));
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ raw_joint_->SetLimits(GetWorld()->Stage2World(lower), GetWorld()->Stage2World(upper));
}
//
@@ -386,14 +386,14 @@ namespace kiwano
Point PulleyJoint::GetGroundAnchorA() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetGroundAnchorA());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetGroundAnchorA());
}
Point PulleyJoint::GetGroundAnchorB() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetGroundAnchorB());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetGroundAnchorB());
}
float PulleyJoint::GetRatio() const
@@ -404,26 +404,26 @@ namespace kiwano
float PulleyJoint::GetLengthA() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetLengthA());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetLengthA());
}
float PulleyJoint::GetLengthB() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetLengthB());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetLengthB());
}
float PulleyJoint::GetCurrentLengthA() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetCurrentLengthA());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetCurrentLengthA());
}
float PulleyJoint::GetCurrentLengthB() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetCurrentLengthB());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetCurrentLengthB());
}
//
@@ -463,44 +463,44 @@ namespace kiwano
float RevoluteJoint::GetJointAngle() const
{
- KGE_ASSERT(raw_joint_ && world_);
+ KGE_ASSERT(raw_joint_ && GetWorld());
return math::Radian2Degree(raw_joint_->GetJointAngle());
}
float RevoluteJoint::GetJointSpeed() const
{
- KGE_ASSERT(raw_joint_ && world_);
+ KGE_ASSERT(raw_joint_ && GetWorld());
return math::Radian2Degree(raw_joint_->GetJointSpeed());
}
float RevoluteJoint::GetLowerLimit() const
{
- KGE_ASSERT(raw_joint_ && world_);
+ KGE_ASSERT(raw_joint_ && GetWorld());
return math::Radian2Degree(raw_joint_->GetLowerLimit());
}
float RevoluteJoint::GetUpperLimit() const
{
- KGE_ASSERT(raw_joint_ && world_);
+ KGE_ASSERT(raw_joint_ && GetWorld());
return math::Radian2Degree(raw_joint_->GetUpperLimit());
}
void RevoluteJoint::SetLimits(float lower, float upper)
{
- KGE_ASSERT(raw_joint_ && world_);
+ KGE_ASSERT(raw_joint_ && GetWorld());
raw_joint_->SetLimits(math::Degree2Radian(lower), math::Degree2Radian(upper));
}
void RevoluteJoint::SetMaxMotorTorque(float torque)
{
- KGE_ASSERT(raw_joint_ && world_);
- raw_joint_->SetMaxMotorTorque(world_->Stage2World(torque));
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ raw_joint_->SetMaxMotorTorque(GetWorld()->Stage2World(torque));
}
float RevoluteJoint::GetMaxMotorTorque() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetMaxMotorTorque());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetMaxMotorTorque());
}
//
@@ -538,14 +538,14 @@ namespace kiwano
void RopeJoint::SetMaxLength(float length)
{
- KGE_ASSERT(raw_joint_ && world_);
- raw_joint_->SetMaxLength(world_->Stage2World(length));
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ raw_joint_->SetMaxLength(GetWorld()->Stage2World(length));
}
float RopeJoint::GetMaxLength() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetMaxLength());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetMaxLength());
}
//
@@ -615,26 +615,26 @@ namespace kiwano
float WheelJoint::GetJointTranslation() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetJointTranslation());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetJointTranslation());
}
float WheelJoint::GetJointLinearSpeed() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetJointLinearSpeed());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetJointLinearSpeed());
}
void WheelJoint::SetMaxMotorTorque(float torque)
{
- KGE_ASSERT(raw_joint_ && world_);
- raw_joint_->SetMaxMotorTorque(world_->Stage2World(torque));
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ raw_joint_->SetMaxMotorTorque(GetWorld()->Stage2World(torque));
}
float WheelJoint::GetMaxMotorTorque() const
{
- KGE_ASSERT(raw_joint_ && world_);
- return world_->World2Stage(raw_joint_->GetMaxMotorTorque());
+ KGE_ASSERT(raw_joint_ && GetWorld());
+ return GetWorld()->World2Stage(raw_joint_->GetMaxMotorTorque());
}
//
diff --git a/src/kiwano-physics/Joint.h b/src/kiwano-physics/Joint.h
index 1168d27f..61bf4660 100644
--- a/src/kiwano-physics/Joint.h
+++ b/src/kiwano-physics/Joint.h
@@ -86,7 +86,7 @@ namespace kiwano
World* GetWorld() { return world_; }
const World* GetWorld() const { return world_; }
- protected:
+ private:
b2Joint* joint_;
World* world_;
Type type_;
@@ -147,7 +147,7 @@ namespace kiwano
void SetDampingRatio(float ratio) { KGE_ASSERT(raw_joint_); raw_joint_->SetDampingRatio(ratio); }
float GetDampingRatio() const { KGE_ASSERT(raw_joint_); return raw_joint_->GetDampingRatio(); }
- protected:
+ private:
b2DistanceJoint* raw_joint_;
};
@@ -199,7 +199,7 @@ namespace kiwano
void SetMaxTorque(float torque);
float GetMaxTorque() const;
- protected:
+ private:
b2FrictionJoint* raw_joint_;
};
@@ -243,7 +243,7 @@ namespace kiwano
void SetRatio(float ratio);
float GetRatio() const;
- protected:
+ private:
b2GearJoint* raw_joint_;
};
@@ -295,7 +295,7 @@ namespace kiwano
void SetMaxTorque(float torque);
float GetMaxTorque() const;
- protected:
+ private:
b2MotorJoint* raw_joint_;
};
@@ -381,7 +381,7 @@ namespace kiwano
void SetMaxMotorForce(float force) { KGE_ASSERT(raw_joint_); raw_joint_->SetMaxMotorForce(force); }
float GetMaxMotorForce() const { KGE_ASSERT(raw_joint_); return raw_joint_->GetMaxMotorForce(); }
- protected:
+ private:
b2PrismaticJoint* raw_joint_;
};
@@ -444,7 +444,7 @@ namespace kiwano
float GetCurrentLengthA() const;
float GetCurrentLengthB() const;
- protected:
+ private:
b2PulleyJoint* raw_joint_;
};
@@ -526,7 +526,7 @@ namespace kiwano
void SetMaxMotorTorque(float torque);
float GetMaxMotorTorque() const;
- protected:
+ private:
b2RevoluteJoint* raw_joint_;
};
@@ -573,7 +573,7 @@ namespace kiwano
void SetMaxLength(float length);
float GetMaxLength() const;
- protected:
+ private:
b2RopeJoint* raw_joint_;
};
@@ -625,7 +625,7 @@ namespace kiwano
void SetDampingRatio(float ratio) { KGE_ASSERT(raw_joint_); raw_joint_->SetDampingRatio(ratio); }
float GetDampingRatio() const { KGE_ASSERT(raw_joint_); return raw_joint_->GetDampingRatio(); }
- protected:
+ private:
b2WeldJoint* raw_joint_;
};
@@ -707,7 +707,7 @@ namespace kiwano
void SetSpringDampingRatio(float ratio) { KGE_ASSERT(raw_joint_); raw_joint_->SetSpringDampingRatio(ratio); }
float GetSpringDampingRatio() const { KGE_ASSERT(raw_joint_); return raw_joint_->GetSpringDampingRatio(); }
- protected:
+ private:
b2WheelJoint* raw_joint_;
};
@@ -768,7 +768,7 @@ namespace kiwano
void SetDampingRatio(float ratio) { KGE_ASSERT(raw_joint_); raw_joint_->SetDampingRatio(ratio); }
float GetDampingRatio() const { KGE_ASSERT(raw_joint_); return raw_joint_->GetDampingRatio(); }
- protected:
+ private:
b2MouseJoint* raw_joint_;
};
}
diff --git a/src/kiwano-physics/Shape.h b/src/kiwano-physics/Shape.h
index 0d891f62..1e629d0c 100644
--- a/src/kiwano-physics/Shape.h
+++ b/src/kiwano-physics/Shape.h
@@ -40,7 +40,7 @@ namespace kiwano
virtual void FitWorld(World* world) {}
- protected:
+ private:
b2Shape* shape_;
};
@@ -57,7 +57,7 @@ namespace kiwano
void FitWorld(World* world) override;
- protected:
+ private:
float radius_;
Point offset_;
b2CircleShape circle_;
@@ -76,7 +76,7 @@ namespace kiwano
void FitWorld(World* world) override;
- protected:
+ private:
float rotation_;
Vec2 box_size_;
Point offset_;
@@ -96,7 +96,7 @@ namespace kiwano
void FitWorld(World* world) override;
- protected:
+ private:
Vector vertexs_;
b2PolygonShape polygon_;
};
@@ -114,7 +114,7 @@ namespace kiwano
void FitWorld(World* world) override;
- protected:
+ private:
Point p_[2];
b2EdgeShape edge_;
};
@@ -132,7 +132,7 @@ namespace kiwano
void FitWorld(World* world) override;
- protected:
+ private:
bool loop_;
Vector vertexs_;
b2ChainShape chain_;
diff --git a/src/kiwano/2d/Actor.h b/src/kiwano/2d/Actor.h
index 975c5338..9fcfc9fe 100644
--- a/src/kiwano/2d/Actor.h
+++ b/src/kiwano/2d/Actor.h
@@ -19,7 +19,10 @@
// THE SOFTWARE.
#pragma once
-#include
+#include
+#include
+#include
+#include
#include
#include
#include
@@ -27,10 +30,27 @@
namespace kiwano
{
+ class Stage;
class Director;
class RenderTarget;
- // 角色
+ KGE_DECLARE_SMART_PTR(Actor);
+
+ /**
+ * \~chinese
+ * \defgroup Actors 角色
+ */
+
+ /**
+ * \addtogroup Actors
+ * @{
+ */
+
+ /**
+ * \~chinese
+ * @brief 角色
+ * @details 角色是舞台上最基本的元素,是完成渲染、更新、事件分发等功能的最小单位,也是动画、定时器、事件监听等功能的载体
+ */
class KGE_API Actor
: public ObjectBase
, public TimerManager
@@ -48,330 +68,330 @@ namespace kiwano
Actor();
- // 更新角色
+ /// \~chinese
+ /// @brief 更新角色
+ /// @details 每帧画面刷新前调用该函数,重载该函数以实现角色的更新处理
+ /// @param dt 距上一次更新的时间间隔
virtual void OnUpdate(Duration dt);
- // 渲染角色
+ /// \~chinese
+ /// @brief 渲染角色
+ /// @details 每帧画面刷新时调用该函数,默认不进行渲染,重载该函数以实现具体渲染过程
+ /// @param rt 渲染目标
virtual void OnRender(RenderTarget* rt);
- // 获取显示状态
+ /// \~chinese
+ /// @brief 获取显示状态
bool IsVisible() const;
- // 获取响应状态
+ /// \~chinese
+ /// @brief 获取响应状态
bool IsResponsible() const;
- // 是否启用级联透明度
+ /// \~chinese
+ /// @brief 是否启用级联透明度
bool IsCascadeOpacityEnabled() const;
- // 获取名称的 Hash 值
+ /// \~chinese
+ /// @brief 获取名称的 Hash 值
size_t GetHashName() const;
- // 获取 Z 轴顺序
+ /// \~chinese
+ /// @brief 获取 Z 轴顺序
int GetZOrder() const;
- // 获取坐标
+ /// \~chinese
+ /// @brief 获取坐标
Point const& GetPosition() const;
- // 获取 x 坐标
+ /// \~chinese
+ /// @brief 获取 x 坐标
float GetPositionX() const;
- // 获取 y 坐标
+ /// \~chinese
+ /// @brief 获取 y 坐标
float GetPositionY() const;
- // 获取缩放比例
+ /// \~chinese
+ /// @brief 获取缩放比例
Point const& GetScale() const;
- // 获取横向缩放比例
+ /// \~chinese
+ /// @brief 获取横向缩放比例
float GetScaleX() const;
- // 获取纵向缩放比例
+ /// \~chinese
+ /// @brief 获取纵向缩放比例
float GetScaleY() const;
- // 获取错切角度
+ /// \~chinese
+ /// @brief 获取错切角度
Point const& GetSkew() const;
- // 获取横向错切角度
+ /// \~chinese
+ /// @brief 获取横向错切角度
float GetSkewX() const;
- // 获取纵向错切角度
+ /// \~chinese
+ /// @brief 获取纵向错切角度
float GetSkewY() const;
- // 获取旋转角度
+ /// \~chinese
+ /// @brief 获取旋转角度
float GetRotation() const;
- // 获取宽度
+ /// \~chinese
+ /// @brief 获取宽度
float GetWidth() const;
- // 获取高度
+ /// \~chinese
+ /// @brief 获取高度
float GetHeight() const;
- // 获取大小
+ /// \~chinese
+ /// @brief 获取大小
Size const& GetSize() const;
- // 获取缩放后的宽度
+ /// \~chinese
+ /// @brief 获取缩放后的宽度
float GetScaledWidth() const;
- // 获取缩放后的高度
+ /// \~chinese
+ /// @brief 获取缩放后的高度
float GetScaledHeight() const;
- // 获取缩放后的大小
+ /// \~chinese
+ /// @brief 获取缩放后的大小
Size GetScaledSize() const;
- // 获取锚点
+ /// \~chinese
+ /// @brief 获取锚点
Point const& GetAnchor() const;
- // 获取 x 方向锚点
+ /// \~chinese
+ /// @brief 获取 x 方向锚点
float GetAnchorX() const;
- // 获取 y 方向锚点
+ /// \~chinese
+ /// @brief 获取 y 方向锚点
float GetAnchorY() const;
- // 获取透明度
+ /// \~chinese
+ /// @brief 获取透明度
float GetOpacity() const;
- // 获取显示透明度
+ /// \~chinese
+ /// @brief 获取显示透明度
float GetDisplayedOpacity() const;
- // 获取变换
+ /// \~chinese
+ /// @brief 获取变换
Transform GetTransform() const;
- // 获取父角色
+ /// \~chinese
+ /// @brief 获取父角色
Actor* GetParent() const;
- // 获取所在舞台
+ /// \~chinese
+ /// @brief 获取所在舞台
Stage* GetStage() const;
- // 获取边框
+ /// \~chinese
+ /// @brief 获取边框
virtual Rect GetBounds() const;
- // 获取外切包围盒
+ /// \~chinese
+ /// @brief 获取外切包围盒
virtual Rect GetBoundingBox() const;
- // 获取二维变换矩阵
+ /// \~chinese
+ /// @brief 获取二维变换矩阵
Matrix3x2 const& GetTransformMatrix() const;
- // 获取二维变换的逆矩阵
+ /// \~chinese
+ /// @brief 获取二维变换的逆矩阵
Matrix3x2 const& GetTransformInverseMatrix() const;
- // 设置是否显示
- void SetVisible(
- bool val
- );
+ /// \~chinese
+ /// @brief 设置角色是否可见
+ void SetVisible(bool val);
- // 设置名称
- void SetName(
- String const& name
- );
+ /// \~chinese
+ /// @brief 设置名称
+ void SetName(String const& name);
- // 设置坐标
- virtual void SetPosition(
- Point const& point
- );
+ /// \~chinese
+ /// @brief 设置坐标
+ virtual void SetPosition(Point const& point);
- // 设置坐标
- void SetPosition(
- float x,
- float y
- );
+ /// \~chinese
+ /// @brief 设置坐标
+ void SetPosition(float x, float y);
- // 设置横坐标
- void SetPositionX(
- float x
- );
+ /// \~chinese
+ /// @brief 设置横坐标
+ void SetPositionX(float x);
- // 设置纵坐标
- void SetPositionY(
- float y
- );
+ /// \~chinese
+ /// @brief 设置纵坐标
+ void SetPositionY(float y);
- // 移动坐标
- void Move(
- Vec2 const& v
- );
+ /// \~chinese
+ /// @brief 移动坐标
+ void Move(Vec2 const& v);
- // 移动坐标
- void Move(
- float vx,
- float vy
- );
+ /// \~chinese
+ /// @brief 移动坐标
+ void Move(float vx, float vy);
- // 设置缩放比例
- // 默认为 (1.0, 1.0)
- virtual void SetScale(
- Vec2 const& scale
- );
+ /// \~chinese
+ /// @brief 设置缩放比例,默认为 (1.0, 1.0)
+ virtual void SetScale(Vec2 const& scale);
- // 设置缩放比例
- // 默认为 (1.0, 1.0)
- void SetScale(
- float scalex,
- float scaley
- );
+ /// \~chinese
+ /// @brief 设置缩放比例,默认为 (1.0, 1.0)
+ void SetScale(float scalex, float scaley);
- // 设置错切角度
- // 默认为 (0, 0)
- virtual void SetSkew(
- Vec2 const& skew
- );
+ /// \~chinese
+ /// @brief 设置错切角度,默认为 (0, 0)
+ virtual void SetSkew(Vec2 const& skew);
- // 设置错切角度
- // 默认为 (0, 0)
- void SetSkew(
- float skewx,
- float skewy
- );
+ /// \~chinese
+ /// @brief 设置错切角度,默认为 (0, 0)
+ void SetSkew(float skewx, float skewy);
- // 设置旋转角度
- // 默认为 0
- virtual void SetRotation(
- float rotation
- );
+ /// \~chinese
+ /// @brief 设置旋转角度,默认为 0
+ virtual void SetRotation(float rotation);
- // 设置锚点位置
- // 默认为 (0, 0), 范围 [0, 1]
- virtual void SetAnchor(
- Vec2 const& anchor
- );
+ /// \~chinese
+ /// @brief 设置锚点位置,默认为 (0, 0), 范围 [0, 1]
+ virtual void SetAnchor(Vec2 const& anchor);
- // 设置锚点位置
- // 默认为 (0, 0), 范围 [0, 1]
- void SetAnchor(
- float anchorx,
- float anchory
- );
+ /// \~chinese
+ /// @brief 设置锚点位置,默认为 (0, 0), 范围 [0, 1]
+ void SetAnchor(float anchorx, float anchory);
- // 修改宽度
- virtual void SetWidth(
- float width
- );
+ /// \~chinese
+ /// @brief 修改宽度
+ virtual void SetWidth(float width);
- // 修改高度
- virtual void SetHeight(
- float height
- );
+ /// \~chinese
+ /// @brief 修改高度
+ virtual void SetHeight(float height);
- // 修改大小
- virtual void SetSize(
- Size const& size
- );
+ /// \~chinese
+ /// @brief 修改大小
+ virtual void SetSize(Size const& size);
- // 修改大小
- void SetSize(
- float width,
- float height
- );
+ /// \~chinese
+ /// @brief 修改大小
+ void SetSize(float width, float height);
- // 设置透明度
- // 默认为 1.0, 范围 [0, 1]
- virtual void SetOpacity(
- float opacity
- );
+ /// \~chinese
+ /// @brief 设置透明度,默认为 1.0, 范围 [0, 1]
+ virtual void SetOpacity(float opacity);
- // 启用或禁用级联透明度
- void SetCascadeOpacityEnabled(
- bool enabled
- );
+ /// \~chinese
+ /// @brief 启用或禁用级联透明度
+ void SetCascadeOpacityEnabled(bool enabled);
- // 设置二维仿射变换
- void SetTransform(
- Transform const& transform
- );
+ /// \~chinese
+ /// @brief 设置二维仿射变换
+ void SetTransform(Transform const& transform);
- // 设置 Z 轴顺序
- // 默认为 0
- void SetZOrder(
- int zorder
- );
+ /// \~chinese
+ /// @brief 设置 Z 轴顺序,默认为 0
+ void SetZOrder(int zorder);
- // 是否可响应 (鼠标 Hover | Out | Click 消息)
- // 默认为 false
- void SetResponsible(
- bool enable
- );
+ /// \~chinese
+ /// @brief 设置角色是否可响应,默认为 false
+ /// @details 可响应的角色会收到鼠标的 Hover | Out | Click 消息
+ void SetResponsible(bool enable);
- // 添加子角色
- void AddChild(
- ActorPtr child,
- int zorder = 0
- );
+ /// \~chinese
+ /// @brief 添加子角色
+ void AddChild(ActorPtr child, int zorder = 0);
- // 添加子角色
- void AddChild(
- Actor* child,
- int zorder = 0
- );
+ /// \~chinese
+ /// @brief 添加子角色
+ void AddChild(Actor* child, int zorder = 0);
- // 添加多个子角色
- void AddChildren(
- Vector const& children
- );
+ /// \~chinese
+ /// @brief 添加多个子角色
+ void AddChildren(Vector const& children);
- // 获取名称相同的子角色
- Actor* GetChild(
- String const& name
- ) const;
+ /// \~chinese
+ /// @brief 获取名称相同的子角色
+ Actor* GetChild(String const& name) const;
- // 获取所有名称相同的子角色
- Vector GetChildren(
- String const& name
- ) const;
+ /// \~chinese
+ /// @brief 获取所有名称相同的子角色
+ Vector GetChildren(String const& name) const;
- // 获取全部子角色
+ /// \~chinese
+ /// @brief 获取全部子角色
Children& GetAllChildren();
- // 获取全部子角色
+ /// \~chinese
+ /// @brief 获取全部子角色
Children const& GetAllChildren() const;
- // 移除子角色
- void RemoveChild(
- ActorPtr child
- );
+ /// \~chinese
+ /// @brief 移除子角色
+ void RemoveChild(ActorPtr child);
- // 移除子角色
- void RemoveChild(
- Actor* child
- );
+ /// \~chinese
+ /// @brief 移除子角色
+ void RemoveChild(Actor* child);
- // 移除所有名称相同的子角色
- void RemoveChildren(
- String const& child_name
- );
+ /// \~chinese
+ /// @brief 移除所有名称相同的子角色
+ void RemoveChildren(String const& child_name);
- // 移除所有角色
+ /// \~chinese
+ /// @brief 移除所有角色
void RemoveAllChildren();
- // 从父角色移除
+ /// \~chinese
+ /// @brief 从父角色移除
void RemoveFromParent();
- // 判断点是否在角色内
+ /// \~chinese
+ /// @brief 判断点是否在角色内
virtual bool ContainsPoint(const Point& point) const;
- // 暂停角色更新
+ /// \~chinese
+ /// @brief 暂停角色更新
void PauseUpdating();
- // 继续角色更新
+ /// \~chinese
+ /// @brief 继续角色更新
void ResumeUpdating();
- // 角色更新是否暂停
+ /// \~chinese
+ /// @brief 角色更新是否暂停
bool IsUpdatePausing() const;
- // 设置更新时的回调函数
+ /// \~chinese
+ /// @brief 设置更新时的回调函数
void SetCallbackOnUpdate(UpdateCallback const& cb);
- // 获取更新时的回调函数
+ /// \~chinese
+ /// @brief 获取更新时的回调函数
UpdateCallback GetCallbackOnUpdate() const;
- // 渲染角色边界
+ /// \~chinese
+ /// @brief 渲染角色边界
void ShowBorder(bool show);
- // 事件分发
+ /// \~chinese
+ /// @brief 分发事件
void Dispatch(Event& evt) override;
- // 设置默认锚点
- static void SetDefaultAnchor(
- float anchor_x,
- float anchor_y
- );
+ /// \~chinese
+ /// @brief 设置默认锚点
+ static void SetDefaultAnchor(float anchor_x, float anchor_y);
protected:
virtual void Update(Duration dt);
@@ -421,6 +441,9 @@ namespace kiwano
mutable Matrix3x2 transform_matrix_inverse_;
};
+ /** @} */
+
+
inline void Actor::OnUpdate(Duration dt)
{
KGE_NOT_USED(dt);
diff --git a/src/kiwano/2d/Canvas.cpp b/src/kiwano/2d/Canvas.cpp
index 6799fbd0..8caf6a5b 100644
--- a/src/kiwano/2d/Canvas.cpp
+++ b/src/kiwano/2d/Canvas.cpp
@@ -254,13 +254,17 @@ namespace kiwano
}
}
- void Canvas::DrawText(String const& text, Point const& point)
+ void Canvas::DrawTextLayout(String const& text, Point const& point)
{
if (text.empty())
return;
TextLayout layout(text, text_font_, text_style_);
+ DrawTextLayout(layout, point);
+ }
+ void Canvas::DrawTextLayout(TextLayout const& layout, Point const& point)
+ {
rt_.DrawTextLayout(layout, point);
}
@@ -289,7 +293,7 @@ namespace kiwano
geo_sink_.AddBezier(point1, point2, point3);
}
- void Canvas::AddArc(Point const & point, Point const & radius, float rotation, bool clockwise, bool is_small)
+ void Canvas::AddArc(Point const & point, Size const & radius, float rotation, bool clockwise, bool is_small)
{
geo_sink_.AddArc(point, radius, rotation, clockwise, is_small);
}
diff --git a/src/kiwano/2d/Canvas.h b/src/kiwano/2d/Canvas.h
index b05976e8..46dcc086 100644
--- a/src/kiwano/2d/Canvas.h
+++ b/src/kiwano/2d/Canvas.h
@@ -22,224 +22,251 @@
#include
#include
-#ifdef DrawText
-# undef DrawText
-#endif
namespace kiwano
{
- // 画布
+ KGE_DECLARE_SMART_PTR(Canvas);
+
+ /**
+ * \addtogroup Actors
+ * @{
+ */
+
+ /**
+ * \~chinese
+ * @brief 画布,用于绘制图元
+ */
class KGE_API Canvas
: public Actor
{
public:
+ /// \~chinese
+ /// @brief 构建空画布
Canvas();
virtual ~Canvas();
- // 开始绘图
+ /// \~chinese
+ /// @brief 开始绘图
void BeginDraw();
- // 结束绘图
+ /// \~chinese
+ /// @brief 结束绘图
void EndDraw();
- // 画直线
- void DrawLine(
- Point const& begin,
- Point const& end
- );
+ /// \~chinese
+ /// @brief 画线段
+ /// @param begin 线段起点
+ /// @param end 线段终点
+ void DrawLine(Point const& begin, Point const& end);
- // 画圆形边框
- void DrawCircle(
- Point const& center,
- float radius
- );
+ /// \~chinese
+ /// @brief 画圆形边框
+ /// @param center 圆形原点
+ /// @param radius 圆形半径
+ void DrawCircle(Point const& center, float radius);
- // 画椭圆形边框
- void DrawEllipse(
- Point const& center,
- Vec2 const& radius
- );
+ /// \~chinese
+ /// @brief 画椭圆形边框
+ /// @param center 椭圆原点
+ /// @param radius 椭圆半径
+ void DrawEllipse(Point const& center, Vec2 const& radius);
- // 画矩形边框
- void DrawRect(
- Rect const& rect
- );
+ /// \~chinese
+ /// @brief 画矩形边框
+ /// @param rect 矩形
+ void DrawRect(Rect const& rect);
- // 画圆角矩形边框
- void DrawRoundedRect(
- Rect const& rect,
- Vec2 const& radius
- );
+ /// \~chinese
+ /// @brief 画圆角矩形边框
+ /// @param rect 矩形
+ /// @param radius 矩形圆角半径
+ void DrawRoundedRect(Rect const& rect, Vec2 const& radius);
- // 填充圆形
- void FillCircle(
- Point const& center,
- float radius
- );
+ /// \~chinese
+ /// @brief 填充圆形
+ /// @param center 圆形原点
+ /// @param radius 圆形半径
+ void FillCircle(Point const& center, float radius);
- // 填充椭圆形
- void FillEllipse(
- Point const& center,
- Vec2 const& radius
- );
+ /// \~chinese
+ /// @brief 填充椭圆形
+ /// @param center 椭圆原点
+ /// @param radius 椭圆半径
+ void FillEllipse(Point const& center, Vec2 const& radius);
- // 填充矩形
- void FillRect(
- Rect const& rect
- );
+ /// \~chinese
+ /// @brief 填充矩形
+ /// @param rect 矩形
+ void FillRect(Rect const& rect);
- // 填充圆角矩形
- void FillRoundedRect(
- Rect const& rect,
- Vec2 const& radius
- );
+ /// \~chinese
+ /// @brief 填充圆角矩形
+ /// @param rect 矩形
+ /// @param radius 矩形圆角半径
+ void FillRoundedRect(Rect const& rect, Vec2 const& radius);
- // 画图
- void DrawTexture(
- Texture const& texture,
- const Rect* src_rect = nullptr,
- const Rect* dest_rect = nullptr
- );
+ /// \~chinese
+ /// @brief 绘制纹理
+ /// @param texture 纹理
+ /// @param src_rect 纹理裁剪区域
+ /// @param dest_rect 绘制目标区域
+ void DrawTexture(Texture const& texture, const Rect* src_rect = nullptr, const Rect* dest_rect = nullptr);
- // 画文字
- void DrawText(
- String const& text, /* 文字 */
- Point const& point /* 文字位置 */
- );
+ /// \~chinese
+ /// @brief 绘制文字布局
+ /// @param text 文字
+ /// @param point 绘制文字的位置
+ void DrawTextLayout(String const& text, Point const& point);
- // 开始绘制路径
- void BeginPath(
- Point const& begin_pos /* 路径起始点 */
- );
+ /// \~chinese
+ /// @brief 绘制文字布局
+ /// @param layout 文字布局
+ /// @param point 绘制布局的位置
+ void DrawTextLayout(TextLayout const& layout, Point const& point);
- // 结束路径
- void EndPath(
- bool closed = true /* 路径是否闭合 */
- );
+ /// \~chinese
+ /// @brief 开始绘制路径
+ /// @param begin_pos 路径起始点
+ void BeginPath(Point const& begin_pos);
- // 添加一条线段
- void AddLine(
- Point const& point /* 端点 */
- );
+ /// \~chinese
+ /// @brief 结束路径
+ /// @param closed 路径是否闭合
+ void EndPath(bool closed = true);
- // 添加多条线段
- void AddLines(
- Vector const& points
- );
+ /// \~chinese
+ /// @brief 添加一条线段
+ /// @param point 端点
+ void AddLine(Point const& point);
- // 添加一条三次方贝塞尔曲线
- void AddBezier(
- Point const& point1, /* 贝塞尔曲线的第一个控制点 */
- Point const& point2, /* 贝塞尔曲线的第二个控制点 */
- Point const& point3 /* 贝塞尔曲线的终点 */
- );
+ /// \~chinese
+ /// @brief 添加多条线段
+ /// @param points 端点集合
+ void AddLines(Vector const& points);
- // 添加弧线
- void AddArc(
- Point const& point, /* 终点 */
- Point const& radius, /* 椭圆半径 */
- float rotation, /* 椭圆旋转角度 */
- bool clockwise = true, /* 顺时针 or 逆时针 */
- bool is_small = true /* 是否取小于 180° 的弧 */
- );
+ /// \~chinese
+ /// @brief 添加一条三次方贝塞尔曲线
+ /// @param point1 贝塞尔曲线的第一个控制点
+ /// @param point2 贝塞尔曲线的第二个控制点
+ /// @param point3 贝塞尔曲线的终点
+ void AddBezier(Point const& point1, Point const& point2, Point const& point3);
- // 路径描边
+ /// \~chinese
+ /// @brief 添加弧线
+ /// @param point 终点
+ /// @param radius 椭圆半径
+ /// @param rotation 椭圆旋转角度
+ /// @param clockwise 顺时针 or 逆时针
+ /// @param is_small 是否取小于 180° 的弧
+ void AddArc(Point const& point, Size const& radius, float rotation, bool clockwise = true, bool is_small = true);
+
+ /// \~chinese
+ /// @brief 以描边的方式绘制路径
void StrokePath();
- // 路径填充
+ /// \~chinese
+ /// @brief 以填充的方式绘制路径
void FillPath();
- // 清空画布
+ /// \~chinese
+ /// @brief 清空画布
void Clear();
- // 清空画布
- void Clear(
- Color const& clear_color
- );
+ /// \~chinese
+ /// @brief 清空画布
+ /// @param clear_color 清空颜色
+ void Clear(Color const& clear_color);
- // 设置填充颜色
- void SetFillColor(
- Color const& color
- );
+ /// \~chinese
+ /// @brief 设置填充颜色
+ /// @param color 填充颜色
+ void SetFillColor(Color const& color);
- // 设置轮廓颜色
- void SetStrokeColor(
- Color const& color
- );
+ /// \~chinese
+ /// @brief 设置轮廓颜色
+ /// @param color 轮廓颜色
+ void SetStrokeColor(Color const& color);
- // 设置轮廓宽度
- void SetStrokeWidth(
- float width
- );
+ /// \~chinese
+ /// @brief 设置轮廓宽度
+ /// @param width 轮廓宽度
+ void SetStrokeWidth(float width);
- // 设置轮廓样式
- void SetStrokeStyle(
- StrokeStyle stroke_style
- );
+ /// \~chinese
+ /// @brief 设置轮廓样式
+ /// @param stroke_style 轮廓样式
+ void SetStrokeStyle(StrokeStyle stroke_style);
- // 设置文字字体
- void SetTextFont(
- Font const& font
- );
+ /// \~chinese
+ /// @brief 设置文字字体
+ /// @param font 文字字体
+ void SetTextFont(Font const& font);
- // 设置文字画刷样式
- void SetTextStyle(
- TextStyle const& text_style
- );
+ /// \~chinese
+ /// @brief 设置文字画刷样式
+ /// @param text_style 文字画刷样式
+ void SetTextStyle(TextStyle const& text_style);
- // 设置画笔透明度
- void SetBrushOpacity(
- float opacity
- );
+ /// \~chinese
+ /// @brief 设置画笔透明度
+ /// @param opacity 透明度,范围 [0.0 - 1.0]
+ void SetBrushOpacity(float opacity);
- // 画笔二维变换
- void SetBrushTransform(
- Transform const& transform
- );
+ /// \~chinese
+ /// @brief 设置画笔二维变换
+ /// @param transform 二维变换
+ void SetBrushTransform(Transform const& transform);
- // 画笔二维变换
- void SetBrushTransform(
- Matrix3x2 const& transform
- );
+ /// \~chinese
+ /// @brief 设置画笔二维变换矩阵
+ /// @param transform 二维变换矩阵
+ void SetBrushTransform(Matrix3x2 const& transform);
- // 设置图层
- void PushLayerArea(
- LayerArea& area
- );
+ /// \~chinese
+ /// @brief 添加一个图层
+ /// @param area 图层区域
+ void PushLayerArea(LayerArea& area);
- // 弹出图层
+ /// \~chinese
+ /// @brief 删除最近添加的图层
void PopLayerArea();
- // 设置裁剪区域
- void PushClipRect(
- Rect const& clip_rect
- );
+ /// \~chinese
+ /// @brief 添加一个裁剪区域
+ /// @param clip_rect 裁剪矩形
+ void PushClipRect(Rect const& clip_rect);
- // 弹出裁剪区域
+ /// \~chinese
+ /// @brief 删除最近添加的裁剪区域
void PopClipRect();
- // 获取填充颜色
+ /// \~chinese
+ /// @brief 获取填充颜色
Color GetFillColor() const;
- // 获取轮廓颜色
+ /// \~chinese
+ /// @brief 获取轮廓颜色
Color GetStrokeColor() const;
- // 获取轮廓宽度
+ /// \~chinese
+ /// @brief 获取轮廓宽度
float GetStrokeWidth() const;
- // 获取画笔透明度
+ /// \~chinese
+ /// @brief 获取画笔透明度
float GetBrushOpacity() const;
- // 导出为图片
+ /// \~chinese
+ /// @brief 导出纹理
Texture ExportToTexture() const;
void OnRender(RenderTarget* rt) override;
- protected:
+ private:
void UpdateCache() const;
- protected:
+ private:
float stroke_width_;
Color fill_color_;
Color stroke_color_;
@@ -252,4 +279,7 @@ namespace kiwano
mutable Texture texture_cached_;
mutable TextureRenderTarget rt_;
};
+
+ /** @} */
+
}
diff --git a/src/kiwano/2d/DebugActor.cpp b/src/kiwano/2d/DebugActor.cpp
index 67613533..c64f3380 100644
--- a/src/kiwano/2d/DebugActor.cpp
+++ b/src/kiwano/2d/DebugActor.cpp
@@ -19,7 +19,6 @@
// THE SOFTWARE.
#include
-#include
#include
#include
@@ -31,7 +30,7 @@ namespace kiwano
{
class comma_numpunct : public std::numpunct
{
- protected:
+ private:
virtual wchar_t do_thousands_sep() const override
{
return L',';
@@ -42,6 +41,8 @@ namespace kiwano
return "\03";
}
};
+
+ std::locale comma_locale(std::locale(), new comma_numpunct);
}
DebugActor::DebugActor()
@@ -52,7 +53,7 @@ namespace kiwano
SetResponsible(true);
SetCascadeOpacityEnabled(true);
- debug_text_ = new Text;
+ debug_text_ = new TextActor;
debug_text_->SetPosition(Point{ 10, 10 });
this->AddChild(debug_text_);
@@ -94,11 +95,8 @@ namespace kiwano
StringStream ss;
- {
- // For formatting integers with commas
- static std::locale comma_locale(std::locale(), new comma_numpunct);
- (void)ss.imbue(comma_locale);
- }
+ // For formatting integers with commas
+ (void)ss.imbue(comma_locale);
ss << "Fps: " << frame_time_.size() << std::endl;
diff --git a/src/kiwano/2d/DebugActor.h b/src/kiwano/2d/DebugActor.h
index 7c4299e1..b2a4b996 100644
--- a/src/kiwano/2d/DebugActor.h
+++ b/src/kiwano/2d/DebugActor.h
@@ -20,9 +20,20 @@
#pragma once
#include
+#include
+#include
namespace kiwano
{
+ /**
+ * \addtogroup Actors
+ * @{
+ */
+
+ /**
+ * \~chinese
+ * @brief 调试节点
+ */
class KGE_API DebugActor
: public Actor
{
@@ -35,9 +46,12 @@ namespace kiwano
void OnUpdate(Duration dt) override;
- protected:
- Color background_color_;
- TextPtr debug_text_;
+ private:
+ Color background_color_;
+ TextActorPtr debug_text_;
Vector