From 709f2bfe8d0125e2030a714fe76c2029a5d3f9cc Mon Sep 17 00:00:00 2001 From: Nomango Date: Tue, 16 Oct 2018 14:13:15 +0800 Subject: [PATCH] change: rename namespace to easy2d. --- core/actions/Action.cpp | 30 ++-- core/actions/Animate.cpp | 22 +-- core/actions/Animation.cpp | 24 ++-- core/actions/Callback.cpp | 10 +- core/actions/Delay.cpp | 14 +- core/actions/FadeIn.cpp | 2 +- core/actions/FadeOut.cpp | 2 +- core/actions/FiniteTimeAction.cpp | 10 +- core/actions/JumpBy.cpp | 10 +- core/actions/JumpTo.cpp | 6 +- core/actions/Loop.cpp | 16 +-- core/actions/MoveBy.cpp | 10 +- core/actions/MoveTo.cpp | 6 +- core/actions/OpacityBy.cpp | 10 +- core/actions/OpacityTo.cpp | 6 +- core/actions/RotateBy.cpp | 10 +- core/actions/RotateTo.cpp | 6 +- core/actions/ScaleBy.cpp | 12 +- core/actions/ScaleTo.cpp | 8 +- core/actions/Sequence.cpp | 22 +-- core/actions/Spawn.cpp | 22 +-- core/components/Button.cpp | 34 ++--- core/components/Menu.cpp | 16 +-- core/e2daction.h | 2 +- core/e2dcomponent.h | 2 +- core/e2devent.h | 2 +- core/e2dimpl.h | 2 +- core/e2dmodule.h | 2 +- core/e2dobject.h | 2 +- core/e2dtool.h | 10 +- core/e2dtransition.h | 2 +- core/e2dutil.h | 6 +- core/events/KeyEvent.cpp | 8 +- core/events/MouseEvent.cpp | 22 +-- core/impl/TextRenderer.cpp | 2 +- core/modules/Audio.cpp | 10 +- core/modules/Device.cpp | 16 +-- core/modules/Game.cpp | 46 +++--- core/modules/Graphics.cpp | 30 ++-- core/modules/Input.cpp | 22 +-- core/objects/Canvas.cpp | 44 +++--- core/objects/Image.cpp | 50 +++---- core/objects/Node.cpp | 182 ++++++++++++------------ core/objects/Scene.cpp | 20 +-- core/objects/Sprite.cpp | 26 ++-- core/objects/Task.cpp | 18 +-- core/objects/Text.cpp | 84 +++++------ core/tools/Data.cpp | 24 ++-- core/tools/File.cpp | 30 ++-- core/tools/Music.cpp | 28 ++-- core/tools/Path.cpp | 8 +- core/tools/Player.cpp | 42 +++--- core/tools/Random.cpp | 2 +- core/transitions/BoxTransition.cpp | 6 +- core/transitions/EmergeTransition.cpp | 6 +- core/transitions/FadeTransition.cpp | 6 +- core/transitions/MoveTransition.cpp | 8 +- core/transitions/RotationTransition.cpp | 8 +- core/transitions/Transition.cpp | 14 +- core/utils/Color.cpp | 14 +- core/utils/Duration.cpp | 28 ++-- core/utils/Font.cpp | 4 +- core/utils/Function.cpp | 10 +- core/utils/Point.cpp | 22 +-- core/utils/Rect.cpp | 16 +-- core/utils/Ref.cpp | 10 +- core/utils/Resource.cpp | 2 +- core/utils/Size.cpp | 20 +-- core/utils/String.cpp | 138 +++++++++--------- core/utils/Time.cpp | 18 +-- core/utils/Transform.cpp | 6 +- 71 files changed, 694 insertions(+), 694 deletions(-) diff --git a/core/actions/Action.cpp b/core/actions/Action.cpp index 97afa3eb..4a0963d7 100644 --- a/core/actions/Action.cpp +++ b/core/actions/Action.cpp @@ -20,7 +20,7 @@ #include "..\e2daction.h" -e2d::Action::Action() +easy2d::Action::Action() : running_(false) , done_(false) , initialized_(false) @@ -28,71 +28,71 @@ e2d::Action::Action() { } -e2d::Action::~Action() +easy2d::Action::~Action() { } -bool e2d::Action::IsRunning() +bool easy2d::Action::IsRunning() { return running_; } -void e2d::Action::Resume() +void easy2d::Action::Resume() { running_ = true; } -void e2d::Action::Pause() +void easy2d::Action::Pause() { running_ = false; } -void e2d::Action::Stop() +void easy2d::Action::Stop() { done_ = true; } -const e2d::String& e2d::Action::GetName() const +const easy2d::String& easy2d::Action::GetName() const { return name_; } -void e2d::Action::SetName(const String& name) +void easy2d::Action::SetName(const String& name) { name_ = name; } -e2d::Node * e2d::Action::GetTarget() +easy2d::Node * easy2d::Action::GetTarget() { return target_; } -void e2d::Action::Reset() +void easy2d::Action::Reset() { initialized_ = false; done_ = false; started_ = Time::Now(); } -bool e2d::Action::IsDone() const +bool easy2d::Action::IsDone() const { return done_; } -void e2d::Action::StartWithTarget(Node* target) +void easy2d::Action::StartWithTarget(Node* target) { target_ = target; running_ = true; this->Reset(); } -void e2d::Action::Init() +void easy2d::Action::Init() { initialized_ = true; started_ = Time::Now(); } -void e2d::Action::Update() +void easy2d::Action::Update() { if (!initialized_) { @@ -100,6 +100,6 @@ void e2d::Action::Update() } } -void e2d::Action::ResetTime() +void easy2d::Action::ResetTime() { } diff --git a/core/actions/Animate.cpp b/core/actions/Animate.cpp index d4b5e146..89f97452 100644 --- a/core/actions/Animate.cpp +++ b/core/actions/Animate.cpp @@ -21,30 +21,30 @@ #include "..\e2daction.h" #include "..\e2dobject.h" -e2d::Animate::Animate() +easy2d::Animate::Animate() : frame_index_(0) , animation_(nullptr) { } -e2d::Animate::Animate(Animation * animation) +easy2d::Animate::Animate(Animation * animation) : frame_index_(0) , animation_(nullptr) { this->SetAnimation(animation); } -e2d::Animate::~Animate() +easy2d::Animate::~Animate() { SafeRelease(animation_); } -e2d::Animation * e2d::Animate::GetAnimation() const +easy2d::Animation * easy2d::Animate::GetAnimation() const { return animation_; } -void e2d::Animate::SetAnimation(Animation * animation) +void easy2d::Animate::SetAnimation(Animation * animation) { if (animation && animation != animation_) { @@ -58,7 +58,7 @@ void e2d::Animate::SetAnimation(Animation * animation) } } -void e2d::Animate::Init() +void easy2d::Animate::Init() { Action::Init(); @@ -70,7 +70,7 @@ void e2d::Animate::Init() } } -void e2d::Animate::Update() +void easy2d::Animate::Update() { Action::Update(); @@ -101,18 +101,18 @@ void e2d::Animate::Update() } } -void e2d::Animate::ResetTime() +void easy2d::Animate::ResetTime() { Action::ResetTime(); } -void e2d::Animate::Reset() +void easy2d::Animate::Reset() { Action::Reset(); frame_index_ = 0; } -e2d::Animate * e2d::Animate::Clone() const +easy2d::Animate * easy2d::Animate::Clone() const { if (animation_) { @@ -121,7 +121,7 @@ e2d::Animate * e2d::Animate::Clone() const return nullptr; } -e2d::Animate * e2d::Animate::Reverse() const +easy2d::Animate * easy2d::Animate::Reverse() const { if (animation_) { diff --git a/core/actions/Animation.cpp b/core/actions/Animation.cpp index 8d9e8ddc..97e1f3b8 100644 --- a/core/actions/Animation.cpp +++ b/core/actions/Animation.cpp @@ -20,29 +20,29 @@ #include "..\e2daction.h" -e2d::Animation::Animation() +easy2d::Animation::Animation() : interval_(1) { } -e2d::Animation::Animation(const Images& frames) +easy2d::Animation::Animation(const Images& frames) : interval_(1) { this->Add(frames); } -e2d::Animation::Animation(float interval) +easy2d::Animation::Animation(float interval) : interval_(interval) { } -e2d::Animation::Animation(float interval, const Images& frames) +easy2d::Animation::Animation(float interval, const Images& frames) : interval_(interval) { this->Add(frames); } -e2d::Animation::~Animation() +easy2d::Animation::~Animation() { for (auto frame : frames_) { @@ -50,12 +50,12 @@ e2d::Animation::~Animation() } } -void e2d::Animation::SetInterval(float interval) +void easy2d::Animation::SetInterval(float interval) { interval_ = std::max(interval, 0.f); } -void e2d::Animation::Add(Image * frame) +void easy2d::Animation::Add(Image * frame) { WARN_IF(frame == nullptr, "Animation::Add failed, frame Is nullptr."); if (frame) @@ -65,7 +65,7 @@ void e2d::Animation::Add(Image * frame) } } -void e2d::Animation::Add(const Images& frames) +void easy2d::Animation::Add(const Images& frames) { for (const auto &image : frames) { @@ -73,17 +73,17 @@ void e2d::Animation::Add(const Images& frames) } } -float e2d::Animation::GetInterval() const +float easy2d::Animation::GetInterval() const { return interval_; } -const e2d::Animation::Images& e2d::Animation::GetFrames() const +const easy2d::Animation::Images& easy2d::Animation::GetFrames() const { return frames_; } -e2d::Animation * e2d::Animation::Clone() const +easy2d::Animation * easy2d::Animation::Clone() const { auto animation = new Animation(interval_); if (animation) @@ -96,7 +96,7 @@ e2d::Animation * e2d::Animation::Clone() const return animation; } -e2d::Animation * e2d::Animation::Reverse() const +easy2d::Animation * easy2d::Animation::Reverse() const { auto& oldFrames = this->GetFrames(); Images frames(oldFrames.size()); diff --git a/core/actions/Callback.cpp b/core/actions/Callback.cpp index bf817a9e..f1a710fe 100644 --- a/core/actions/Callback.cpp +++ b/core/actions/Callback.cpp @@ -20,26 +20,26 @@ #include "..\e2daction.h" -e2d::Callback::Callback(const Function& func) : +easy2d::Callback::Callback(const Function& func) : callback_(func) { } -e2d::Callback * e2d::Callback::Clone() const +easy2d::Callback * easy2d::Callback::Clone() const { return new Callback(callback_); } -e2d::Callback * e2d::Callback::Reverse() const +easy2d::Callback * easy2d::Callback::Reverse() const { return new Callback(callback_); } -void e2d::Callback::Init() +void easy2d::Callback::Init() { } -void e2d::Callback::Update() +void easy2d::Callback::Update() { callback_(); this->Stop(); diff --git a/core/actions/Delay.cpp b/core/actions/Delay.cpp index 82523bdb..1ae664b1 100644 --- a/core/actions/Delay.cpp +++ b/core/actions/Delay.cpp @@ -20,34 +20,34 @@ #include "..\e2daction.h" -e2d::Delay::Delay(float duration) +easy2d::Delay::Delay(float duration) : delta_(0) , delay_(std::max(duration, 0.f)) { } -e2d::Delay * e2d::Delay::Clone() const +easy2d::Delay * easy2d::Delay::Clone() const { return new Delay(delay_); } -e2d::Delay * e2d::Delay::Reverse() const +easy2d::Delay * easy2d::Delay::Reverse() const { return new Delay(delay_); } -void e2d::Delay::Reset() +void easy2d::Delay::Reset() { Action::Reset(); delta_ = 0; } -void e2d::Delay::Init() +void easy2d::Delay::Init() { Action::Init(); } -void e2d::Delay::Update() +void easy2d::Delay::Update() { Action::Update(); @@ -59,7 +59,7 @@ void e2d::Delay::Update() } } -void e2d::Delay::ResetTime() +void easy2d::Delay::ResetTime() { Action::ResetTime(); started_ = Time::Now() - Duration(delta_); diff --git a/core/actions/FadeIn.cpp b/core/actions/FadeIn.cpp index f2e39366..1da6da97 100644 --- a/core/actions/FadeIn.cpp +++ b/core/actions/FadeIn.cpp @@ -20,7 +20,7 @@ #include "..\e2daction.h" -e2d::FadeIn::FadeIn(float duration) +easy2d::FadeIn::FadeIn(float duration) : OpacityTo(duration, 1) { } diff --git a/core/actions/FadeOut.cpp b/core/actions/FadeOut.cpp index 4cb0d0af..56f28eea 100644 --- a/core/actions/FadeOut.cpp +++ b/core/actions/FadeOut.cpp @@ -20,7 +20,7 @@ #include "..\e2daction.h" -e2d::FadeOut::FadeOut(float duration) +easy2d::FadeOut::FadeOut(float duration) : OpacityTo(duration, 0) { } diff --git a/core/actions/FiniteTimeAction.cpp b/core/actions/FiniteTimeAction.cpp index c7ab728f..963fd0f3 100644 --- a/core/actions/FiniteTimeAction.cpp +++ b/core/actions/FiniteTimeAction.cpp @@ -20,24 +20,24 @@ #include "..\e2daction.h" -e2d::FiniteTimeAction::FiniteTimeAction(float duration) +easy2d::FiniteTimeAction::FiniteTimeAction(float duration) : delta_(0) , duration_(std::max(duration, 0.f)) { } -void e2d::FiniteTimeAction::Reset() +void easy2d::FiniteTimeAction::Reset() { Action::Reset(); delta_ = 0; } -void e2d::FiniteTimeAction::Init() +void easy2d::FiniteTimeAction::Init() { Action::Init(); } -void e2d::FiniteTimeAction::Update() +void easy2d::FiniteTimeAction::Update() { Action::Update(); @@ -57,7 +57,7 @@ void e2d::FiniteTimeAction::Update() } } -void e2d::FiniteTimeAction::ResetTime() +void easy2d::FiniteTimeAction::ResetTime() { Action::ResetTime(); started_ = Time::Now() - Duration(delta_ * duration_); diff --git a/core/actions/JumpBy.cpp b/core/actions/JumpBy.cpp index 7c5056c1..4dc73317 100644 --- a/core/actions/JumpBy.cpp +++ b/core/actions/JumpBy.cpp @@ -21,7 +21,7 @@ #include "..\e2daction.h" #include "..\e2dobject.h" -e2d::JumpBy::JumpBy(float duration, const Point & vec, float height, int jumps) +easy2d::JumpBy::JumpBy(float duration, const Point & vec, float height, int jumps) : FiniteTimeAction(duration) , delta_pos_(vec) , height_(height) @@ -29,17 +29,17 @@ e2d::JumpBy::JumpBy(float duration, const Point & vec, float height, int jumps) { } -e2d::JumpBy * e2d::JumpBy::Clone() const +easy2d::JumpBy * easy2d::JumpBy::Clone() const { return new JumpBy(duration_, delta_pos_, height_, jumps_); } -e2d::JumpBy * e2d::JumpBy::Reverse() const +easy2d::JumpBy * easy2d::JumpBy::Reverse() const { return new JumpBy(duration_, -delta_pos_, height_, jumps_); } -void e2d::JumpBy::Init() +void easy2d::JumpBy::Init() { FiniteTimeAction::Init(); @@ -49,7 +49,7 @@ void e2d::JumpBy::Init() } } -void e2d::JumpBy::Update() +void easy2d::JumpBy::Update() { FiniteTimeAction::Update(); diff --git a/core/actions/JumpTo.cpp b/core/actions/JumpTo.cpp index afcc4821..3d3b4ef4 100644 --- a/core/actions/JumpTo.cpp +++ b/core/actions/JumpTo.cpp @@ -21,18 +21,18 @@ #include "..\e2daction.h" #include "..\e2dobject.h" -e2d::JumpTo::JumpTo(float duration, const Point & pos, float height, int jumps) +easy2d::JumpTo::JumpTo(float duration, const Point & pos, float height, int jumps) : JumpBy(duration, Point(), height, jumps) , end_pos_(pos) { } -e2d::JumpTo * e2d::JumpTo::Clone() const +easy2d::JumpTo * easy2d::JumpTo::Clone() const { return new JumpTo(duration_, end_pos_, height_, jumps_); } -void e2d::JumpTo::Init() +void easy2d::JumpTo::Init() { JumpBy::Init(); delta_pos_ = end_pos_ - start_pos_; diff --git a/core/actions/Loop.cpp b/core/actions/Loop.cpp index 852e36f8..774a6328 100644 --- a/core/actions/Loop.cpp +++ b/core/actions/Loop.cpp @@ -20,7 +20,7 @@ #include "..\e2daction.h" -e2d::Loop::Loop(Action * action, int times /* = -1 */) +easy2d::Loop::Loop(Action * action, int times /* = -1 */) : action_(action) , times_(0) , total_times_(times) @@ -34,12 +34,12 @@ e2d::Loop::Loop(Action * action, int times /* = -1 */) } } -e2d::Loop::~Loop() +easy2d::Loop::~Loop() { SafeRelease(action_); } -e2d::Loop * e2d::Loop::Clone() const +easy2d::Loop * easy2d::Loop::Clone() const { if (action_) { @@ -51,7 +51,7 @@ e2d::Loop * e2d::Loop::Clone() const } } -e2d::Loop * e2d::Loop::Reverse() const +easy2d::Loop * easy2d::Loop::Reverse() const { if (action_) { @@ -63,7 +63,7 @@ e2d::Loop * e2d::Loop::Reverse() const } } -void e2d::Loop::Init() +void easy2d::Loop::Init() { Action::Init(); @@ -74,7 +74,7 @@ void e2d::Loop::Init() } } -void e2d::Loop::Update() +void easy2d::Loop::Update() { Action::Update(); @@ -102,7 +102,7 @@ void e2d::Loop::Update() } } -void e2d::Loop::Reset() +void easy2d::Loop::Reset() { Action::Reset(); @@ -110,7 +110,7 @@ void e2d::Loop::Reset() times_ = 0; } -void e2d::Loop::ResetTime() +void easy2d::Loop::ResetTime() { if (action_) action_->ResetTime(); } diff --git a/core/actions/MoveBy.cpp b/core/actions/MoveBy.cpp index aef2537e..c18b44b3 100644 --- a/core/actions/MoveBy.cpp +++ b/core/actions/MoveBy.cpp @@ -22,13 +22,13 @@ #include "..\e2dobject.h" -e2d::MoveBy::MoveBy(float duration, Point vector) +easy2d::MoveBy::MoveBy(float duration, Point vector) : FiniteTimeAction(duration) { delta_pos_ = vector; } -void e2d::MoveBy::Init() +void easy2d::MoveBy::Init() { FiniteTimeAction::Init(); @@ -38,7 +38,7 @@ void e2d::MoveBy::Init() } } -void e2d::MoveBy::Update() +void easy2d::MoveBy::Update() { FiniteTimeAction::Update(); @@ -55,12 +55,12 @@ void e2d::MoveBy::Update() } } -e2d::MoveBy * e2d::MoveBy::Clone() const +easy2d::MoveBy * easy2d::MoveBy::Clone() const { return new MoveBy(duration_, delta_pos_); } -e2d::MoveBy * e2d::MoveBy::Reverse() const +easy2d::MoveBy * easy2d::MoveBy::Reverse() const { return new MoveBy(duration_, -delta_pos_); } \ No newline at end of file diff --git a/core/actions/MoveTo.cpp b/core/actions/MoveTo.cpp index 9e8e1467..0fdf1b12 100644 --- a/core/actions/MoveTo.cpp +++ b/core/actions/MoveTo.cpp @@ -21,18 +21,18 @@ #include "..\e2daction.h" #include "..\e2dobject.h" -e2d::MoveTo::MoveTo(float duration, Point pos) +easy2d::MoveTo::MoveTo(float duration, Point pos) : MoveBy(duration, Point()) { end_pos_ = pos; } -e2d::MoveTo * e2d::MoveTo::Clone() const +easy2d::MoveTo * easy2d::MoveTo::Clone() const { return new MoveTo(duration_, end_pos_); } -void e2d::MoveTo::Init() +void easy2d::MoveTo::Init() { MoveBy::Init(); delta_pos_ = end_pos_ - start_pos_; diff --git a/core/actions/OpacityBy.cpp b/core/actions/OpacityBy.cpp index 24656fbd..adf8acbb 100644 --- a/core/actions/OpacityBy.cpp +++ b/core/actions/OpacityBy.cpp @@ -22,13 +22,13 @@ #include "..\e2dobject.h" -e2d::OpacityBy::OpacityBy(float duration, float opacity) +easy2d::OpacityBy::OpacityBy(float duration, float opacity) : FiniteTimeAction(duration) { delta_val_ = opacity; } -void e2d::OpacityBy::Init() +void easy2d::OpacityBy::Init() { FiniteTimeAction::Init(); @@ -38,7 +38,7 @@ void e2d::OpacityBy::Init() } } -void e2d::OpacityBy::Update() +void easy2d::OpacityBy::Update() { FiniteTimeAction::Update(); @@ -48,12 +48,12 @@ void e2d::OpacityBy::Update() } } -e2d::OpacityBy * e2d::OpacityBy::Clone() const +easy2d::OpacityBy * easy2d::OpacityBy::Clone() const { return new OpacityBy(duration_, delta_val_); } -e2d::OpacityBy * e2d::OpacityBy::Reverse() const +easy2d::OpacityBy * easy2d::OpacityBy::Reverse() const { return new OpacityBy(duration_, -delta_val_); } \ No newline at end of file diff --git a/core/actions/OpacityTo.cpp b/core/actions/OpacityTo.cpp index 6fc0562e..e2126322 100644 --- a/core/actions/OpacityTo.cpp +++ b/core/actions/OpacityTo.cpp @@ -22,18 +22,18 @@ #include "..\e2dobject.h" -e2d::OpacityTo::OpacityTo(float duration, float opacity) +easy2d::OpacityTo::OpacityTo(float duration, float opacity) : OpacityBy(duration, 0) { end_val_ = opacity; } -e2d::OpacityTo * e2d::OpacityTo::Clone() const +easy2d::OpacityTo * easy2d::OpacityTo::Clone() const { return new OpacityTo(duration_, end_val_); } -void e2d::OpacityTo::Init() +void easy2d::OpacityTo::Init() { OpacityBy::Init(); delta_val_ = end_val_ - start_val_; diff --git a/core/actions/RotateBy.cpp b/core/actions/RotateBy.cpp index ea52bc59..17e650b5 100644 --- a/core/actions/RotateBy.cpp +++ b/core/actions/RotateBy.cpp @@ -22,13 +22,13 @@ #include "..\e2dobject.h" -e2d::RotateBy::RotateBy(float duration, float rotation) +easy2d::RotateBy::RotateBy(float duration, float rotation) : FiniteTimeAction(duration) { delta_val_ = rotation; } -void e2d::RotateBy::Init() +void easy2d::RotateBy::Init() { FiniteTimeAction::Init(); @@ -38,7 +38,7 @@ void e2d::RotateBy::Init() } } -void e2d::RotateBy::Update() +void easy2d::RotateBy::Update() { FiniteTimeAction::Update(); @@ -48,12 +48,12 @@ void e2d::RotateBy::Update() } } -e2d::RotateBy * e2d::RotateBy::Clone() const +easy2d::RotateBy * easy2d::RotateBy::Clone() const { return new RotateBy(duration_, delta_val_); } -e2d::RotateBy * e2d::RotateBy::Reverse() const +easy2d::RotateBy * easy2d::RotateBy::Reverse() const { return new RotateBy(duration_, -delta_val_); } \ No newline at end of file diff --git a/core/actions/RotateTo.cpp b/core/actions/RotateTo.cpp index 759dd011..00b9bec8 100644 --- a/core/actions/RotateTo.cpp +++ b/core/actions/RotateTo.cpp @@ -22,18 +22,18 @@ #include "..\e2dobject.h" -e2d::RotateTo::RotateTo(float duration, float rotation) +easy2d::RotateTo::RotateTo(float duration, float rotation) : RotateBy(duration, 0) { end_val_ = rotation; } -e2d::RotateTo * e2d::RotateTo::Clone() const +easy2d::RotateTo * easy2d::RotateTo::Clone() const { return new RotateTo(duration_, end_val_); } -void e2d::RotateTo::Init() +void easy2d::RotateTo::Init() { RotateBy::Init(); delta_val_ = end_val_ - start_val_; diff --git a/core/actions/ScaleBy.cpp b/core/actions/ScaleBy.cpp index caf171ad..63aa9689 100644 --- a/core/actions/ScaleBy.cpp +++ b/core/actions/ScaleBy.cpp @@ -22,21 +22,21 @@ #include "..\e2dobject.h" -e2d::ScaleBy::ScaleBy(float duration, float scale) +easy2d::ScaleBy::ScaleBy(float duration, float scale) : FiniteTimeAction(duration) { delta_x_ = scale; delta_y_ = scale; } -e2d::ScaleBy::ScaleBy(float duration, float scale_x, float scale_y) +easy2d::ScaleBy::ScaleBy(float duration, float scale_x, float scale_y) : FiniteTimeAction(duration) { delta_x_ = scale_x; delta_y_ = scale_y; } -void e2d::ScaleBy::Init() +void easy2d::ScaleBy::Init() { FiniteTimeAction::Init(); @@ -47,7 +47,7 @@ void e2d::ScaleBy::Init() } } -void e2d::ScaleBy::Update() +void easy2d::ScaleBy::Update() { FiniteTimeAction::Update(); @@ -57,12 +57,12 @@ void e2d::ScaleBy::Update() } } -e2d::ScaleBy * e2d::ScaleBy::Clone() const +easy2d::ScaleBy * easy2d::ScaleBy::Clone() const { return new ScaleBy(duration_, delta_x_, delta_y_); } -e2d::ScaleBy * e2d::ScaleBy::Reverse() const +easy2d::ScaleBy * easy2d::ScaleBy::Reverse() const { return new ScaleBy(duration_, -delta_x_, -delta_y_); } \ No newline at end of file diff --git a/core/actions/ScaleTo.cpp b/core/actions/ScaleTo.cpp index 2950b178..92a7f066 100644 --- a/core/actions/ScaleTo.cpp +++ b/core/actions/ScaleTo.cpp @@ -21,26 +21,26 @@ #include "..\e2daction.h" #include "..\e2dobject.h" -e2d::ScaleTo::ScaleTo(float duration, float scale) +easy2d::ScaleTo::ScaleTo(float duration, float scale) : ScaleBy(duration, 0, 0) { end_scale_x_ = scale; end_scale_y_ = scale; } -e2d::ScaleTo::ScaleTo(float duration, float scale_x, float scale_y) +easy2d::ScaleTo::ScaleTo(float duration, float scale_x, float scale_y) : ScaleBy(duration, 0, 0) { end_scale_x_ = scale_x; end_scale_y_ = scale_y; } -e2d::ScaleTo * e2d::ScaleTo::Clone() const +easy2d::ScaleTo * easy2d::ScaleTo::Clone() const { return new ScaleTo(duration_, end_scale_x_, end_scale_y_); } -void e2d::ScaleTo::Init() +void easy2d::ScaleTo::Init() { ScaleBy::Init(); delta_x_ = end_scale_x_ - start_scale_x_; diff --git a/core/actions/Sequence.cpp b/core/actions/Sequence.cpp index 3797e64f..6f4dc78d 100644 --- a/core/actions/Sequence.cpp +++ b/core/actions/Sequence.cpp @@ -20,18 +20,18 @@ #include "..\e2daction.h" -e2d::Sequence::Sequence() +easy2d::Sequence::Sequence() : action_index_(0) { } -e2d::Sequence::Sequence(const Actions& actions) +easy2d::Sequence::Sequence(const Actions& actions) : action_index_(0) { this->Add(actions); } -e2d::Sequence::~Sequence() +easy2d::Sequence::~Sequence() { for (auto action : actions_) { @@ -39,7 +39,7 @@ e2d::Sequence::~Sequence() } } -void e2d::Sequence::Init() +void easy2d::Sequence::Init() { Action::Init(); // 将所有动作与目标绑定 @@ -54,7 +54,7 @@ void e2d::Sequence::Init() actions_[0]->Init(); } -void e2d::Sequence::Update() +void easy2d::Sequence::Update() { Action::Update(); @@ -75,7 +75,7 @@ void e2d::Sequence::Update() } } -void e2d::Sequence::Reset() +void easy2d::Sequence::Reset() { Action::Reset(); for (const auto& action : actions_) @@ -85,7 +85,7 @@ void e2d::Sequence::Reset() action_index_ = 0; } -void e2d::Sequence::ResetTime() +void easy2d::Sequence::ResetTime() { for (const auto& action : actions_) { @@ -93,7 +93,7 @@ void e2d::Sequence::ResetTime() } } -void e2d::Sequence::Add(Action * action) +void easy2d::Sequence::Add(Action * action) { if (action) { @@ -102,7 +102,7 @@ void e2d::Sequence::Add(Action * action) } } -void e2d::Sequence::Add(const Actions& actions) +void easy2d::Sequence::Add(const Actions& actions) { for (const auto &action : actions) { @@ -110,7 +110,7 @@ void e2d::Sequence::Add(const Actions& actions) } } -e2d::Sequence * e2d::Sequence::Clone() const +easy2d::Sequence * easy2d::Sequence::Clone() const { auto sequence = new Sequence(); for (const auto& action : actions_) @@ -123,7 +123,7 @@ e2d::Sequence * e2d::Sequence::Clone() const return sequence; } -e2d::Sequence * e2d::Sequence::Reverse() const +easy2d::Sequence * easy2d::Sequence::Reverse() const { auto sequence = new Sequence(); if (sequence && !actions_.empty()) diff --git a/core/actions/Spawn.cpp b/core/actions/Spawn.cpp index 9e742c74..3ee4f42f 100644 --- a/core/actions/Spawn.cpp +++ b/core/actions/Spawn.cpp @@ -20,16 +20,16 @@ #include "..\e2daction.h" -e2d::Spawn::Spawn() +easy2d::Spawn::Spawn() { } -e2d::Spawn::Spawn(const Actions& actions) +easy2d::Spawn::Spawn(const Actions& actions) { this->Add(actions); } -e2d::Spawn::~Spawn() +easy2d::Spawn::~Spawn() { for (auto action : actions_) { @@ -37,7 +37,7 @@ e2d::Spawn::~Spawn() } } -void e2d::Spawn::Init() +void easy2d::Spawn::Init() { Action::Init(); @@ -51,7 +51,7 @@ void e2d::Spawn::Init() } } -void e2d::Spawn::Update() +void easy2d::Spawn::Update() { Action::Update(); @@ -74,7 +74,7 @@ void e2d::Spawn::Update() } } -void e2d::Spawn::Reset() +void easy2d::Spawn::Reset() { Action::Reset(); for (const auto& action : actions_) @@ -83,7 +83,7 @@ void e2d::Spawn::Reset() } } -void e2d::Spawn::ResetTime() +void easy2d::Spawn::ResetTime() { for (const auto& action : actions_) { @@ -91,7 +91,7 @@ void e2d::Spawn::ResetTime() } } -void e2d::Spawn::Add(Action * action) +void easy2d::Spawn::Add(Action * action) { if (action) { @@ -100,7 +100,7 @@ void e2d::Spawn::Add(Action * action) } } -void e2d::Spawn::Add(const Actions& actions) +void easy2d::Spawn::Add(const Actions& actions) { for (const auto &action : actions) { @@ -108,7 +108,7 @@ void e2d::Spawn::Add(const Actions& actions) } } -e2d::Spawn * e2d::Spawn::Clone() const +easy2d::Spawn * easy2d::Spawn::Clone() const { auto spawn = new Spawn(); for (const auto& action : actions_) @@ -121,7 +121,7 @@ e2d::Spawn * e2d::Spawn::Clone() const return spawn; } -e2d::Spawn * e2d::Spawn::Reverse() const +easy2d::Spawn * easy2d::Spawn::Reverse() const { auto spawn = new Spawn(); if (spawn && !actions_.empty()) diff --git a/core/components/Button.cpp b/core/components/Button.cpp index f9654e9e..75a677d1 100644 --- a/core/components/Button.cpp +++ b/core/components/Button.cpp @@ -37,7 +37,7 @@ } \ -e2d::Button::Button() +easy2d::Button::Button() : callback_(nullptr) , status_(Status::Normal) , enabled_(true) @@ -49,7 +49,7 @@ e2d::Button::Button() { } -e2d::Button::Button(Node * normal, const Function& func) +easy2d::Button::Button(Node * normal, const Function& func) : callback_(nullptr) , status_(Status::Normal) , enabled_(true) @@ -63,7 +63,7 @@ e2d::Button::Button(Node * normal, const Function& func) this->SetCallbackOnClick(func); } -e2d::Button::Button(Node * normal, Node * selected, const Function& func) +easy2d::Button::Button(Node * normal, Node * selected, const Function& func) : callback_(nullptr) , status_(Status::Normal) , enabled_(true) @@ -78,7 +78,7 @@ e2d::Button::Button(Node * normal, Node * selected, const Function& func) this->SetCallbackOnClick(func); } -e2d::Button::Button(Node * normal, Node * mouseover, Node * selected, const Function& func) +easy2d::Button::Button(Node * normal, Node * mouseover, Node * selected, const Function& func) : callback_(nullptr) , status_(Status::Normal) , enabled_(true) @@ -94,7 +94,7 @@ e2d::Button::Button(Node * normal, Node * mouseover, Node * selected, const Func this->SetCallbackOnClick(func); } -e2d::Button::Button(Node * normal, Node * mouseover, Node * selected, Node * disabled, const Function& func) +easy2d::Button::Button(Node * normal, Node * mouseover, Node * selected, Node * disabled, const Function& func) : callback_(nullptr) , status_(Status::Normal) , enabled_(true) @@ -111,12 +111,12 @@ e2d::Button::Button(Node * normal, Node * mouseover, Node * selected, Node * dis this->SetCallbackOnClick(func); } -bool e2d::Button::IsEnable() const +bool easy2d::Button::IsEnable() const { return enabled_; } -void e2d::Button::SetNormal(Node * normal) +void easy2d::Button::SetNormal(Node * normal) { SET_BUTTON_NODE(normal_, normal); if (normal) @@ -125,22 +125,22 @@ void e2d::Button::SetNormal(Node * normal) } } -void e2d::Button::SetMouseOver(Node * mouseover) +void easy2d::Button::SetMouseOver(Node * mouseover) { SET_BUTTON_NODE(mouseover_, mouseover); } -void e2d::Button::SetSelected(Node * selected) +void easy2d::Button::SetSelected(Node * selected) { SET_BUTTON_NODE(selected_, selected); } -void e2d::Button::SetDisabled(Node * disabled) +void easy2d::Button::SetDisabled(Node * disabled) { SET_BUTTON_NODE(disabled_, disabled); } -void e2d::Button::SetEnabled(bool enabled) +void easy2d::Button::SetEnabled(bool enabled) { if (enabled_ != enabled) { @@ -149,12 +149,12 @@ void e2d::Button::SetEnabled(bool enabled) } } -void e2d::Button::SetCallbackOnClick(const Function& func) +void easy2d::Button::SetCallbackOnClick(const Function& func) { callback_ = func; } -void e2d::Button::SetPivot(float pivot_x, float pivot_y) +void easy2d::Button::SetPivot(float pivot_x, float pivot_y) { Node::SetPivot(pivot_x, pivot_y); SAFE_SET(normal_, SetPivot, pivot_x, pivot_y); @@ -163,7 +163,7 @@ void e2d::Button::SetPivot(float pivot_x, float pivot_y) SAFE_SET(disabled_, SetPivot, pivot_x, pivot_y); } -bool e2d::Button::Dispatch(const MouseEvent & e, bool handled) +bool easy2d::Button::Dispatch(const MouseEvent & e, bool handled) { if (!handled && enabled_ && visible_ && normal_) { @@ -212,7 +212,7 @@ bool e2d::Button::Dispatch(const MouseEvent & e, bool handled) return Node::Dispatch(e, handled); } -void e2d::Button::Visit() +void easy2d::Button::Visit() { Node::Visit(); @@ -237,7 +237,7 @@ void e2d::Button::Visit() } } -void e2d::Button::SetStatus(Status status) +void easy2d::Button::SetStatus(Status status) { if (status_ != status) { @@ -246,7 +246,7 @@ void e2d::Button::SetStatus(Status status) } } -void e2d::Button::UpdateVisible() +void easy2d::Button::UpdateVisible() { SAFE_SET(normal_, SetVisible, false); SAFE_SET(mouseover_, SetVisible, false); diff --git a/core/components/Menu.cpp b/core/components/Menu.cpp index 57a0729d..fa0457ef 100644 --- a/core/components/Menu.cpp +++ b/core/components/Menu.cpp @@ -20,12 +20,12 @@ #include "..\e2dcomponent.h" -e2d::Menu::Menu() +easy2d::Menu::Menu() : enabled_(true) { } -e2d::Menu::Menu(const std::vector& buttons) +easy2d::Menu::Menu(const std::vector& buttons) : enabled_(true) { for (const auto& button : buttons) @@ -34,17 +34,17 @@ e2d::Menu::Menu(const std::vector& buttons) } } -bool e2d::Menu::IsEnable() const +bool easy2d::Menu::IsEnable() const { return enabled_; } -size_t e2d::Menu::GetButtonCount() const +size_t easy2d::Menu::GetButtonCount() const { return buttons_.size(); } -void e2d::Menu::SetEnabled(bool enabled) +void easy2d::Menu::SetEnabled(bool enabled) { if (enabled_ != enabled) { @@ -57,7 +57,7 @@ void e2d::Menu::SetEnabled(bool enabled) } } -void e2d::Menu::AddButton(Button * button) +void easy2d::Menu::AddButton(Button * button) { if (button) { @@ -67,7 +67,7 @@ void e2d::Menu::AddButton(Button * button) } } -bool e2d::Menu::RemoveButton(Button * button) +bool easy2d::Menu::RemoveButton(Button * button) { if (buttons_.empty()) { @@ -90,7 +90,7 @@ bool e2d::Menu::RemoveButton(Button * button) return false; } -const std::vector& e2d::Menu::GetAllButtons() const +const std::vector& easy2d::Menu::GetAllButtons() const { return buttons_; } diff --git a/core/e2daction.h b/core/e2daction.h index c1e908c4..7e943447 100644 --- a/core/e2daction.h +++ b/core/e2daction.h @@ -22,7 +22,7 @@ #include "e2dutil.h" #include "e2dobject.h" -namespace e2d +namespace easy2d { diff --git a/core/e2dcomponent.h b/core/e2dcomponent.h index e476044a..dbf0b46f 100644 --- a/core/e2dcomponent.h +++ b/core/e2dcomponent.h @@ -21,7 +21,7 @@ #pragma once #include "e2dobject.h" -namespace e2d +namespace easy2d { diff --git a/core/e2devent.h b/core/e2devent.h index a51f091f..d7d39b00 100644 --- a/core/e2devent.h +++ b/core/e2devent.h @@ -21,7 +21,7 @@ #pragma once #include "e2dutil.h" -namespace e2d +namespace easy2d { diff --git a/core/e2dimpl.h b/core/e2dimpl.h index a037a987..80af4da3 100644 --- a/core/e2dimpl.h +++ b/core/e2dimpl.h @@ -21,7 +21,7 @@ #pragma once #include "e2dutil.h" -namespace e2d +namespace easy2d { diff --git a/core/e2dmodule.h b/core/e2dmodule.h index 505cbb7d..0a3a0087 100644 --- a/core/e2dmodule.h +++ b/core/e2dmodule.h @@ -24,7 +24,7 @@ #include "e2dtransition.h" -namespace e2d +namespace easy2d { // 图形设备 diff --git a/core/e2dobject.h b/core/e2dobject.h index eb8a8df2..ec27db7c 100644 --- a/core/e2dobject.h +++ b/core/e2dobject.h @@ -23,7 +23,7 @@ #include "e2devent.h" -namespace e2d +namespace easy2d { diff --git a/core/e2dtool.h b/core/e2dtool.h index 6fda3223..b3545893 100644 --- a/core/e2dtool.h +++ b/core/e2dtool.h @@ -22,7 +22,7 @@ #include "e2dutil.h" #include "e2dimpl.h" -namespace e2d +namespace easy2d { // 随机数产生器 @@ -33,19 +33,19 @@ namespace e2d template static inline T Range(T min, T max) { - return e2d::Random::RandomInt(min, max); + return easy2d::Random::RandomInt(min, max); } // 取得范围内的一个浮点数随机数 static inline float Range(float min, float max) { - return e2d::Random::RandomReal(min, max); + return easy2d::Random::RandomReal(min, max); } // 取得范围内的一个浮点数随机数 static inline double Range(double min, double max) { - return e2d::Random::RandomReal(min, max); + return easy2d::Random::RandomReal(min, max); } private: @@ -79,7 +79,7 @@ namespace e2d // 打开音乐文件 bool Load( - const e2d::String& file_path /* 音乐文件路径 */ + const easy2d::String& file_path /* 音乐文件路径 */ ); // 打开音乐资源 diff --git a/core/e2dtransition.h b/core/e2dtransition.h index e96918c7..97a0598e 100644 --- a/core/e2dtransition.h +++ b/core/e2dtransition.h @@ -21,7 +21,7 @@ #pragma once #include "e2dutil.h" -namespace e2d +namespace easy2d { diff --git a/core/e2dutil.h b/core/e2dutil.h index 2b693e1b..cc27b629 100644 --- a/core/e2dutil.h +++ b/core/e2dutil.h @@ -21,7 +21,7 @@ #pragma once #include "e2dmacros.h" -namespace e2d +namespace easy2d { @@ -72,7 +72,7 @@ namespace e2d Point operator - () const; bool operator== (const Point& other) const; - E2D_OP_EXPLICIT operator e2d::Size() const; + E2D_OP_EXPLICIT operator easy2d::Size() const; // 判断两点间距离 static float Distance( @@ -108,7 +108,7 @@ namespace e2d Size operator - () const; bool operator== (const Size& other) const; - E2D_OP_EXPLICIT operator e2d::Point() const; + E2D_OP_EXPLICIT operator easy2d::Point() const; }; diff --git a/core/events/KeyEvent.cpp b/core/events/KeyEvent.cpp index 32a7a39c..7dcbbeab 100644 --- a/core/events/KeyEvent.cpp +++ b/core/events/KeyEvent.cpp @@ -21,14 +21,14 @@ #include "..\e2devent.h" -e2d::KeyEvent::KeyEvent(UINT message, WPARAM w_param, LPARAM l_param) +easy2d::KeyEvent::KeyEvent(UINT message, WPARAM w_param, LPARAM l_param) : message_(message) , w_param_(w_param) , l_param_(l_param) { } -e2d::KeyCode e2d::KeyEvent::GetCode() const +easy2d::KeyCode easy2d::KeyEvent::GetCode() const { switch (w_param_) { @@ -89,12 +89,12 @@ e2d::KeyCode e2d::KeyEvent::GetCode() const } } -int e2d::KeyEvent::GetCount() const +int easy2d::KeyEvent::GetCount() const { return static_cast((DWORD)l_param_ & 0x0000FFFF); } -e2d::KeyEvent::Type e2d::KeyEvent::GetType() const +easy2d::KeyEvent::Type easy2d::KeyEvent::GetType() const { return Type(message_); } diff --git a/core/events/MouseEvent.cpp b/core/events/MouseEvent.cpp index eda078cd..9e56bce2 100644 --- a/core/events/MouseEvent.cpp +++ b/core/events/MouseEvent.cpp @@ -21,26 +21,26 @@ #include "..\e2devent.h" #include "..\e2dmodule.h" -e2d::MouseEvent::MouseEvent(UINT message, WPARAM w_param, LPARAM l_param) +easy2d::MouseEvent::MouseEvent(UINT message, WPARAM w_param, LPARAM l_param) : message_(message) , w_param_(w_param) , l_param_(l_param) { } -float e2d::MouseEvent::GetX() const +float easy2d::MouseEvent::GetX() const { float dpi = Graphics::GetDpi(); return ((float)(short)LOWORD(l_param_)) * 96.f / dpi; } -float e2d::MouseEvent::GetY() const +float easy2d::MouseEvent::GetY() const { float dpi = Graphics::GetDpi(); return ((float)(short)HIWORD(l_param_)) * 96.f / dpi; } -e2d::Point e2d::MouseEvent::GetPosition() const +easy2d::Point easy2d::MouseEvent::GetPosition() const { float dpi = Graphics::GetDpi(); return Point( @@ -49,37 +49,37 @@ e2d::Point e2d::MouseEvent::GetPosition() const ); } -bool e2d::MouseEvent::IsShiftDown() const +bool easy2d::MouseEvent::IsShiftDown() const { return GET_KEYSTATE_WPARAM(w_param_) == MK_SHIFT; } -bool e2d::MouseEvent::IsCtrlDown() const +bool easy2d::MouseEvent::IsCtrlDown() const { return GET_KEYSTATE_WPARAM(w_param_) == MK_CONTROL; } -float e2d::MouseEvent::GetWheelDelta() const +float easy2d::MouseEvent::GetWheelDelta() const { return static_cast(GET_WHEEL_DELTA_WPARAM(w_param_)); } -bool e2d::MouseEvent::IsLButtonDown() const +bool easy2d::MouseEvent::IsLButtonDown() const { return GET_KEYSTATE_WPARAM(w_param_) == MK_LBUTTON; } -bool e2d::MouseEvent::IsRButtonDown() const +bool easy2d::MouseEvent::IsRButtonDown() const { return GET_KEYSTATE_WPARAM(w_param_) == MK_RBUTTON; } -bool e2d::MouseEvent::IsMButtonDown() const +bool easy2d::MouseEvent::IsMButtonDown() const { return GET_KEYSTATE_WPARAM(w_param_) == MK_MBUTTON; } -e2d::MouseEvent::Type e2d::MouseEvent::GetType() const +easy2d::MouseEvent::Type easy2d::MouseEvent::GetType() const { return Type(message_); } diff --git a/core/impl/TextRenderer.cpp b/core/impl/TextRenderer.cpp index ee1901bf..49907581 100644 --- a/core/impl/TextRenderer.cpp +++ b/core/impl/TextRenderer.cpp @@ -21,7 +21,7 @@ #include "..\e2dimpl.h" #include "..\e2dmodule.h" -using namespace e2d; +using namespace easy2d; E2DTextRenderer::E2DTextRenderer() : cRefCount_(0) diff --git a/core/modules/Audio.cpp b/core/modules/Audio.cpp index 14e26924..a1f07caf 100644 --- a/core/modules/Audio.cpp +++ b/core/modules/Audio.cpp @@ -21,7 +21,7 @@ #include "..\e2dmodule.h" -e2d::Audio::Audio() +easy2d::Audio::Audio() : x_audio2_(nullptr) , mastering_voice_(nullptr) { @@ -38,7 +38,7 @@ e2d::Audio::Audio() ); } -e2d::Audio::~Audio() +easy2d::Audio::~Audio() { if (mastering_voice_) { @@ -51,17 +51,17 @@ e2d::Audio::~Audio() MFShutdown(); } -HRESULT e2d::Audio::CreateVoice(IXAudio2SourceVoice ** voice, WAVEFORMATEX * wfx) +HRESULT easy2d::Audio::CreateVoice(IXAudio2SourceVoice ** voice, WAVEFORMATEX * wfx) { return x_audio2_->CreateSourceVoice(voice, wfx, 0, XAUDIO2_DEFAULT_FREQ_RATIO); } -void e2d::Audio::Open() +void easy2d::Audio::Open() { x_audio2_->StartEngine(); } -void e2d::Audio::Close() +void easy2d::Audio::Close() { x_audio2_->StopEngine(); } diff --git a/core/modules/Device.cpp b/core/modules/Device.cpp index 9cb9f039..75cc5643 100644 --- a/core/modules/Device.cpp +++ b/core/modules/Device.cpp @@ -20,33 +20,33 @@ #include "..\e2dmodule.h" -static e2d::Graphics * graphics_device = nullptr; -static e2d::Input * input_device = nullptr; -static e2d::Audio * audio_device = nullptr; +static easy2d::Graphics * graphics_device = nullptr; +static easy2d::Input * input_device = nullptr; +static easy2d::Audio * audio_device = nullptr; -e2d::Graphics * e2d::Device::GetGraphics() +easy2d::Graphics * easy2d::Device::GetGraphics() { return graphics_device; } -e2d::Input * e2d::Device::GetInput() +easy2d::Input * easy2d::Device::GetInput() { return input_device; } -e2d::Audio * e2d::Device::GetAudio() +easy2d::Audio * easy2d::Device::GetAudio() { return audio_device; } -void e2d::Device::Init(HWND hwnd) +void easy2d::Device::Init(HWND hwnd) { graphics_device = new (std::nothrow) Graphics(hwnd); input_device = new (std::nothrow) Input(hwnd); audio_device = new (std::nothrow) Audio(); } -void e2d::Device::Destroy() +void easy2d::Device::Destroy() { if (audio_device) { diff --git a/core/modules/Game.cpp b/core/modules/Game.cpp index 60adb6cf..395ba91d 100644 --- a/core/modules/Game.cpp +++ b/core/modules/Game.cpp @@ -30,14 +30,14 @@ #define REGISTER_CLASS L"Easy2DApp" -static e2d::Game * instance = nullptr; +static easy2d::Game * instance = nullptr; -e2d::Game * e2d::Game::GetInstance() +easy2d::Game * easy2d::Game::GetInstance() { return instance; } -e2d::Game::Game() +easy2d::Game::Game() : hwnd_(nullptr) , quit_(true) , curr_scene_(nullptr) @@ -58,7 +58,7 @@ e2d::Game::Game() ::CoInitialize(nullptr); } -e2d::Game::~Game() +easy2d::Game::~Game() { SafeRelease(transition_); SafeRelease(curr_scene_); @@ -78,7 +78,7 @@ e2d::Game::~Game() ::CoUninitialize(); } -void e2d::Game::Run(const Options& options) +void easy2d::Game::Run(const Options& options) { title_ = options.title; width_ = options.width; @@ -142,12 +142,12 @@ void e2d::Game::Run(const Options& options) } } -void e2d::Game::Quit() +void easy2d::Game::Quit() { quit_ = true; } -void e2d::Game::EnterScene(Scene * scene, Transition * transition) +void easy2d::Game::EnterScene(Scene * scene, Transition * transition) { if (scene == nullptr) { @@ -182,17 +182,17 @@ void e2d::Game::EnterScene(Scene * scene, Transition * transition) } } -e2d::Scene * e2d::Game::GetCurrentScene() +easy2d::Scene * easy2d::Game::GetCurrentScene() { return curr_scene_; } -bool e2d::Game::IsTransitioning() const +bool easy2d::Game::IsTransitioning() const { return transition_ != nullptr; } -void e2d::Game::UpdateScene(float dt) +void easy2d::Game::UpdateScene(float dt) { auto update = [&](Scene * scene) -> void { @@ -240,7 +240,7 @@ void e2d::Game::UpdateScene(float dt) } } -void e2d::Game::DrawScene() +void easy2d::Game::DrawScene() { auto graphics = Device::GetGraphics(); graphics->BeginDraw(); @@ -274,7 +274,7 @@ void e2d::Game::DrawScene() graphics->EndDraw(); } -void e2d::Game::Init() +void easy2d::Game::Init() { WNDCLASSEX wcex = { 0 }; wcex.cbSize = sizeof(WNDCLASSEX); @@ -379,7 +379,7 @@ void e2d::Game::Init() quit_ = false; } -e2d::Rect e2d::Game::Locate(int width, int height) +easy2d::Rect easy2d::Game::Locate(int width, int height) { int max_width = ::GetSystemMetrics(SM_CXSCREEN); int max_height = ::GetSystemMetrics(SM_CYSCREEN); @@ -406,36 +406,36 @@ e2d::Rect e2d::Game::Locate(int width, int height) return std::move(client_rect); } -int e2d::Game::GetWidth() const +int easy2d::Game::GetWidth() const { return width_; } -int e2d::Game::GetHeight() const +int easy2d::Game::GetHeight() const { return height_; } -e2d::Size e2d::Game::GetSize() const +easy2d::Size easy2d::Game::GetSize() const { - e2d::Size size( + easy2d::Size size( static_cast(width_), static_cast(height_) ); return std::move(size); } -HWND e2d::Game::GetHWnd() const +HWND easy2d::Game::GetHWnd() const { return hwnd_; } -const e2d::String& e2d::Game::GetTitle() const +const easy2d::String& easy2d::Game::GetTitle() const { return title_; } -void e2d::Game::SetSize(int width, int height) +void easy2d::Game::SetSize(int width, int height) { if (width_ == width && height_ == height) return; @@ -457,7 +457,7 @@ void e2d::Game::SetSize(int width, int height) } } -void e2d::Game::SetTitle(const String& title) +void easy2d::Game::SetTitle(const String& title) { title_ = title; @@ -467,7 +467,7 @@ void e2d::Game::SetTitle(const String& title) } } -void e2d::Game::SetIcon(int resource_id) +void easy2d::Game::SetIcon(int resource_id) { icon_ = resource_id; @@ -488,7 +488,7 @@ void e2d::Game::SetIcon(int resource_id) } -LRESULT e2d::Game::WndProc(HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param) +LRESULT easy2d::Game::WndProc(HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param) { LRESULT result = 0; bool was_handled = false; diff --git a/core/modules/Graphics.cpp b/core/modules/Graphics.cpp index 6def70e7..dc3559d5 100644 --- a/core/modules/Graphics.cpp +++ b/core/modules/Graphics.cpp @@ -22,7 +22,7 @@ #include "..\e2dobject.h" -e2d::Graphics::Graphics(HWND hwnd) +easy2d::Graphics::Graphics(HWND hwnd) : factory_(nullptr) , imaging_factory_(nullptr) , write_factory_(nullptr) @@ -101,7 +101,7 @@ e2d::Graphics::Graphics(HWND hwnd) ); } -e2d::Graphics::~Graphics() +easy2d::Graphics::~Graphics() { SafeRelease(fps_text_format_); SafeRelease(fps_text_layout_); @@ -117,13 +117,13 @@ e2d::Graphics::~Graphics() SafeRelease(write_factory_); } -void e2d::Graphics::BeginDraw() +void easy2d::Graphics::BeginDraw() { render_target_->BeginDraw(); render_target_->Clear(clear_color_); } -void e2d::Graphics::EndDraw() +void easy2d::Graphics::EndDraw() { HRESULT hr = render_target_->EndDraw(); @@ -143,7 +143,7 @@ void e2d::Graphics::EndDraw() ThrowIfFailed(hr); } -void e2d::Graphics::DrawDebugInfo() +void easy2d::Graphics::DrawDebugInfo() { static int render_times_ = 0; static Time last_render_time_ = Time::Now(); @@ -213,37 +213,37 @@ void e2d::Graphics::DrawDebugInfo() } } -ID2D1HwndRenderTarget * e2d::Graphics::GetRenderTarget() const +ID2D1HwndRenderTarget * easy2d::Graphics::GetRenderTarget() const { return render_target_; } -ID2D1SolidColorBrush * e2d::Graphics::GetSolidBrush() const +ID2D1SolidColorBrush * easy2d::Graphics::GetSolidBrush() const { return solid_brush_; } -e2d::E2DTextRenderer * e2d::Graphics::GetTextRender() const +easy2d::E2DTextRenderer * easy2d::Graphics::GetTextRender() const { return text_renderer_; } -ID2D1Factory * e2d::Graphics::GetFactory() const +ID2D1Factory * easy2d::Graphics::GetFactory() const { return factory_; } -IWICImagingFactory * e2d::Graphics::GetImagingFactory() const +IWICImagingFactory * easy2d::Graphics::GetImagingFactory() const { return imaging_factory_; } -IDWriteFactory * e2d::Graphics::GetWriteFactory() const +IDWriteFactory * easy2d::Graphics::GetWriteFactory() const { return write_factory_; } -ID2D1StrokeStyle * e2d::Graphics::GetMiterStrokeStyle() +ID2D1StrokeStyle * easy2d::Graphics::GetMiterStrokeStyle() { if (!miter_stroke_style_) { @@ -266,7 +266,7 @@ ID2D1StrokeStyle * e2d::Graphics::GetMiterStrokeStyle() return miter_stroke_style_; } -ID2D1StrokeStyle * e2d::Graphics::GetBevelStrokeStyle() +ID2D1StrokeStyle * easy2d::Graphics::GetBevelStrokeStyle() { if (!bevel_stroke_style_) { @@ -289,7 +289,7 @@ ID2D1StrokeStyle * e2d::Graphics::GetBevelStrokeStyle() return bevel_stroke_style_; } -ID2D1StrokeStyle * e2d::Graphics::GetRoundStrokeStyle() +ID2D1StrokeStyle * easy2d::Graphics::GetRoundStrokeStyle() { if (!round_stroke_style_) { @@ -312,7 +312,7 @@ ID2D1StrokeStyle * e2d::Graphics::GetRoundStrokeStyle() return round_stroke_style_; } -float e2d::Graphics::GetDpi() +float easy2d::Graphics::GetDpi() { HDC hdc = ::GetDC(0); int dpi = ::GetDeviceCaps(hdc, LOGPIXELSX); diff --git a/core/modules/Input.cpp b/core/modules/Input.cpp index 91cede2d..8cde1598 100644 --- a/core/modules/Input.cpp +++ b/core/modules/Input.cpp @@ -22,7 +22,7 @@ #include "..\e2dtool.h" -e2d::Input::Input(HWND hwnd) +easy2d::Input::Input(HWND hwnd) : direct_input_(nullptr) , keyboard_device_(nullptr) , mouse_device_(nullptr) @@ -70,7 +70,7 @@ e2d::Input::Input(HWND hwnd) mouse_device_->Poll(); } -e2d::Input::~Input() +easy2d::Input::~Input() { if (keyboard_device_) keyboard_device_->Unacquire(); @@ -82,7 +82,7 @@ e2d::Input::~Input() SafeRelease(direct_input_); } -void e2d::Input::Flush() +void easy2d::Input::Flush() { if (keyboard_device_) { @@ -121,31 +121,31 @@ void e2d::Input::Flush() } } -bool e2d::Input::IsDown(KeyCode key) +bool easy2d::Input::IsDown(KeyCode key) { if (key_buffer_[static_cast(key)] & 0x80) return true; return false; } -bool e2d::Input::IsDown(MouseCode code) +bool easy2d::Input::IsDown(MouseCode code) { if (mouse_state_.rgbButtons[static_cast(code)] & 0x80) return true; return false; } -float e2d::Input::GetMouseX() +float easy2d::Input::GetMouseX() { return GetMousePos().x; } -float e2d::Input::GetMouseY() +float easy2d::Input::GetMouseY() { return GetMousePos().y; } -e2d::Point e2d::Input::GetMousePos() +easy2d::Point easy2d::Input::GetMousePos() { POINT mousePos; ::GetCursorPos(&mousePos); @@ -154,17 +154,17 @@ e2d::Point e2d::Input::GetMousePos() return Point(mousePos.x * 96.f / dpi, mousePos.y * 96.f / dpi); } -float e2d::Input::GetMouseDeltaX() +float easy2d::Input::GetMouseDeltaX() { return (float)mouse_state_.lX; } -float e2d::Input::GetMouseDeltaY() +float easy2d::Input::GetMouseDeltaY() { return (float)mouse_state_.lY; } -float e2d::Input::GetMouseDeltaZ() +float easy2d::Input::GetMouseDeltaZ() { return (float)mouse_state_.lZ; } diff --git a/core/objects/Canvas.cpp b/core/objects/Canvas.cpp index fa378e94..03ecf4b4 100644 --- a/core/objects/Canvas.cpp +++ b/core/objects/Canvas.cpp @@ -21,7 +21,7 @@ #include "..\e2dobject.h" #include "..\e2dmodule.h" -e2d::Canvas::Canvas(float width, float height) +easy2d::Canvas::Canvas(float width, float height) : render_target_(nullptr) , fill_brush_(nullptr) , line_brush_(nullptr) @@ -52,65 +52,65 @@ e2d::Canvas::Canvas(float width, float height) this->SetStrokeStyle(stroke_); } -e2d::Canvas::~Canvas() +easy2d::Canvas::~Canvas() { SafeRelease(line_brush_); SafeRelease(fill_brush_); SafeRelease(render_target_); } -void e2d::Canvas::SetLineColor(const Color & color) +void easy2d::Canvas::SetLineColor(const Color & color) { line_brush_->SetColor(D2D_COLOR_F(color)); } -void e2d::Canvas::SetFillColor(const Color & color) +void easy2d::Canvas::SetFillColor(const Color & color) { fill_brush_->SetColor(D2D_COLOR_F(color)); } -void e2d::Canvas::SetStrokeWidth(float width) +void easy2d::Canvas::SetStrokeWidth(float width) { stroke_width_ = std::max(width, 0.f); } -void e2d::Canvas::SetStrokeStyle(Stroke strokeStyle) +void easy2d::Canvas::SetStrokeStyle(Stroke strokeStyle) { switch (strokeStyle) { - case e2d::Stroke::Miter: + case easy2d::Stroke::Miter: stroke_style_ = Device::GetGraphics()->GetMiterStrokeStyle(); break; - case e2d::Stroke::Bevel: + case easy2d::Stroke::Bevel: stroke_style_ = Device::GetGraphics()->GetBevelStrokeStyle(); break; - case e2d::Stroke::Round: + case easy2d::Stroke::Round: stroke_style_ = Device::GetGraphics()->GetRoundStrokeStyle(); break; } } -e2d::Color e2d::Canvas::GetLineColor() const +easy2d::Color easy2d::Canvas::GetLineColor() const { return line_brush_->GetColor(); } -e2d::Color e2d::Canvas::GetFillColor() const +easy2d::Color easy2d::Canvas::GetFillColor() const { return fill_brush_->GetColor(); } -float e2d::Canvas::GetStrokeWidth() const +float easy2d::Canvas::GetStrokeWidth() const { return stroke_width_; } -e2d::Stroke e2d::Canvas::GetStrokeStyle() const +easy2d::Stroke easy2d::Canvas::GetStrokeStyle() const { return stroke_; } -void e2d::Canvas::DrawLine(const Point & begin, const Point & end) +void easy2d::Canvas::DrawLine(const Point & begin, const Point & end) { render_target_->DrawLine( D2D1::Point2F(begin.x, begin.y), @@ -121,7 +121,7 @@ void e2d::Canvas::DrawLine(const Point & begin, const Point & end) ); } -void e2d::Canvas::DrawCircle(const Point & center, float radius) +void easy2d::Canvas::DrawCircle(const Point & center, float radius) { render_target_->DrawEllipse( D2D1::Ellipse( @@ -138,7 +138,7 @@ void e2d::Canvas::DrawCircle(const Point & center, float radius) ); } -void e2d::Canvas::DrawEllipse(const Point & center, float radius_x, float radius_y) +void easy2d::Canvas::DrawEllipse(const Point & center, float radius_x, float radius_y) { render_target_->DrawEllipse( D2D1::Ellipse( @@ -155,7 +155,7 @@ void e2d::Canvas::DrawEllipse(const Point & center, float radius_x, float radius ); } -void e2d::Canvas::DrawRect(const Rect & rect) +void easy2d::Canvas::DrawRect(const Rect & rect) { render_target_->DrawRectangle( D2D1::RectF( @@ -170,7 +170,7 @@ void e2d::Canvas::DrawRect(const Rect & rect) ); } -void e2d::Canvas::DrawRoundedRect(const Rect & rect, float radius_x, float radius_y) +void easy2d::Canvas::DrawRoundedRect(const Rect & rect, float radius_x, float radius_y) { render_target_->DrawRoundedRectangle( D2D1::RoundedRect( @@ -189,7 +189,7 @@ void e2d::Canvas::DrawRoundedRect(const Rect & rect, float radius_x, float radiu ); } -void e2d::Canvas::FillCircle(const Point & center, float radius) +void easy2d::Canvas::FillCircle(const Point & center, float radius) { render_target_->FillEllipse( D2D1::Ellipse( @@ -204,7 +204,7 @@ void e2d::Canvas::FillCircle(const Point & center, float radius) ); } -void e2d::Canvas::FillEllipse(const Point & center, float radius_x, float radius_y) +void easy2d::Canvas::FillEllipse(const Point & center, float radius_x, float radius_y) { render_target_->FillEllipse( D2D1::Ellipse( @@ -219,7 +219,7 @@ void e2d::Canvas::FillEllipse(const Point & center, float radius_x, float radius ); } -void e2d::Canvas::FillRect(const Rect & rect) +void easy2d::Canvas::FillRect(const Rect & rect) { render_target_->FillRectangle( D2D1::RectF( @@ -232,7 +232,7 @@ void e2d::Canvas::FillRect(const Rect & rect) ); } -void e2d::Canvas::FillRoundedRect(const Rect & rect, float radius_x, float radius_y) +void easy2d::Canvas::FillRoundedRect(const Rect & rect, float radius_x, float radius_y) { render_target_->FillRoundedRectangle( D2D1::RoundedRect( diff --git a/core/objects/Image.cpp b/core/objects/Image.cpp index 3e6662ee..c74191e7 100644 --- a/core/objects/Image.cpp +++ b/core/objects/Image.cpp @@ -22,22 +22,22 @@ #include "..\e2dmodule.h" #include "..\e2dtool.h" -std::map e2d::Image::bitmap_cache_; +std::map easy2d::Image::bitmap_cache_; -e2d::Image::Image() +easy2d::Image::Image() : bitmap_(nullptr) , crop_rect_() { } -e2d::Image::Image(const Resource& res) +easy2d::Image::Image(const Resource& res) : bitmap_(nullptr) , crop_rect_() { this->Load(res); } -e2d::Image::Image(const Resource& res, const Rect& crop_rect) +easy2d::Image::Image(const Resource& res, const Rect& crop_rect) : bitmap_(nullptr) , crop_rect_() { @@ -45,14 +45,14 @@ e2d::Image::Image(const Resource& res, const Rect& crop_rect) this->Crop(crop_rect); } -e2d::Image::Image(const String & file_name) +easy2d::Image::Image(const String & file_name) : bitmap_(nullptr) , crop_rect_() { this->Load(file_name); } -e2d::Image::Image(const String & file_name, const Rect & crop_rect) +easy2d::Image::Image(const String & file_name, const Rect & crop_rect) : bitmap_(nullptr) , crop_rect_() { @@ -60,12 +60,12 @@ e2d::Image::Image(const String & file_name, const Rect & crop_rect) this->Crop(crop_rect); } -e2d::Image::~Image() +easy2d::Image::~Image() { SafeRelease(bitmap_); } -bool e2d::Image::Load(const Resource& res) +bool easy2d::Image::Load(const Resource& res) { if (!Image::CacheBitmap(res)) { @@ -77,7 +77,7 @@ bool e2d::Image::Load(const Resource& res) return true; } -bool e2d::Image::Load(const String & file_name) +bool easy2d::Image::Load(const String & file_name) { WARN_IF(file_name.IsEmpty(), "Image Load failed! Invalid file name."); @@ -94,7 +94,7 @@ bool e2d::Image::Load(const String & file_name) return true; } -void e2d::Image::Crop(const Rect& crop_rect) +void easy2d::Image::Crop(const Rect& crop_rect) { if (bitmap_) { @@ -106,22 +106,22 @@ void e2d::Image::Crop(const Rect& crop_rect) } } -float e2d::Image::GetWidth() const +float easy2d::Image::GetWidth() const { return crop_rect_.size.width; } -float e2d::Image::GetHeight() const +float easy2d::Image::GetHeight() const { return crop_rect_.size.height; } -e2d::Size e2d::Image::GetSize() const +easy2d::Size easy2d::Image::GetSize() const { return crop_rect_.size; } -float e2d::Image::GetSourceWidth() const +float easy2d::Image::GetSourceWidth() const { if (bitmap_) { @@ -133,7 +133,7 @@ float e2d::Image::GetSourceWidth() const } } -float e2d::Image::GetSourceHeight() const +float easy2d::Image::GetSourceHeight() const { if (bitmap_) { @@ -145,7 +145,7 @@ float e2d::Image::GetSourceHeight() const } } -e2d::Size e2d::Image::GetSourceSize() const +easy2d::Size easy2d::Image::GetSourceSize() const { Size source_size; if (bitmap_) @@ -157,32 +157,32 @@ e2d::Size e2d::Image::GetSourceSize() const return std::move(source_size); } -float e2d::Image::GetCropX() const +float easy2d::Image::GetCropX() const { return crop_rect_.origin.x; } -float e2d::Image::GetCropY() const +float easy2d::Image::GetCropY() const { return crop_rect_.origin.y; } -e2d::Point e2d::Image::GetCropPos() const +easy2d::Point easy2d::Image::GetCropPos() const { return crop_rect_.origin; } -const e2d::Rect & e2d::Image::GetCropRect() const +const easy2d::Rect & easy2d::Image::GetCropRect() const { return crop_rect_; } -ID2D1Bitmap * e2d::Image::GetBitmap() const +ID2D1Bitmap * easy2d::Image::GetBitmap() const { return bitmap_; } -bool e2d::Image::CacheBitmap(const Resource& res) +bool easy2d::Image::CacheBitmap(const Resource& res) { if (bitmap_cache_.find(res.id) != bitmap_cache_.end()) { @@ -308,7 +308,7 @@ bool e2d::Image::CacheBitmap(const Resource& res) return SUCCEEDED(hr); } -bool e2d::Image::CacheBitmap(const String & file_name) +bool easy2d::Image::CacheBitmap(const String & file_name) { size_t hash = file_name.GetHash(); if (bitmap_cache_.find(hash) != bitmap_cache_.end()) @@ -389,7 +389,7 @@ bool e2d::Image::CacheBitmap(const String & file_name) return SUCCEEDED(hr); } -void e2d::Image::ClearCache() +void easy2d::Image::ClearCache() { if (bitmap_cache_.empty()) return; @@ -401,7 +401,7 @@ void e2d::Image::ClearCache() bitmap_cache_.clear(); } -void e2d::Image::SetBitmap(ID2D1Bitmap * bitmap) +void easy2d::Image::SetBitmap(ID2D1Bitmap * bitmap) { if (bitmap_ == bitmap) return; diff --git a/core/objects/Node.cpp b/core/objects/Node.cpp index 7db772ed..40ff9820 100644 --- a/core/objects/Node.cpp +++ b/core/objects/Node.cpp @@ -24,7 +24,7 @@ #include "..\e2dmodule.h" -e2d::Node::Node() +easy2d::Node::Node() : visible_(true) , parent_(nullptr) , parent_scene_(nullptr) @@ -46,7 +46,7 @@ e2d::Node::Node() { } -e2d::Node::~Node() +easy2d::Node::~Node() { SafeRelease(border_); @@ -66,7 +66,7 @@ e2d::Node::~Node() } } -void e2d::Node::Visit() +void easy2d::Node::Visit() { if (!visible_) return; @@ -129,7 +129,7 @@ void e2d::Node::Visit() } } -void e2d::Node::UpdateChildren(float dt) +void easy2d::Node::UpdateChildren(float dt) { if (children_.empty()) { @@ -166,7 +166,7 @@ void e2d::Node::UpdateChildren(float dt) } } -void e2d::Node::DrawBorder() +void easy2d::Node::DrawBorder() { if (visible_) { @@ -189,7 +189,7 @@ void e2d::Node::DrawBorder() } } -void e2d::Node::UpdateTransform() +void easy2d::Node::UpdateTransform() { if (!dirty_transform_) return; @@ -246,7 +246,7 @@ void e2d::Node::UpdateTransform() } } -bool e2d::Node::Dispatch(const MouseEvent & e, bool handled) +bool easy2d::Node::Dispatch(const MouseEvent & e, bool handled) { if (visible_) { @@ -261,7 +261,7 @@ bool e2d::Node::Dispatch(const MouseEvent & e, bool handled) return handled; } -bool e2d::Node::Dispatch(const KeyEvent & e, bool handled) +bool easy2d::Node::Dispatch(const KeyEvent & e, bool handled) { if (visible_) { @@ -276,7 +276,7 @@ bool e2d::Node::Dispatch(const KeyEvent & e, bool handled) return handled; } -void e2d::Node::UpdateOpacity() +void easy2d::Node::UpdateOpacity() { if (parent_) { @@ -288,7 +288,7 @@ void e2d::Node::UpdateOpacity() } } -void e2d::Node::UpdateActions() +void easy2d::Node::UpdateActions() { if (actions_.empty()) return; @@ -321,107 +321,107 @@ void e2d::Node::UpdateActions() } } -bool e2d::Node::IsVisible() const +bool easy2d::Node::IsVisible() const { return visible_; } -const e2d::String& e2d::Node::GetName() const +const easy2d::String& easy2d::Node::GetName() const { return name_; } -size_t e2d::Node::GetHashName() const +size_t easy2d::Node::GetHashName() const { return hash_name_; } -const e2d::Point& e2d::Node::GetPosition() const +const easy2d::Point& easy2d::Node::GetPosition() const { return transform_.position; } -float e2d::Node::GetWidth() const +float easy2d::Node::GetWidth() const { return transform_.size.width * transform_.scale_x; } -float e2d::Node::GetHeight() const +float easy2d::Node::GetHeight() const { return transform_.size.height * transform_.scale_y; } -float e2d::Node::GetRealWidth() const +float easy2d::Node::GetRealWidth() const { return transform_.size.width; } -float e2d::Node::GetRealHeight() const +float easy2d::Node::GetRealHeight() const { return transform_.size.height; } -const e2d::Size& e2d::Node::GetRealSize() const +const easy2d::Size& easy2d::Node::GetRealSize() const { return transform_.size; } -float e2d::Node::GetPivotX() const +float easy2d::Node::GetPivotX() const { return transform_.pivot_x; } -float e2d::Node::GetPivotY() const +float easy2d::Node::GetPivotY() const { return transform_.pivot_y; } -e2d::Size e2d::Node::GetSize() const +easy2d::Size easy2d::Node::GetSize() const { return std::move(Size(GetWidth(), GetHeight())); } -float e2d::Node::GetScaleX() const +float easy2d::Node::GetScaleX() const { return transform_.scale_x; } -float e2d::Node::GetScaleY() const +float easy2d::Node::GetScaleY() const { return transform_.scale_y; } -float e2d::Node::GetSkewX() const +float easy2d::Node::GetSkewX() const { return transform_.skew_x; } -float e2d::Node::GetSkewY() const +float easy2d::Node::GetSkewY() const { return transform_.skew_y; } -float e2d::Node::GetRotation() const +float easy2d::Node::GetRotation() const { return transform_.rotation; } -const e2d::Transform & e2d::Node::GetTransform() const +const easy2d::Transform & easy2d::Node::GetTransform() const { return transform_; } -float e2d::Node::GetOpacity() const +float easy2d::Node::GetOpacity() const { return real_opacity_; } -int e2d::Node::GetOrder() const +int easy2d::Node::GetOrder() const { return order_; } -void e2d::Node::SetOrder(int order) +void easy2d::Node::SetOrder(int order) { if (order_ == order) return; @@ -433,22 +433,22 @@ void e2d::Node::SetOrder(int order) } } -void e2d::Node::SetPositionX(float x) +void easy2d::Node::SetPositionX(float x) { this->SetPosition(x, transform_.position.y); } -void e2d::Node::SetPositionY(float y) +void easy2d::Node::SetPositionY(float y) { this->SetPosition(transform_.position.x, y); } -void e2d::Node::SetPosition(const Point & p) +void easy2d::Node::SetPosition(const Point & p) { this->SetPosition(p.x, p.y); } -void e2d::Node::SetPosition(float x, float y) +void easy2d::Node::SetPosition(float x, float y) { if (transform_.position.x == x && transform_.position.y == y) return; @@ -458,32 +458,32 @@ void e2d::Node::SetPosition(float x, float y) dirty_transform_ = true; } -void e2d::Node::MoveBy(float x, float y) +void easy2d::Node::MoveBy(float x, float y) { this->SetPosition(transform_.position.x + x, transform_.position.y + y); } -void e2d::Node::MoveBy(const Point & v) +void easy2d::Node::MoveBy(const Point & v) { this->MoveBy(v.x, v.y); } -void e2d::Node::SetScaleX(float scale_x) +void easy2d::Node::SetScaleX(float scale_x) { this->SetScale(scale_x, transform_.scale_y); } -void e2d::Node::SetScaleY(float scale_y) +void easy2d::Node::SetScaleY(float scale_y) { this->SetScale(transform_.scale_x, scale_y); } -void e2d::Node::SetScale(float scale) +void easy2d::Node::SetScale(float scale) { this->SetScale(scale, scale); } -void e2d::Node::SetScale(float scale_x, float scale_y) +void easy2d::Node::SetScale(float scale_x, float scale_y) { if (transform_.scale_x == scale_x && transform_.scale_y == scale_y) return; @@ -493,17 +493,17 @@ void e2d::Node::SetScale(float scale_x, float scale_y) dirty_transform_ = true; } -void e2d::Node::SetSkewX(float skew_x) +void easy2d::Node::SetSkewX(float skew_x) { this->SetSkew(skew_x, transform_.skew_y); } -void e2d::Node::SetSkewY(float skew_y) +void easy2d::Node::SetSkewY(float skew_y) { this->SetSkew(transform_.skew_x, skew_y); } -void e2d::Node::SetSkew(float skew_x, float skew_y) +void easy2d::Node::SetSkew(float skew_x, float skew_y) { if (transform_.skew_x == skew_x && transform_.skew_y == skew_y) return; @@ -513,7 +513,7 @@ void e2d::Node::SetSkew(float skew_x, float skew_y) dirty_transform_ = true; } -void e2d::Node::SetRotation(float angle) +void easy2d::Node::SetRotation(float angle) { if (transform_.rotation == angle) return; @@ -522,7 +522,7 @@ void e2d::Node::SetRotation(float angle) dirty_transform_ = true; } -void e2d::Node::SetOpacity(float opacity) +void easy2d::Node::SetOpacity(float opacity) { if (real_opacity_ == opacity) return; @@ -532,17 +532,17 @@ void e2d::Node::SetOpacity(float opacity) UpdateOpacity(); } -void e2d::Node::SetPivotX(float pivot_x) +void easy2d::Node::SetPivotX(float pivot_x) { this->SetPivot(pivot_x, transform_.pivot_y); } -void e2d::Node::SetPivotY(float pivot_y) +void easy2d::Node::SetPivotY(float pivot_y) { this->SetPivot(transform_.pivot_x, pivot_y); } -void e2d::Node::SetPivot(float pivot_x, float pivot_y) +void easy2d::Node::SetPivot(float pivot_x, float pivot_y) { if (transform_.pivot_x == pivot_x && transform_.pivot_y == pivot_y) return; @@ -552,17 +552,17 @@ void e2d::Node::SetPivot(float pivot_x, float pivot_y) dirty_transform_ = true; } -void e2d::Node::SetWidth(float width) +void easy2d::Node::SetWidth(float width) { this->SetSize(width, transform_.size.height); } -void e2d::Node::SetHeight(float height) +void easy2d::Node::SetHeight(float height) { this->SetSize(transform_.size.width, height); } -void e2d::Node::SetSize(float width, float height) +void easy2d::Node::SetSize(float width, float height) { if (transform_.size.width == width && transform_.size.height == height) return; @@ -572,28 +572,28 @@ void e2d::Node::SetSize(float width, float height) dirty_transform_ = true; } -void e2d::Node::SetSize(const Size& size) +void easy2d::Node::SetSize(const Size& size) { this->SetSize(size.width, size.height); } -void e2d::Node::SetTransform(const Transform & transform) +void easy2d::Node::SetTransform(const Transform & transform) { transform_ = transform; dirty_transform_ = true; } -void e2d::Node::SetClipEnabled(bool enabled) +void easy2d::Node::SetClipEnabled(bool enabled) { clip_enabled_ = enabled; } -void e2d::Node::SetBorderColor(const Color & color) +void easy2d::Node::SetBorderColor(const Color & color) { border_color_ = color; } -void e2d::Node::AddChild(Node * child, int order) +void easy2d::Node::AddChild(Node * child, int order) { WARN_IF(child == nullptr, "Node::AddChild NULL pointer exception."); @@ -630,7 +630,7 @@ void e2d::Node::AddChild(Node * child, int order) } } -void e2d::Node::AddChild(const Nodes& nodes, int order) +void easy2d::Node::AddChild(const Nodes& nodes, int order) { for (const auto& node : nodes) { @@ -638,17 +638,17 @@ void e2d::Node::AddChild(const Nodes& nodes, int order) } } -e2d::Node * e2d::Node::GetParent() const +easy2d::Node * easy2d::Node::GetParent() const { return parent_; } -e2d::Scene * e2d::Node::GetParentScene() const +easy2d::Scene * easy2d::Node::GetParentScene() const { return parent_scene_; } -e2d::Node::Nodes e2d::Node::GetChildren(const String& name) const +easy2d::Node::Nodes easy2d::Node::GetChildren(const String& name) const { Nodes children; size_t hash = name.GetHash(); @@ -664,7 +664,7 @@ e2d::Node::Nodes e2d::Node::GetChildren(const String& name) const return std::move(children); } -e2d::Node * e2d::Node::GetChild(const String& name) const +easy2d::Node * easy2d::Node::GetChild(const String& name) const { size_t hash = name.GetHash(); @@ -679,17 +679,17 @@ e2d::Node * e2d::Node::GetChild(const String& name) const return nullptr; } -const std::vector& e2d::Node::GetAllChildren() const +const std::vector& easy2d::Node::GetAllChildren() const { return children_; } -int e2d::Node::GetChildrenCount() const +int easy2d::Node::GetChildrenCount() const { return static_cast(children_.size()); } -void e2d::Node::RemoveFromParent() +void easy2d::Node::RemoveFromParent() { if (parent_) { @@ -697,7 +697,7 @@ void e2d::Node::RemoveFromParent() } } -bool e2d::Node::RemoveChild(Node * child) +bool easy2d::Node::RemoveChild(Node * child) { WARN_IF(child == nullptr, "Node::RemoveChildren NULL pointer exception."); @@ -726,7 +726,7 @@ bool e2d::Node::RemoveChild(Node * child) return false; } -void e2d::Node::RemoveChildren(const String& child_name) +void easy2d::Node::RemoveChildren(const String& child_name) { if (children_.empty()) { @@ -753,7 +753,7 @@ void e2d::Node::RemoveChildren(const String& child_name) } } -void e2d::Node::RemoveAllChildren() +void easy2d::Node::RemoveAllChildren() { // 所有节点的引用计数减一 for (const auto& child : children_) @@ -764,7 +764,7 @@ void e2d::Node::RemoveAllChildren() children_.clear(); } -void e2d::Node::RunAction(Action * action) +void easy2d::Node::RunAction(Action * action) { WARN_IF(action == nullptr, "Action NULL pointer exception!"); @@ -787,7 +787,7 @@ void e2d::Node::RunAction(Action * action) } } -void e2d::Node::ResumeAction(const String& name) +void easy2d::Node::ResumeAction(const String& name) { if (actions_.empty()) return; @@ -801,7 +801,7 @@ void e2d::Node::ResumeAction(const String& name) } } -void e2d::Node::PauseAction(const String& name) +void easy2d::Node::PauseAction(const String& name) { if (actions_.empty()) return; @@ -815,7 +815,7 @@ void e2d::Node::PauseAction(const String& name) } } -void e2d::Node::StopAction(const String& name) +void easy2d::Node::StopAction(const String& name) { if (actions_.empty()) return; @@ -829,7 +829,7 @@ void e2d::Node::StopAction(const String& name) } } -bool e2d::Node::ContainsPoint(const Point& point) +bool easy2d::Node::ContainsPoint(const Point& point) { if (transform_.size.width == 0.f || transform_.size.height == 0.f) return false; @@ -847,7 +847,7 @@ bool e2d::Node::ContainsPoint(const Point& point) return ret != 0; } -bool e2d::Node::Intersects(Node * node) +bool easy2d::Node::Intersects(Node * node) { if (transform_.size.width == 0.f || transform_.size.height == 0.f || node->transform_.size.width == 0.f || node->transform_.size.height == 0.f) return false; @@ -869,7 +869,7 @@ bool e2d::Node::Intersects(Node * node) relation != D2D1_GEOMETRY_RELATION_DISJOINT; } -void e2d::Node::ResumeAllActions() +void easy2d::Node::ResumeAllActions() { if (actions_.empty()) return; @@ -880,7 +880,7 @@ void e2d::Node::ResumeAllActions() } } -void e2d::Node::PauseAllActions() +void easy2d::Node::PauseAllActions() { if (actions_.empty()) return; @@ -891,7 +891,7 @@ void e2d::Node::PauseAllActions() } } -void e2d::Node::StopAllActions() +void easy2d::Node::StopAllActions() { if (actions_.empty()) return; @@ -902,12 +902,12 @@ void e2d::Node::StopAllActions() } } -const e2d::Node::Actions & e2d::Node::GetAllActions() const +const easy2d::Node::Actions & easy2d::Node::GetAllActions() const { return actions_; } -void e2d::Node::AddTask(Task * task) +void easy2d::Node::AddTask(Task * task) { if (task) { @@ -921,7 +921,7 @@ void e2d::Node::AddTask(Task * task) } } -void e2d::Node::StopTasks(const String& name) +void easy2d::Node::StopTasks(const String& name) { for (const auto& task : tasks_) { @@ -932,7 +932,7 @@ void e2d::Node::StopTasks(const String& name) } } -void e2d::Node::StartTasks(const String& name) +void easy2d::Node::StartTasks(const String& name) { for (const auto& task : tasks_) { @@ -943,7 +943,7 @@ void e2d::Node::StartTasks(const String& name) } } -void e2d::Node::RemoveTasks(const String& name) +void easy2d::Node::RemoveTasks(const String& name) { for (const auto& task : tasks_) { @@ -954,7 +954,7 @@ void e2d::Node::RemoveTasks(const String& name) } } -void e2d::Node::StopAllTasks() +void easy2d::Node::StopAllTasks() { for (const auto& task : tasks_) { @@ -962,7 +962,7 @@ void e2d::Node::StopAllTasks() } } -void e2d::Node::StartAllTasks() +void easy2d::Node::StartAllTasks() { for (const auto& task : tasks_) { @@ -970,7 +970,7 @@ void e2d::Node::StartAllTasks() } } -void e2d::Node::RemoveAllTasks() +void easy2d::Node::RemoveAllTasks() { for (const auto& task : tasks_) { @@ -978,12 +978,12 @@ void e2d::Node::RemoveAllTasks() } } -const e2d::Node::Tasks & e2d::Node::GetAllTasks() const +const easy2d::Node::Tasks & easy2d::Node::GetAllTasks() const { return tasks_; } -void e2d::Node::UpdateTasks() +void easy2d::Node::UpdateTasks() { if (tasks_.empty()) return; @@ -1016,7 +1016,7 @@ void e2d::Node::UpdateTasks() } } -void e2d::Node::UpdateTime() +void easy2d::Node::UpdateTime() { for (const auto& action : actions_) { @@ -1034,12 +1034,12 @@ void e2d::Node::UpdateTime() } } -void e2d::Node::SetVisible(bool value) +void easy2d::Node::SetVisible(bool value) { visible_ = value; } -void e2d::Node::SetName(const String& name) +void easy2d::Node::SetName(const String& name) { WARN_IF(name.IsEmpty(), "Invalid Node name."); @@ -1052,7 +1052,7 @@ void e2d::Node::SetName(const String& name) } } -void e2d::Node::SetParentScene(Scene * scene) +void easy2d::Node::SetParentScene(Scene * scene) { parent_scene_ = scene; for (const auto& child : children_) diff --git a/core/objects/Scene.cpp b/core/objects/Scene.cpp index 5f5f0313..14a526da 100644 --- a/core/objects/Scene.cpp +++ b/core/objects/Scene.cpp @@ -21,20 +21,20 @@ #include "..\e2dmodule.h" #include "..\e2dobject.h" -e2d::Scene::Scene() +easy2d::Scene::Scene() : root_(nullptr) , transform_(D2D1::Matrix3x2F::Identity()) { } -e2d::Scene::Scene(Node * root) +easy2d::Scene::Scene(Node * root) : root_(nullptr) , transform_(D2D1::Matrix3x2F::Identity()) { this->SetRoot(root); } -e2d::Scene::~Scene() +easy2d::Scene::~Scene() { if (root_) { @@ -43,7 +43,7 @@ e2d::Scene::~Scene() } } -void e2d::Scene::SetRoot(Node * root) +void easy2d::Scene::SetRoot(Node * root) { if (root_ == root) return; @@ -63,12 +63,12 @@ void e2d::Scene::SetRoot(Node * root) root_ = root; } -e2d::Node * e2d::Scene::GetRoot() const +easy2d::Node * easy2d::Scene::GetRoot() const { return root_; } -void e2d::Scene::Draw() +void easy2d::Scene::Draw() { if (root_) { @@ -76,7 +76,7 @@ void e2d::Scene::Draw() } } -void e2d::Scene::Dispatch(const MouseEvent & e) +void easy2d::Scene::Dispatch(const MouseEvent & e) { auto handler = dynamic_cast(this); if (handler) @@ -90,7 +90,7 @@ void e2d::Scene::Dispatch(const MouseEvent & e) } } -void e2d::Scene::Dispatch(const KeyEvent & e) +void easy2d::Scene::Dispatch(const KeyEvent & e) { auto handler = dynamic_cast(this); if (handler) @@ -104,7 +104,7 @@ void e2d::Scene::Dispatch(const KeyEvent & e) } } -void e2d::Scene::SetTransform(const D2D1::Matrix3x2F& matrix) +void easy2d::Scene::SetTransform(const D2D1::Matrix3x2F& matrix) { transform_ = matrix; @@ -114,7 +114,7 @@ void e2d::Scene::SetTransform(const D2D1::Matrix3x2F& matrix) } } -const D2D1::Matrix3x2F & e2d::Scene::GetTransform() const +const D2D1::Matrix3x2F & easy2d::Scene::GetTransform() const { return transform_; } diff --git a/core/objects/Sprite.cpp b/core/objects/Sprite.cpp index 26d26977..1e0b5f0a 100644 --- a/core/objects/Sprite.cpp +++ b/core/objects/Sprite.cpp @@ -21,49 +21,49 @@ #include "..\e2dobject.h" #include "..\e2dmodule.h" -e2d::Sprite::Sprite() +easy2d::Sprite::Sprite() : image_(nullptr) { } -e2d::Sprite::Sprite(Image * image) +easy2d::Sprite::Sprite(Image * image) : image_(nullptr) { Load(image); } -e2d::Sprite::Sprite(const Resource& res) +easy2d::Sprite::Sprite(const Resource& res) : image_(nullptr) { Load(res); } -e2d::Sprite::Sprite(const Resource& res, const Rect& crop_rect) +easy2d::Sprite::Sprite(const Resource& res, const Rect& crop_rect) : image_(nullptr) { Load(res); Crop(crop_rect); } -e2d::Sprite::Sprite(const String & file_name) +easy2d::Sprite::Sprite(const String & file_name) : image_(nullptr) { Load(file_name); } -e2d::Sprite::Sprite(const String & file_name, const Rect & crop_rect) +easy2d::Sprite::Sprite(const String & file_name, const Rect & crop_rect) : image_(nullptr) { Load(file_name); Crop(crop_rect); } -e2d::Sprite::~Sprite() +easy2d::Sprite::~Sprite() { SafeRelease(image_); } -bool e2d::Sprite::Load(Image * image) +bool easy2d::Sprite::Load(Image * image) { if (image) { @@ -81,7 +81,7 @@ bool e2d::Sprite::Load(Image * image) return false; } -bool e2d::Sprite::Load(const Resource& res) +bool easy2d::Sprite::Load(const Resource& res) { if (!image_) { @@ -97,7 +97,7 @@ bool e2d::Sprite::Load(const Resource& res) return false; } -bool e2d::Sprite::Load(const String & file_name) +bool easy2d::Sprite::Load(const String & file_name) { if (!image_) { @@ -113,7 +113,7 @@ bool e2d::Sprite::Load(const String & file_name) return false; } -void e2d::Sprite::Crop(const Rect& crop_rect) +void easy2d::Sprite::Crop(const Rect& crop_rect) { image_->Crop(crop_rect); Node::SetSize( @@ -122,12 +122,12 @@ void e2d::Sprite::Crop(const Rect& crop_rect) ); } -e2d::Image * e2d::Sprite::GetImage() const +easy2d::Image * easy2d::Sprite::GetImage() const { return image_; } -void e2d::Sprite::Draw() const +void easy2d::Sprite::Draw() const { if (image_ && image_->GetBitmap()) { diff --git a/core/objects/Task.cpp b/core/objects/Task.cpp index 442e1908..504bc869 100644 --- a/core/objects/Task.cpp +++ b/core/objects/Task.cpp @@ -21,7 +21,7 @@ #include "..\e2dobject.h" -e2d::Task::Task(const Function & func, const String & name) +easy2d::Task::Task(const Function & func, const String & name) : running_(true) , stopped_(false) , run_times_(0) @@ -32,7 +32,7 @@ e2d::Task::Task(const Function & func, const String & name) { } -e2d::Task::Task(const Function & func, float delay, int times, const String & name) +easy2d::Task::Task(const Function & func, float delay, int times, const String & name) : running_(true) , stopped_(false) , run_times_(0) @@ -43,18 +43,18 @@ e2d::Task::Task(const Function & func, float delay, int times, const String & na { } -void e2d::Task::Start() +void easy2d::Task::Start() { running_ = true; last_time_ = Time::Now(); } -void e2d::Task::Stop() +void easy2d::Task::Stop() { running_ = false; } -void e2d::Task::Update() +void easy2d::Task::Update() { if (total_times_ == 0) { @@ -77,12 +77,12 @@ void e2d::Task::Update() } } -void e2d::Task::ResetTime() +void easy2d::Task::ResetTime() { last_time_ = Time::Now(); } -bool e2d::Task::IsReady() const +bool easy2d::Task::IsReady() const { if (running_) { @@ -98,12 +98,12 @@ bool e2d::Task::IsReady() const return false; } -bool e2d::Task::IsRunning() const +bool easy2d::Task::IsRunning() const { return running_; } -const e2d::String& e2d::Task::GetName() const +const easy2d::String& easy2d::Task::GetName() const { return name_; } diff --git a/core/objects/Text.cpp b/core/objects/Text.cpp index aea0bd06..491a4d74 100644 --- a/core/objects/Text.cpp +++ b/core/objects/Text.cpp @@ -25,7 +25,7 @@ // Style //------------------------------------------------------- -e2d::Text::Style::Style() +easy2d::Text::Style::Style() : color(Color::White) , alignment(Align::Left) , wrap(false) @@ -39,7 +39,7 @@ e2d::Text::Style::Style() , outline_stroke(Stroke::Round) {} -e2d::Text::Style::Style( +easy2d::Text::Style::Style( Color color, Align alignment, bool wrap, @@ -71,7 +71,7 @@ e2d::Text::Style::Style( // Text //------------------------------------------------------- -e2d::Text::Text() +easy2d::Text::Text() : font_() , style_() , text_layout_(nullptr) @@ -79,7 +79,7 @@ e2d::Text::Text() { } -e2d::Text::Text(const String & text, const Font & font, const Style & style) +easy2d::Text::Text(const String & text, const Font & font, const Style & style) : font_(font) , style_(style) , text_layout_(nullptr) @@ -89,63 +89,63 @@ e2d::Text::Text(const String & text, const Font & font, const Style & style) Reset(); } -e2d::Text::~Text() +easy2d::Text::~Text() { SafeRelease(text_format_); SafeRelease(text_layout_); } -const e2d::String& e2d::Text::GetText() const +const easy2d::String& easy2d::Text::GetText() const { return text_; } -const e2d::Font& e2d::Text::GetFont() const +const easy2d::Font& easy2d::Text::GetFont() const { return font_; } -const e2d::Text::Style& e2d::Text::GetStyle() const +const easy2d::Text::Style& easy2d::Text::GetStyle() const { return style_; } -const e2d::String& e2d::Text::GetFontFamily() const +const easy2d::String& easy2d::Text::GetFontFamily() const { return font_.family; } -float e2d::Text::GetFontSize() const +float easy2d::Text::GetFontSize() const { return font_.size; } -UINT e2d::Text::GetFontWeight() const +UINT easy2d::Text::GetFontWeight() const { return font_.weight; } -const e2d::Color& e2d::Text::GetColor() const +const easy2d::Color& easy2d::Text::GetColor() const { return style_.color; } -const e2d::Color& e2d::Text::GetOutlineColor() const +const easy2d::Color& easy2d::Text::GetOutlineColor() const { return style_.outline_color; } -float e2d::Text::GetOutlineWidth() const +float easy2d::Text::GetOutlineWidth() const { return style_.outline_width; } -e2d::Stroke e2d::Text::GetOutlineStroke() const +easy2d::Stroke easy2d::Text::GetOutlineStroke() const { return style_.outline_stroke; } -int e2d::Text::GetLineCount() const +int easy2d::Text::GetLineCount() const { if (text_layout_) { @@ -159,74 +159,74 @@ int e2d::Text::GetLineCount() const } } -bool e2d::Text::IsItalic() const +bool easy2d::Text::IsItalic() const { return font_.italic; } -bool e2d::Text::strikethrough() const +bool easy2d::Text::strikethrough() const { return style_.strikethrough; } -bool e2d::Text::underline() const +bool easy2d::Text::underline() const { return style_.underline; } -bool e2d::Text::outline() const +bool easy2d::Text::outline() const { return style_.outline; } -void e2d::Text::SetText(const String& text) +void easy2d::Text::SetText(const String& text) { text_ = text; Reset(); } -void e2d::Text::SetStyle(const Style& style) +void easy2d::Text::SetStyle(const Style& style) { style_ = style; Reset(); } -void e2d::Text::SetFont(const Font & font) +void easy2d::Text::SetFont(const Font & font) { font_ = font; Reset(); } -void e2d::Text::SetFontFamily(const String& family) +void easy2d::Text::SetFontFamily(const String& family) { font_.family = family; Reset(); } -void e2d::Text::SetFontSize(float size) +void easy2d::Text::SetFontSize(float size) { font_.size = size; Reset(); } -void e2d::Text::SetFontWeight(UINT weight) +void easy2d::Text::SetFontWeight(UINT weight) { font_.weight = weight; Reset(); } -void e2d::Text::SetColor(Color color) +void easy2d::Text::SetColor(Color color) { style_.color = color; } -void e2d::Text::SetItalic(bool value) +void easy2d::Text::SetItalic(bool value) { font_.italic = value; Reset(); } -void e2d::Text::SetWrapEnabled(bool wrap) +void easy2d::Text::SetWrapEnabled(bool wrap) { if (style_.wrap != wrap) { @@ -235,7 +235,7 @@ void e2d::Text::SetWrapEnabled(bool wrap) } } -void e2d::Text::SetWrapWidth(float wrap_width) +void easy2d::Text::SetWrapWidth(float wrap_width) { if (style_.wrap_width != wrap_width) { @@ -248,7 +248,7 @@ void e2d::Text::SetWrapWidth(float wrap_width) } } -void e2d::Text::SetLineSpacing(float line_spacing) +void easy2d::Text::SetLineSpacing(float line_spacing) { if (style_.line_spacing != line_spacing) { @@ -257,7 +257,7 @@ void e2d::Text::SetLineSpacing(float line_spacing) } } -void e2d::Text::SetAlignment(Align align) +void easy2d::Text::SetAlignment(Align align) { if (style_.alignment != align) { @@ -266,7 +266,7 @@ void e2d::Text::SetAlignment(Align align) } } -void e2d::Text::SetUnderline(bool underline) +void easy2d::Text::SetUnderline(bool underline) { if (style_.underline != underline) { @@ -277,7 +277,7 @@ void e2d::Text::SetUnderline(bool underline) } } -void e2d::Text::SetStrikethrough(bool strikethrough) +void easy2d::Text::SetStrikethrough(bool strikethrough) { if (style_.strikethrough != strikethrough) { @@ -288,27 +288,27 @@ void e2d::Text::SetStrikethrough(bool strikethrough) } } -void e2d::Text::SetOutline(bool outline) +void easy2d::Text::SetOutline(bool outline) { style_.outline = outline; } -void e2d::Text::SetOutlineColor(Color outline_color) +void easy2d::Text::SetOutlineColor(Color outline_color) { style_.outline_color = outline_color; } -void e2d::Text::SetOutlineWidth(float outline_width) +void easy2d::Text::SetOutlineWidth(float outline_width) { style_.outline_width = outline_width; } -void e2d::Text::SetOutlineStroke(Stroke outline_stroke) +void easy2d::Text::SetOutlineStroke(Stroke outline_stroke) { style_.outline_stroke = outline_stroke; } -void e2d::Text::Draw() const +void easy2d::Text::Draw() const { if (text_layout_) { @@ -330,7 +330,7 @@ void e2d::Text::Draw() const } } -void e2d::Text::Reset() +void easy2d::Text::Reset() { // 创建文字格式化 CreateFormat(); @@ -338,7 +338,7 @@ void e2d::Text::Reset() CreateLayout(); } -void e2d::Text::CreateFormat() +void easy2d::Text::CreateFormat() { SafeRelease(text_format_); @@ -383,7 +383,7 @@ void e2d::Text::CreateFormat() } } -void e2d::Text::CreateLayout() +void easy2d::Text::CreateLayout() { SafeRelease(text_layout_); diff --git a/core/tools/Data.cpp b/core/tools/Data.cpp index 408f18b6..e66dbcf1 100644 --- a/core/tools/Data.cpp +++ b/core/tools/Data.cpp @@ -21,14 +21,14 @@ #include "..\e2dtool.h" -e2d::Data::Data(const String & key, const String & field) +easy2d::Data::Data(const String & key, const String & field) : key_(key) , field_(field) , data_path_(Path::GetDataPath()) { } -bool e2d::Data::Exists() const +bool easy2d::Data::Exists() const { wchar_t temp[256] = { 0 }; ::GetPrivateProfileStringW( @@ -42,7 +42,7 @@ bool e2d::Data::Exists() const return temp[0] == L'\0'; } -bool e2d::Data::SaveInt(int value) +bool easy2d::Data::SaveInt(int value) { BOOL ret = ::WritePrivateProfileStringW( (LPCWSTR)field_, @@ -53,7 +53,7 @@ bool e2d::Data::SaveInt(int value) return ret != 0; } -bool e2d::Data::SaveFloat(float value) +bool easy2d::Data::SaveFloat(float value) { BOOL ret = ::WritePrivateProfileStringW( (LPCWSTR)field_, @@ -64,7 +64,7 @@ bool e2d::Data::SaveFloat(float value) return ret != 0; } -bool e2d::Data::SaveDouble(double value) +bool easy2d::Data::SaveDouble(double value) { BOOL ret = ::WritePrivateProfileStringW( (LPCWSTR)field_, @@ -75,7 +75,7 @@ bool e2d::Data::SaveDouble(double value) return ret != 0; } -bool e2d::Data::SaveBool(bool value) +bool easy2d::Data::SaveBool(bool value) { BOOL ret = ::WritePrivateProfileStringW( (LPCWSTR)field_, @@ -86,7 +86,7 @@ bool e2d::Data::SaveBool(bool value) return ret != 0; } -bool e2d::Data::SaveString(const String& value) +bool easy2d::Data::SaveString(const String& value) { BOOL ret = ::WritePrivateProfileStringW( (LPCWSTR)field_, @@ -97,7 +97,7 @@ bool e2d::Data::SaveString(const String& value) return ret != 0; } -int e2d::Data::GetInt() const +int easy2d::Data::GetInt() const { return ::GetPrivateProfileIntW( (LPCWSTR)field_, @@ -107,21 +107,21 @@ int e2d::Data::GetInt() const ); } -float e2d::Data::GetFloat() const +float easy2d::Data::GetFloat() const { wchar_t temp[32] = { 0 }; ::GetPrivateProfileStringW((LPCWSTR)field_, (LPCWSTR)key_, L"0.0", temp, 31, (LPCWSTR)data_path_); return std::stof(temp); } -double e2d::Data::GetDouble() const +double easy2d::Data::GetDouble() const { wchar_t temp[32] = { 0 }; ::GetPrivateProfileStringW((LPCWSTR)field_, (LPCWSTR)key_, L"0.0", temp, 31, (LPCWSTR)data_path_); return std::stod(temp); } -bool e2d::Data::GetBool() const +bool easy2d::Data::GetBool() const { int nValue = ::GetPrivateProfileIntW( (LPCWSTR)field_, @@ -131,7 +131,7 @@ bool e2d::Data::GetBool() const return nValue != 0; } -e2d::String e2d::Data::GetString() +easy2d::String easy2d::Data::GetString() { wchar_t temp[256] = { 0 }; ::GetPrivateProfileStringW( diff --git a/core/tools/File.cpp b/core/tools/File.cpp index bff6ded9..d707006b 100644 --- a/core/tools/File.cpp +++ b/core/tools/File.cpp @@ -22,26 +22,26 @@ #include "..\e2dmodule.h" #include -std::list e2d::File::search_paths_; +std::list easy2d::File::search_paths_; -e2d::File::File() +easy2d::File::File() : file_path_() , attributes_(0) { } -e2d::File::File(const String & file_name) +easy2d::File::File(const String & file_name) : file_path_(file_name) , attributes_(0) { this->Open(file_name); } -e2d::File::~File() +easy2d::File::~File() { } -bool e2d::File::Open(const String & file_name) +bool easy2d::File::Open(const String & file_name) { if (file_name.IsEmpty()) return false; @@ -75,22 +75,22 @@ bool e2d::File::Open(const String & file_name) return false; } -bool e2d::File::Exists() const +bool easy2d::File::Exists() const { return ::_waccess((const wchar_t*)file_path_, 0) == 0; } -bool e2d::File::IsFolder() const +bool easy2d::File::IsFolder() const { return (attributes_ & FILE_ATTRIBUTE_DIRECTORY) != 0; } -const e2d::String& e2d::File::GetPath() const +const easy2d::String& easy2d::File::GetPath() const { return file_path_; } -e2d::String e2d::File::GetExtension() const +easy2d::String easy2d::File::GetExtension() const { String file_ext; // 找到文件名中的最后一个 '.' 的位置 @@ -106,14 +106,14 @@ e2d::String e2d::File::GetExtension() const return std::move(file_ext); } -bool e2d::File::Delete() +bool easy2d::File::Delete() { if (::DeleteFile((LPCWSTR)file_path_)) return true; return false; } -e2d::File e2d::File::Extract(int resource_name, const String & resource_type, const String& dest_file_name) +easy2d::File easy2d::File::Extract(int resource_name, const String & resource_type, const String& dest_file_name) { // 创建文件 HANDLE file = ::CreateFile( @@ -150,7 +150,7 @@ e2d::File e2d::File::Extract(int resource_name, const String & resource_type, co } } -void e2d::File::AddSearchPath(const String & path) +void easy2d::File::AddSearchPath(const String & path) { String tmp = path; tmp.Replace(L"/", L"\\"); @@ -165,7 +165,7 @@ void e2d::File::AddSearchPath(const String & path) } } -bool e2d::File::CreateFolder(const String & dir_path) +bool easy2d::File::CreateFolder(const String & dir_path) { if (dir_path.IsEmpty() || dir_path.GetLength() >= MAX_PATH) return false; @@ -190,7 +190,7 @@ bool e2d::File::CreateFolder(const String & dir_path) return true; } -e2d::File e2d::File::ShowOpenDialog(const String & title, const String & filter) +easy2d::File easy2d::File::ShowOpenDialog(const String & title, const String & filter) { String file_path; HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); @@ -252,7 +252,7 @@ e2d::File e2d::File::ShowOpenDialog(const String & title, const String & filter) return std::move(File(file_path)); } -e2d::File e2d::File::ShowSaveDialog(const String & title, const String& def_file, const String & def_ext) +easy2d::File easy2d::File::ShowSaveDialog(const String & title, const String& def_file, const String & def_ext) { String file_path; HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); diff --git a/core/tools/Music.cpp b/core/tools/Music.cpp index 58052b51..eee9ab45 100644 --- a/core/tools/Music.cpp +++ b/core/tools/Music.cpp @@ -35,7 +35,7 @@ inline bool TraceError(wchar_t* prompt, HRESULT hr) } -namespace e2d +namespace easy2d { class Transcoder @@ -315,7 +315,7 @@ namespace e2d } -e2d::Music::Music() +easy2d::Music::Music() : opened_(false) , playing_(false) , wave_data_(nullptr) @@ -324,12 +324,12 @@ e2d::Music::Music() { } -e2d::Music::~Music() +easy2d::Music::~Music() { Close(); } -bool e2d::Music::Load(const e2d::String & file_path) +bool easy2d::Music::Load(const easy2d::String & file_path) { if (opened_) { @@ -368,7 +368,7 @@ bool e2d::Music::Load(const e2d::String & file_path) return true; } -bool e2d::Music::Load(const Resource& res) +bool easy2d::Music::Load(const Resource& res) { if (opened_) { @@ -396,7 +396,7 @@ bool e2d::Music::Load(const Resource& res) return true; } -bool e2d::Music::Play(int loop_count) +bool easy2d::Music::Play(int loop_count) { if (!opened_) { @@ -446,7 +446,7 @@ bool e2d::Music::Play(int loop_count) return playing_; } -void e2d::Music::Pause() +void easy2d::Music::Pause() { if (voice_) { @@ -457,7 +457,7 @@ void e2d::Music::Pause() } } -void e2d::Music::Resume() +void easy2d::Music::Resume() { if (voice_) { @@ -468,7 +468,7 @@ void e2d::Music::Resume() } } -void e2d::Music::Stop() +void easy2d::Music::Stop() { if (voice_) { @@ -481,7 +481,7 @@ void e2d::Music::Stop() } } -void e2d::Music::Close() +void easy2d::Music::Close() { if (voice_) { @@ -501,7 +501,7 @@ void e2d::Music::Close() playing_ = false; } -bool e2d::Music::IsPlaying() const +bool easy2d::Music::IsPlaying() const { if (opened_ && voice_) { @@ -513,7 +513,7 @@ bool e2d::Music::IsPlaying() const return false; } -float e2d::Music::GetVolume() const +float easy2d::Music::GetVolume() const { if (voice_) { @@ -524,7 +524,7 @@ float e2d::Music::GetVolume() const return 0.f; } -bool e2d::Music::SetVolume(float volume) +bool easy2d::Music::SetVolume(float volume) { if (voice_) { @@ -534,7 +534,7 @@ bool e2d::Music::SetVolume(float volume) return false; } -IXAudio2SourceVoice * e2d::Music::GetSourceVoice() const +IXAudio2SourceVoice * easy2d::Music::GetSourceVoice() const { return voice_; } diff --git a/core/tools/Path.cpp b/core/tools/Path.cpp index e6616d9f..48556c43 100644 --- a/core/tools/Path.cpp +++ b/core/tools/Path.cpp @@ -22,7 +22,7 @@ #include "..\e2dmodule.h" #include -const e2d::String& e2d::Path::GetDataPath() +const easy2d::String& easy2d::Path::GetDataPath() { static String data_path; if (data_path.IsEmpty()) @@ -47,7 +47,7 @@ const e2d::String& e2d::Path::GetDataPath() return data_path; } -const e2d::String& e2d::Path::GetTemporaryPath() +const easy2d::String& easy2d::Path::GetTemporaryPath() { static String temp_path; if (temp_path.IsEmpty()) @@ -71,7 +71,7 @@ const e2d::String& e2d::Path::GetTemporaryPath() return temp_path; } -const e2d::String& e2d::Path::GetLocalAppDataPath() +const easy2d::String& easy2d::Path::GetLocalAppDataPath() { static String local_app_data_path; if (local_app_data_path.IsEmpty()) @@ -85,7 +85,7 @@ const e2d::String& e2d::Path::GetLocalAppDataPath() return local_app_data_path; } -const e2d::String& e2d::Path::GetExeFilePath() +const easy2d::String& easy2d::Path::GetExeFilePath() { static String exe_file_path; if (exe_file_path.IsEmpty()) diff --git a/core/tools/Player.cpp b/core/tools/Player.cpp index e6bd1f69..2264a3fa 100644 --- a/core/tools/Player.cpp +++ b/core/tools/Player.cpp @@ -1,18 +1,18 @@ #include "..\e2dtool.h" -std::map e2d::Player::musics_; +std::map easy2d::Player::musics_; -e2d::Player::Player() +easy2d::Player::Player() : volume_(1.f) { } -e2d::Player::~Player() +easy2d::Player::~Player() { } -bool e2d::Player::Load(const String & file_path) +bool easy2d::Player::Load(const String & file_path) { if (file_path.IsEmpty()) return false; @@ -35,7 +35,7 @@ bool e2d::Player::Load(const String & file_path) return false; } -bool e2d::Player::Play(const String & file_path, int loop_count) +bool easy2d::Player::Play(const String & file_path, int loop_count) { if (file_path.IsEmpty()) return false; @@ -51,7 +51,7 @@ bool e2d::Player::Play(const String & file_path, int loop_count) return false; } -void e2d::Player::Pause(const String & file_path) +void easy2d::Player::Pause(const String & file_path) { if (file_path.IsEmpty()) return; @@ -61,7 +61,7 @@ void e2d::Player::Pause(const String & file_path) musics_[hash]->Pause(); } -void e2d::Player::Resume(const String & file_path) +void easy2d::Player::Resume(const String & file_path) { if (file_path.IsEmpty()) return; @@ -71,7 +71,7 @@ void e2d::Player::Resume(const String & file_path) musics_[hash]->Resume(); } -void e2d::Player::Stop(const String & file_path) +void easy2d::Player::Stop(const String & file_path) { if (file_path.IsEmpty()) return; @@ -81,7 +81,7 @@ void e2d::Player::Stop(const String & file_path) musics_[hash]->Stop(); } -bool e2d::Player::IsPlaying(const String & file_path) +bool easy2d::Player::IsPlaying(const String & file_path) { if (file_path.IsEmpty()) return false; @@ -92,7 +92,7 @@ bool e2d::Player::IsPlaying(const String & file_path) return false; } -bool e2d::Player::Load(const Resource& res) +bool easy2d::Player::Load(const Resource& res) { if (musics_.end() != musics_.find(res.id)) return true; @@ -115,7 +115,7 @@ bool e2d::Player::Load(const Resource& res) return false; } -bool e2d::Player::Play(const Resource& res, int loop_count) +bool easy2d::Player::Play(const Resource& res, int loop_count) { if (Load(res)) { @@ -128,37 +128,37 @@ bool e2d::Player::Play(const Resource& res, int loop_count) return false; } -void e2d::Player::Pause(const Resource& res) +void easy2d::Player::Pause(const Resource& res) { if (musics_.end() != musics_.find(res.id)) musics_[res.id]->Pause(); } -void e2d::Player::Resume(const Resource& res) +void easy2d::Player::Resume(const Resource& res) { if (musics_.end() != musics_.find(res.id)) musics_[res.id]->Resume(); } -void e2d::Player::Stop(const Resource& res) +void easy2d::Player::Stop(const Resource& res) { if (musics_.end() != musics_.find(res.id)) musics_[res.id]->Stop(); } -bool e2d::Player::IsPlaying(const Resource& res) +bool easy2d::Player::IsPlaying(const Resource& res) { if (musics_.end() != musics_.find(res.id)) return musics_[res.id]->IsPlaying(); return false; } -float e2d::Player::GetVolume() const +float easy2d::Player::GetVolume() const { return volume_; } -void e2d::Player::SetVolume(float volume) +void easy2d::Player::SetVolume(float volume) { volume_ = std::min(std::max(volume, -224.f), 224.f); for (const auto& pair : musics_) @@ -167,7 +167,7 @@ void e2d::Player::SetVolume(float volume) } } -void e2d::Player::PauseAll() +void easy2d::Player::PauseAll() { for (const auto& pair : musics_) { @@ -175,7 +175,7 @@ void e2d::Player::PauseAll() } } -void e2d::Player::ResumeAll() +void easy2d::Player::ResumeAll() { for (const auto& pair : musics_) { @@ -183,7 +183,7 @@ void e2d::Player::ResumeAll() } } -void e2d::Player::StopAll() +void easy2d::Player::StopAll() { for (const auto& pair : musics_) { @@ -191,7 +191,7 @@ void e2d::Player::StopAll() } } -void e2d::Player::ClearCache() +void easy2d::Player::ClearCache() { if (musics_.empty()) return; diff --git a/core/tools/Random.cpp b/core/tools/Random.cpp index 4992188a..035dce8b 100644 --- a/core/tools/Random.cpp +++ b/core/tools/Random.cpp @@ -20,7 +20,7 @@ #include "..\e2dtool.h" -std::default_random_engine &e2d::Random::GetEngine() +std::default_random_engine &easy2d::Random::GetEngine() { static std::random_device device; static std::default_random_engine engine(device()); diff --git a/core/transitions/BoxTransition.cpp b/core/transitions/BoxTransition.cpp index 0696a0e8..487d4332 100644 --- a/core/transitions/BoxTransition.cpp +++ b/core/transitions/BoxTransition.cpp @@ -21,19 +21,19 @@ #include "..\e2dtransition.h" #include "..\e2dobject.h" -e2d::BoxTransition::BoxTransition(float duration) +easy2d::BoxTransition::BoxTransition(float duration) : Transition(duration) { } -void e2d::BoxTransition::Init(Scene * prev, Scene * next, Game * game) +void easy2d::BoxTransition::Init(Scene * prev, Scene * next, Game * game) { Transition::Init(prev, next, game); in_layer_param_.opacity = 0; } -void e2d::BoxTransition::Update() +void easy2d::BoxTransition::Update() { Transition::Update(); diff --git a/core/transitions/EmergeTransition.cpp b/core/transitions/EmergeTransition.cpp index fcdb501a..37e315dd 100644 --- a/core/transitions/EmergeTransition.cpp +++ b/core/transitions/EmergeTransition.cpp @@ -21,12 +21,12 @@ #include "..\e2dtransition.h" #include "..\e2dobject.h" -e2d::EmergeTransition::EmergeTransition(float duration) +easy2d::EmergeTransition::EmergeTransition(float duration) : Transition(duration) { } -void e2d::EmergeTransition::Init(Scene * prev, Scene * next, Game * game) +void easy2d::EmergeTransition::Init(Scene * prev, Scene * next, Game * game) { Transition::Init(prev, next, game); @@ -34,7 +34,7 @@ void e2d::EmergeTransition::Init(Scene * prev, Scene * next, Game * game) in_layer_param_.opacity = 0; } -void e2d::EmergeTransition::Update() +void easy2d::EmergeTransition::Update() { Transition::Update(); diff --git a/core/transitions/FadeTransition.cpp b/core/transitions/FadeTransition.cpp index 5780ee8d..1224e605 100644 --- a/core/transitions/FadeTransition.cpp +++ b/core/transitions/FadeTransition.cpp @@ -21,12 +21,12 @@ #include "..\e2dtransition.h" #include "..\e2dobject.h" -e2d::FadeTransition::FadeTransition(float duration) +easy2d::FadeTransition::FadeTransition(float duration) : Transition(duration) { } -void e2d::FadeTransition::Init(Scene * prev, Scene * next, Game * game) +void easy2d::FadeTransition::Init(Scene * prev, Scene * next, Game * game) { Transition::Init(prev, next, game); @@ -34,7 +34,7 @@ void e2d::FadeTransition::Init(Scene * prev, Scene * next, Game * game) in_layer_param_.opacity = 0; } -void e2d::FadeTransition::Update() +void easy2d::FadeTransition::Update() { Transition::Update(); diff --git a/core/transitions/MoveTransition.cpp b/core/transitions/MoveTransition.cpp index 55827a53..30f5cadd 100644 --- a/core/transitions/MoveTransition.cpp +++ b/core/transitions/MoveTransition.cpp @@ -21,13 +21,13 @@ #include "..\e2dtransition.h" #include "..\e2dobject.h" -e2d::MoveTransition::MoveTransition(float duration, Direction direction) +easy2d::MoveTransition::MoveTransition(float duration, Direction direction) : Transition(duration) , direction_(direction) { } -void e2d::MoveTransition::Init(Scene * prev, Scene * next, Game * game) +void easy2d::MoveTransition::Init(Scene * prev, Scene * next, Game * game) { Transition::Init(prev, next, game); @@ -67,7 +67,7 @@ void e2d::MoveTransition::Init(Scene * prev, Scene * next, Game * game) } } -void e2d::MoveTransition::Update() +void easy2d::MoveTransition::Update() { Transition::Update(); @@ -94,7 +94,7 @@ void e2d::MoveTransition::Update() } } -void e2d::MoveTransition::Reset() +void easy2d::MoveTransition::Reset() { if (out_scene_) { diff --git a/core/transitions/RotationTransition.cpp b/core/transitions/RotationTransition.cpp index d7e39337..8c4b02fa 100644 --- a/core/transitions/RotationTransition.cpp +++ b/core/transitions/RotationTransition.cpp @@ -21,13 +21,13 @@ #include "..\e2dtransition.h" #include "..\e2dobject.h" -e2d::RotationTransition::RotationTransition(float duration, float rotation) +easy2d::RotationTransition::RotationTransition(float duration, float rotation) : Transition(duration) , rotation_(rotation) { } -void e2d::RotationTransition::Init(Scene * prev, Scene * next, Game * game) +void easy2d::RotationTransition::Init(Scene * prev, Scene * next, Game * game) { Transition::Init(prev, next, game); @@ -44,7 +44,7 @@ void e2d::RotationTransition::Init(Scene * prev, Scene * next, Game * game) in_layer_param_.opacity = 0; } -void e2d::RotationTransition::Update() +void easy2d::RotationTransition::Update() { Transition::Update(); @@ -90,7 +90,7 @@ void e2d::RotationTransition::Update() } } -void e2d::RotationTransition::Reset() +void easy2d::RotationTransition::Reset() { if (out_scene_) { diff --git a/core/transitions/Transition.cpp b/core/transitions/Transition.cpp index 0110cd11..635a6441 100644 --- a/core/transitions/Transition.cpp +++ b/core/transitions/Transition.cpp @@ -22,7 +22,7 @@ #include "..\e2dobject.h" #include "..\e2dmodule.h" -e2d::Transition::Transition(float duration) +easy2d::Transition::Transition(float duration) : done_(false) , started_() , process_(0) @@ -37,7 +37,7 @@ e2d::Transition::Transition(float duration) duration_ = std::max(duration, 0.f); } -e2d::Transition::~Transition() +easy2d::Transition::~Transition() { SafeRelease(out_layer_); SafeRelease(in_layer_); @@ -45,12 +45,12 @@ e2d::Transition::~Transition() SafeRelease(in_scene_); } -bool e2d::Transition::IsDone() +bool easy2d::Transition::IsDone() { return done_; } -void e2d::Transition::Init(Scene * prev, Scene * next, Game * game) +void easy2d::Transition::Init(Scene * prev, Scene * next, Game * game) { started_ = Time::Now(); out_scene_ = prev; @@ -94,7 +94,7 @@ void e2d::Transition::Init(Scene * prev, Scene * next, Game * game) ); } -void e2d::Transition::Update() +void easy2d::Transition::Update() { if (duration_ == 0) { @@ -112,7 +112,7 @@ void e2d::Transition::Update() } } -void e2d::Transition::Draw() +void easy2d::Transition::Draw() { auto render_target = Device::GetGraphics()->GetRenderTarget(); @@ -157,7 +157,7 @@ void e2d::Transition::Draw() } } -void e2d::Transition::Stop() +void easy2d::Transition::Stop() { done_ = true; Reset(); diff --git a/core/utils/Color.cpp b/core/utils/Color.cpp index f275e4fd..df4b79dc 100644 --- a/core/utils/Color.cpp +++ b/core/utils/Color.cpp @@ -28,7 +28,7 @@ static const UINT kRedMask = 0xff << kRedShift; static const UINT kGreenMask = 0xff << kGreenShift; static const UINT kBlueMask = 0xff << kBlueShift; -e2d::Color::Color() +easy2d::Color::Color() : r(0) , g(0) , b(0) @@ -36,7 +36,7 @@ e2d::Color::Color() { } -e2d::Color::Color(float r, float g, float b) +easy2d::Color::Color(float r, float g, float b) : r(r) , g(g) , b(b) @@ -44,7 +44,7 @@ e2d::Color::Color(float r, float g, float b) { } -e2d::Color::Color(float r, float g, float b, float alpha) +easy2d::Color::Color(float r, float g, float b, float alpha) : r(r) , g(g) , b(b) @@ -52,7 +52,7 @@ e2d::Color::Color(float r, float g, float b, float alpha) { } -e2d::Color::Color(UINT rgb) +easy2d::Color::Color(UINT rgb) : r(((rgb & kRedMask) >> kRedShift) / 255.f) , g(((rgb & kGreenMask) >> kGreenShift) / 255.f) , b(((rgb & kBlueMask) >> kBlueShift) / 255.f) @@ -60,7 +60,7 @@ e2d::Color::Color(UINT rgb) { } -e2d::Color::Color(UINT rgb, float alpha) +easy2d::Color::Color(UINT rgb, float alpha) : r(((rgb & kRedMask) >> kRedShift) / 255.f) , g(((rgb & kGreenMask) >> kGreenShift) / 255.f) , b(((rgb & kBlueMask) >> kBlueShift) / 255.f) @@ -68,7 +68,7 @@ e2d::Color::Color(UINT rgb, float alpha) { } -e2d::Color::Color(const D2D1_COLOR_F& color) +easy2d::Color::Color(const D2D1_COLOR_F& color) : r(color.r) , g(color.g) , b(color.b) @@ -76,7 +76,7 @@ e2d::Color::Color(const D2D1_COLOR_F& color) { } -e2d::Color::operator D2D1_COLOR_F() const +easy2d::Color::operator D2D1_COLOR_F() const { D2D1::ColorF color_f(r, g, b, a); return std::move(color_f); diff --git a/core/utils/Duration.cpp b/core/utils/Duration.cpp index 679e9146..34ea13f7 100644 --- a/core/utils/Duration.cpp +++ b/core/utils/Duration.cpp @@ -22,77 +22,77 @@ using namespace std::chrono; -e2d::Duration::Duration() +easy2d::Duration::Duration() : duration_ms_() { } -e2d::Duration::Duration(float seconds) +easy2d::Duration::Duration(float seconds) : duration_ms_(static_cast(seconds * 1000.f)) { } -int e2d::Duration::Milliseconds() const +int easy2d::Duration::Milliseconds() const { return static_cast(duration_ms_.count()); } -float e2d::Duration::Seconds() const +float easy2d::Duration::Seconds() const { return duration_ms_.count() / 1000.f; } -bool e2d::Duration::operator==(const Duration & other) const +bool easy2d::Duration::operator==(const Duration & other) const { return duration_ms_ == other.duration_ms_; } -bool e2d::Duration::operator!=(const Duration & other) const +bool easy2d::Duration::operator!=(const Duration & other) const { return duration_ms_ != other.duration_ms_; } -bool e2d::Duration::operator>(const Duration & other) const +bool easy2d::Duration::operator>(const Duration & other) const { return duration_ms_ > other.duration_ms_; } -bool e2d::Duration::operator>=(const Duration & other) const +bool easy2d::Duration::operator>=(const Duration & other) const { return duration_ms_ >= other.duration_ms_; } -bool e2d::Duration::operator<(const Duration & other) const +bool easy2d::Duration::operator<(const Duration & other) const { return duration_ms_ < other.duration_ms_; } -bool e2d::Duration::operator<=(const Duration & other) const +bool easy2d::Duration::operator<=(const Duration & other) const { return duration_ms_ <= other.duration_ms_; } -e2d::Duration e2d::Duration::operator+(Duration const & other) const +easy2d::Duration easy2d::Duration::operator+(Duration const & other) const { Duration d; d.duration_ms_ = duration_ms_ + other.duration_ms_; return std::move(d); } -e2d::Duration e2d::Duration::operator-(Duration const & other) const +easy2d::Duration easy2d::Duration::operator-(Duration const & other) const { Duration d; d.duration_ms_ = duration_ms_ - other.duration_ms_; return std::move(d); } -e2d::Duration & e2d::Duration::operator+=(Duration const &other) +easy2d::Duration & easy2d::Duration::operator+=(Duration const &other) { duration_ms_ += other.duration_ms_; return (*this); } -e2d::Duration & e2d::Duration::operator-=(Duration const &other) +easy2d::Duration & easy2d::Duration::operator-=(Duration const &other) { duration_ms_ -= other.duration_ms_; return (*this); diff --git a/core/utils/Font.cpp b/core/utils/Font.cpp index 2d872712..df5b7ada 100644 --- a/core/utils/Font.cpp +++ b/core/utils/Font.cpp @@ -20,7 +20,7 @@ #include "..\e2dutil.h" -e2d::Font::Font() +easy2d::Font::Font() : family("") , size(22) , weight(Font::Weight::Normal) @@ -28,7 +28,7 @@ e2d::Font::Font() { } -e2d::Font::Font(const String & family, float size, UINT weight, bool italic) +easy2d::Font::Font(const String & family, float size, UINT weight, bool italic) : family(family) , size(size) , weight(weight) diff --git a/core/utils/Function.cpp b/core/utils/Function.cpp index dcb82c1c..277f44ae 100644 --- a/core/utils/Function.cpp +++ b/core/utils/Function.cpp @@ -20,21 +20,21 @@ #include "..\e2dutil.h" -e2d::Function::Function() +easy2d::Function::Function() : func_(nullptr) {} -e2d::Function::Function(std::nullptr_t) +easy2d::Function::Function(std::nullptr_t) : func_(nullptr) { } -e2d::Function::Function(std::function func) +easy2d::Function::Function(std::function func) : func_(func) { } -void e2d::Function::operator()(void) const +void easy2d::Function::operator()(void) const { if (func_) { @@ -42,7 +42,7 @@ void e2d::Function::operator()(void) const } } -e2d::Function::operator bool() const +easy2d::Function::operator bool() const { return static_cast(func_); } \ No newline at end of file diff --git a/core/utils/Point.cpp b/core/utils/Point.cpp index a85ee261..00baa834 100644 --- a/core/utils/Point.cpp +++ b/core/utils/Point.cpp @@ -22,50 +22,50 @@ #include -e2d::Point::Point() +easy2d::Point::Point() { x = 0; y = 0; } -e2d::Point::Point(float x, float y) +easy2d::Point::Point(float x, float y) { this->x = x; this->y = y; } -e2d::Point::Point(const Point & other) +easy2d::Point::Point(const Point & other) { x = other.x; y = other.y; } -e2d::Point e2d::Point::operator+(const Point & p) const +easy2d::Point easy2d::Point::operator+(const Point & p) const { return Point(x + p.x, y + p.y); } -e2d::Point e2d::Point::operator-(const Point & p) const +easy2d::Point easy2d::Point::operator-(const Point & p) const { return Point(x - p.x, y - p.y); } -e2d::Point e2d::Point::operator*(float value) const +easy2d::Point easy2d::Point::operator*(float value) const { return Point(x * value, y * value); } -e2d::Point e2d::Point::operator/(float value) const +easy2d::Point easy2d::Point::operator/(float value) const { return Point(x / value, y / value); } -e2d::Point::operator e2d::Size() const +easy2d::Point::operator easy2d::Size() const { return Size(x, y); } -float e2d::Point::Distance(const Point &p1, const Point &p2) +float easy2d::Point::Distance(const Point &p1, const Point &p2) { return sqrt( (p1.x - p2.x) * (p1.x - p2.x) + @@ -73,12 +73,12 @@ float e2d::Point::Distance(const Point &p1, const Point &p2) ); } -e2d::Point e2d::Point::operator-() const +easy2d::Point easy2d::Point::operator-() const { return Point(-x, -y); } -bool e2d::Point::operator==(const Point & point) const +bool easy2d::Point::operator==(const Point & point) const { return (x == point.x) && (y == point.y); } diff --git a/core/utils/Rect.cpp b/core/utils/Rect.cpp index 8e2f2af6..248645c8 100644 --- a/core/utils/Rect.cpp +++ b/core/utils/Rect.cpp @@ -20,43 +20,43 @@ #include "..\e2dutil.h" -e2d::Rect::Rect(void) +easy2d::Rect::Rect(void) : origin() , size() { } -e2d::Rect::Rect(float x, float y, float width, float height) +easy2d::Rect::Rect(float x, float y, float width, float height) : origin(x, y) , size(width, height) { } -e2d::Rect::Rect(const Point& pos, const Size& size) +easy2d::Rect::Rect(const Point& pos, const Size& size) : origin(pos.x, pos.y) , size(size.width, size.height) { } -e2d::Rect::Rect(const Rect& other) +easy2d::Rect::Rect(const Rect& other) : origin(other.origin.x, other.origin.y) , size(other.size.width, other.size.height) { } -e2d::Rect& e2d::Rect::operator= (const Rect& other) +easy2d::Rect& easy2d::Rect::operator= (const Rect& other) { origin = other.origin; size = other.size; return *this; } -bool e2d::Rect::operator==(const Rect & rect) const +bool easy2d::Rect::operator==(const Rect & rect) const { return (origin == rect.origin) && (size == rect.size); } -bool e2d::Rect::ContainsPoint(const Point& point) const +bool easy2d::Rect::ContainsPoint(const Point& point) const { if (point.x >= origin.x && point.x <= (origin.y + size.height) && point.y >= origin.y && point.y <= (origin.y + size.height)) @@ -66,7 +66,7 @@ bool e2d::Rect::ContainsPoint(const Point& point) const return false; } -bool e2d::Rect::Intersects(const Rect& rect) const +bool easy2d::Rect::Intersects(const Rect& rect) const { return !((origin.x + size.width) < rect.origin.x || (rect.origin.x + rect.size.width) < origin.x || diff --git a/core/utils/Ref.cpp b/core/utils/Ref.cpp index 5de9e9a4..3058126f 100644 --- a/core/utils/Ref.cpp +++ b/core/utils/Ref.cpp @@ -20,21 +20,21 @@ #include "..\e2dobject.h" -e2d::Ref::Ref() +easy2d::Ref::Ref() : ref_count_(0) { } -e2d::Ref::~Ref() +easy2d::Ref::~Ref() { } -LONG e2d::Ref::Retain() +LONG easy2d::Ref::Retain() { return ::InterlockedIncrement(&ref_count_); } -LONG e2d::Ref::Release() +LONG easy2d::Ref::Release() { LONG new_count = ::InterlockedDecrement(&ref_count_); @@ -47,7 +47,7 @@ LONG e2d::Ref::Release() return new_count; } -LONG e2d::Ref::GetRefCount() const +LONG easy2d::Ref::GetRefCount() const { return ref_count_; } diff --git a/core/utils/Resource.cpp b/core/utils/Resource.cpp index 30b80c4f..552a28fd 100644 --- a/core/utils/Resource.cpp +++ b/core/utils/Resource.cpp @@ -21,7 +21,7 @@ #include "..\e2dtool.h" -e2d::Resource::Resource(int resource_id, const String & resource_type) +easy2d::Resource::Resource(int resource_id, const String & resource_type) : id(resource_id) , type(resource_type) { diff --git a/core/utils/Size.cpp b/core/utils/Size.cpp index 343a2b5a..582bee2e 100644 --- a/core/utils/Size.cpp +++ b/core/utils/Size.cpp @@ -20,55 +20,55 @@ #include "..\e2dutil.h" -e2d::Size::Size() +easy2d::Size::Size() { width = 0; height = 0; } -e2d::Size::Size(float width, float height) +easy2d::Size::Size(float width, float height) { this->width = width; this->height = height; } -e2d::Size::Size(const Size & other) +easy2d::Size::Size(const Size & other) { width = other.width; height = other.height; } -e2d::Size e2d::Size::operator+(const Size & other) const +easy2d::Size easy2d::Size::operator+(const Size & other) const { return Size(width + other.width, height + other.height); } -e2d::Size e2d::Size::operator-(const Size & other) const +easy2d::Size easy2d::Size::operator-(const Size & other) const { return Size(width - other.width, height - other.height); } -e2d::Size e2d::Size::operator*(float value) const +easy2d::Size easy2d::Size::operator*(float value) const { return Size(width * value, height * value); } -e2d::Size e2d::Size::operator/(float value) const +easy2d::Size easy2d::Size::operator/(float value) const { return Size(width / value, height / value); } -e2d::Size::operator e2d::Point() const +easy2d::Size::operator easy2d::Point() const { return Point(width, height); } -e2d::Size e2d::Size::operator-() const +easy2d::Size easy2d::Size::operator-() const { return Size(-width, -height); } -bool e2d::Size::operator==(const Size & other) const +bool easy2d::Size::operator==(const Size & other) const { return (width == other.width) && (height == other.height); } diff --git a/core/utils/String.cpp b/core/utils/String.cpp index 2f87ad64..23e8679c 100644 --- a/core/utils/String.cpp +++ b/core/utils/String.cpp @@ -25,77 +25,77 @@ #pragma comment(lib, "comsuppw.lib") -e2d::String::String() +easy2d::String::String() : string_(L"") { } -e2d::String::String(const wchar_t *str) +easy2d::String::String(const wchar_t *str) : string_(str) { } -e2d::String::String(const char *cstr) +easy2d::String::String(const char *cstr) : string_(static_cast(_bstr_t(cstr))) { } -e2d::String::String(e2d::String && str) +easy2d::String::String(easy2d::String && str) { string_ = std::move(str.string_); } -e2d::String::String(const e2d::String &str) +easy2d::String::String(const easy2d::String &str) : string_(str.string_) { } -e2d::String::~String() +easy2d::String::~String() { string_.clear(); } -e2d::String &e2d::String::operator=(const wchar_t *str) +easy2d::String &easy2d::String::operator=(const wchar_t *str) { string_ = str; return (*this); } -e2d::String & e2d::String::operator=(const char *cstr) +easy2d::String & easy2d::String::operator=(const char *cstr) { string_ = static_cast(_bstr_t(cstr)); return (*this); } -e2d::String e2d::String::Parse(int value) +easy2d::String easy2d::String::Parse(int value) { String tmp; tmp.string_ = std::to_wstring(value); return std::move(tmp); } -e2d::String e2d::String::Parse(unsigned int value) +easy2d::String easy2d::String::Parse(unsigned int value) { String tmp; tmp.string_ = std::to_wstring(value); return std::move(tmp); } -e2d::String e2d::String::Parse(float value) +easy2d::String easy2d::String::Parse(float value) { String tmp; tmp.string_ = std::to_wstring(value); return std::move(tmp); } -e2d::String e2d::String::Parse(double value) +easy2d::String easy2d::String::Parse(double value) { String tmp; tmp.string_ = std::to_wstring(value); return std::move(tmp); } -e2d::String e2d::String::Format(const char * format, ...) +easy2d::String easy2d::String::Format(const char * format, ...) { std::string tmp; @@ -117,7 +117,7 @@ e2d::String e2d::String::Format(const char * format, ...) return std::move(str); } -e2d::String e2d::String::Format(const wchar_t * format, ...) +easy2d::String easy2d::String::Format(const wchar_t * format, ...) { std::wstring tmp; @@ -139,13 +139,13 @@ e2d::String e2d::String::Format(const wchar_t * format, ...) return std::move(str); } -e2d::String & e2d::String::operator=(const String &str) +easy2d::String & easy2d::String::operator=(const String &str) { string_ = str.string_; return (*this); } -bool e2d::String::operator==(const wchar_t *str) const +bool easy2d::String::operator==(const wchar_t *str) const { if (str) { @@ -157,7 +157,7 @@ bool e2d::String::operator==(const wchar_t *str) const } } -bool e2d::String::operator==(const char *str) const +bool easy2d::String::operator==(const char *str) const { if (str) { @@ -170,12 +170,12 @@ bool e2d::String::operator==(const char *str) const } } -bool e2d::String::operator ==(const e2d::String &str) const +bool easy2d::String::operator ==(const easy2d::String &str) const { return string_ == str.string_; } -bool e2d::String::operator!=(const wchar_t *str) const +bool easy2d::String::operator!=(const wchar_t *str) const { if (str) { @@ -187,7 +187,7 @@ bool e2d::String::operator!=(const wchar_t *str) const } } -bool e2d::String::operator!=(const char *str) const +bool easy2d::String::operator!=(const char *str) const { if (str) { @@ -200,205 +200,205 @@ bool e2d::String::operator!=(const char *str) const } } -bool e2d::String::operator!=(const e2d::String &str) const +bool easy2d::String::operator!=(const easy2d::String &str) const { return string_ != str.string_; } -wchar_t &e2d::String::operator[](size_t index) +wchar_t &easy2d::String::operator[](size_t index) { return string_[index]; } -e2d::String e2d::String::operator+(const wchar_t *str) const +easy2d::String easy2d::String::operator+(const wchar_t *str) const { String temp; temp.string_ = string_ + str; return std::move(temp); } -e2d::String e2d::String::operator+(const char *str) const +easy2d::String easy2d::String::operator+(const char *str) const { String temp; temp.string_ = string_ + static_cast(_bstr_t(str)); return std::move(temp); } -e2d::String e2d::String::operator+(const e2d::String &str) const +easy2d::String easy2d::String::operator+(const easy2d::String &str) const { String temp; temp.string_ = string_ + str.string_; return std::move(temp); } -e2d::String e2d::operator+(const wchar_t *str1, const e2d::String &str2) +easy2d::String easy2d::operator+(const wchar_t *str1, const easy2d::String &str2) { String temp; temp.string_ = str1 + str2.string_; return std::move(temp); } -e2d::String e2d::operator+(const char *str1, const String &str2) +easy2d::String easy2d::operator+(const char *str1, const String &str2) { String temp; temp.string_ = static_cast(_bstr_t(str1)) + str2.string_; return std::move(temp); } -e2d::String & e2d::String::operator+=(const wchar_t *str) +easy2d::String & easy2d::String::operator+=(const wchar_t *str) { string_ += str; return (*this); } -e2d::String & e2d::String::operator+=(const char *str) +easy2d::String & easy2d::String::operator+=(const char *str) { string_ += static_cast(_bstr_t(str)); return (*this); } -e2d::String & e2d::String::operator+=(const String &str) +easy2d::String & easy2d::String::operator+=(const String &str) { string_ += str.string_; return (*this); } -bool e2d::String::operator>(const String &str) const +bool easy2d::String::operator>(const String &str) const { return string_ > str.string_; } -bool e2d::String::operator>=(const String &str) const +bool easy2d::String::operator>=(const String &str) const { return string_ >= str.string_; } -bool e2d::String::operator<(const String &str) const +bool easy2d::String::operator<(const String &str) const { return string_ < str.string_; } -bool e2d::String::operator<=(const String &str) const +bool easy2d::String::operator<=(const String &str) const { return string_ <= str.string_; } -e2d::String & e2d::String::operator<<(const String &str) +easy2d::String & easy2d::String::operator<<(const String &str) { string_ += str.string_; return (*this); } -e2d::String & e2d::String::operator<<(const wchar_t *str) +easy2d::String & easy2d::String::operator<<(const wchar_t *str) { string_ += str; return (*this); } -e2d::String & e2d::String::operator<<(wchar_t *str) +easy2d::String & easy2d::String::operator<<(wchar_t *str) { string_ += str; return (*this); } -e2d::String & e2d::String::operator<<(const char * cstr) +easy2d::String & easy2d::String::operator<<(const char * cstr) { string_ += static_cast(_bstr_t(cstr)); return (*this); } -e2d::String & e2d::String::operator<<(char * cstr) +easy2d::String & easy2d::String::operator<<(char * cstr) { string_ += static_cast(_bstr_t(cstr)); return (*this); } -e2d::String & e2d::String::operator<<(int value) +easy2d::String & easy2d::String::operator<<(int value) { (*this) += String::Parse(value); return (*this); } -e2d::String & e2d::String::operator<<(unsigned int value) +easy2d::String & easy2d::String::operator<<(unsigned int value) { (*this) += String::Parse(value); return (*this); } -e2d::String & e2d::String::operator<<(float value) +easy2d::String & easy2d::String::operator<<(float value) { (*this) += String::Parse(value); return (*this); } -e2d::String & e2d::String::operator<<(double value) +easy2d::String & easy2d::String::operator<<(double value) { (*this) += String::Parse(value); return (*this); } -e2d::String::operator const wchar_t*() const +easy2d::String::operator const wchar_t*() const { return string_.c_str(); } -e2d::String::operator wchar_t*() const +easy2d::String::operator wchar_t*() const { return const_cast(string_.c_str()); } -e2d::String::operator std::wstring() const +easy2d::String::operator std::wstring() const { return string_; } -e2d::String::operator std::string() const +easy2d::String::operator std::string() const { std::string str = static_cast(_bstr_t(string_.c_str())); return std::move(str); } -bool e2d::String::IsEmpty() const +bool easy2d::String::IsEmpty() const { return string_.empty(); } -int e2d::String::GetLength() const +int easy2d::String::GetLength() const { return static_cast(string_.size()); } -size_t e2d::String::GetHash() const +size_t easy2d::String::GetHash() const { std::hash hash; return hash(string_); } -const wchar_t& e2d::String::At(size_t index) const +const wchar_t& easy2d::String::At(size_t index) const { return string_.at(index); } -int e2d::String::Compare(const String & str) const +int easy2d::String::Compare(const String & str) const { return string_.compare(str.string_); } -e2d::String e2d::String::ToUpper() const +easy2d::String easy2d::String::ToUpper() const { String str(*this); std::transform(str.string_.begin(), str.string_.end(), str.string_.begin(), std::towupper); return std::move(str); } -e2d::String e2d::String::ToLower() const +easy2d::String easy2d::String::ToLower() const { - e2d::String str(*this); + easy2d::String str(*this); std::transform(str.string_.begin(), str.string_.end(), str.string_.begin(), std::towlower); return std::move(str); } -int e2d::String::ToInt() const +int easy2d::String::ToInt() const { if (string_.empty()) { @@ -407,7 +407,7 @@ int e2d::String::ToInt() const return std::stoi(string_, 0, 10); } -float e2d::String::ToFloat() const +float easy2d::String::ToFloat() const { if (string_.empty()) { @@ -416,7 +416,7 @@ float e2d::String::ToFloat() const return std::stof(string_, 0); } -double e2d::String::ToDouble() const +double easy2d::String::ToDouble() const { if (string_.empty()) { @@ -425,7 +425,7 @@ double e2d::String::ToDouble() const return std::stod(string_, 0); } -bool e2d::String::ToBool() const +bool easy2d::String::ToBool() const { if (string_.empty()) { @@ -439,7 +439,7 @@ bool e2d::String::ToBool() const return true; } -e2d::String e2d::String::Subtract(int offset, int count) const +easy2d::String easy2d::String::Subtract(int offset, int count) const { String tmp; int length = static_cast(string_.size()); @@ -456,12 +456,12 @@ e2d::String e2d::String::Subtract(int offset, int count) const return std::move(tmp); } -void e2d::String::Insert(const String & str, int pos) +void easy2d::String::Insert(const String & str, int pos) { string_.insert(size_t(pos), str.string_); } -void e2d::String::Replace(const String & from, const String & to) +void easy2d::String::Replace(const String & from, const String & to) { if (from.string_.empty()) return; @@ -474,12 +474,12 @@ void e2d::String::Replace(const String & from, const String & to) } } -void e2d::String::Erase(int offset, int count) +void easy2d::String::Erase(int offset, int count) { string_.erase(size_t(offset), size_t(count)); } -int e2d::String::Find(const String & str, int offset) const +int easy2d::String::Find(const String & str, int offset) const { size_t index; if ((index = string_.find(str.string_, size_t(offset))) == std::wstring::npos) @@ -492,31 +492,31 @@ int e2d::String::Find(const String & str, int offset) const } } -void e2d::String::Clear() +void easy2d::String::Clear() { string_.clear(); } -std::wostream & e2d::operator<<(std::wostream &cout, const String &str) +std::wostream & easy2d::operator<<(std::wostream &cout, const String &str) { cout << str.string_; return cout; } -std::wistream & e2d::operator>>(std::wistream &cin, String &str) +std::wistream & easy2d::operator>>(std::wistream &cin, String &str) { cin >> str.string_; return cin; } -std::ostream & e2d::operator<<(std::ostream &cout, const String &str) +std::ostream & easy2d::operator<<(std::ostream &cout, const String &str) { std::string cstr = static_cast(_bstr_t(str.string_.c_str())); cout << cstr; return cout; } -std::istream & e2d::operator>>(std::istream &cin, String &str) +std::istream & easy2d::operator>>(std::istream &cin, String &str) { std::string temp; cin >> temp; diff --git a/core/utils/Time.cpp b/core/utils/Time.cpp index da8a537c..5a8f29f1 100644 --- a/core/utils/Time.cpp +++ b/core/utils/Time.cpp @@ -23,54 +23,54 @@ using namespace std::chrono; -e2d::Time::Time() +easy2d::Time::Time() { } -time_t e2d::Time::GetTimeStamp() const +time_t easy2d::Time::GetTimeStamp() const { auto& duration = time_point_cast(time_).time_since_epoch(); return static_cast(duration.count()); } -bool e2d::Time::IsZero() const +bool easy2d::Time::IsZero() const { return time_.time_since_epoch().count() == 0LL; } -e2d::Time e2d::Time::operator+(Duration const & other) const +easy2d::Time easy2d::Time::operator+(Duration const & other) const { Time t; t.time_ = time_ + milliseconds(other.Milliseconds()); return std::move(t); } -e2d::Time e2d::Time::operator-(Duration const & other) const +easy2d::Time easy2d::Time::operator-(Duration const & other) const { Time t; t.time_ = time_ - milliseconds(other.Milliseconds()); return std::move(t); } -e2d::Time & e2d::Time::operator+=(Duration const & other) +easy2d::Time & easy2d::Time::operator+=(Duration const & other) { time_ += milliseconds(other.Milliseconds()); return (*this); } -e2d::Time & e2d::Time::operator-=(Duration const &other) +easy2d::Time & easy2d::Time::operator-=(Duration const &other) { time_ -= milliseconds(other.Milliseconds()); return (*this); } -e2d::Duration e2d::Time::operator-(Time const & other) const +easy2d::Duration easy2d::Time::operator-(Time const & other) const { auto ms = duration_cast(time_ - other.time_).count(); return std::move(Duration(static_cast(ms) / 1000.f)); } -e2d::Time e2d::Time::Now() +easy2d::Time easy2d::Time::Now() { Time t; t.time_ = steady_clock::now(); diff --git a/core/utils/Transform.cpp b/core/utils/Transform.cpp index e588b16e..5f6c2f00 100644 --- a/core/utils/Transform.cpp +++ b/core/utils/Transform.cpp @@ -21,7 +21,7 @@ #include "..\e2dutil.h" -e2d::Transform::Transform() +easy2d::Transform::Transform() : position() , size() , scale_x(1.f) @@ -34,7 +34,7 @@ e2d::Transform::Transform() { } -e2d::Transform::operator D2D1::Matrix3x2F() const +easy2d::Transform::operator D2D1::Matrix3x2F() const { auto pivot = D2D1::Point2F(size.width * pivot_x, size.height * pivot_y); auto matrix = D2D1::Matrix3x2F::Scale( @@ -55,7 +55,7 @@ e2d::Transform::operator D2D1::Matrix3x2F() const return std::move(matrix); } -bool e2d::Transform::operator==(const Transform & other) const +bool easy2d::Transform::operator==(const Transform & other) const { return position == other.position && size == other.size &&