From 9f1ab4485f6d554bd0ce791117b8ff94784d7896 Mon Sep 17 00:00:00 2001 From: Nomango <569629550@qq.com> Date: Thu, 24 May 2018 16:25:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0explicit=E9=99=90=E5=AE=9A?= =?UTF-8?q?=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/Tool/Timer.cpp | 2 +- core/e2daction.h | 48 ++++++++++++++++++++++---------------------- core/e2dcollider.h | 12 +++++------ core/e2dcommon.h | 10 ++++----- core/e2dnode.h | 30 +++++++++++++-------------- core/e2dshape.h | 16 +++++++-------- core/e2dtool.h | 6 +++--- core/e2dtransition.h | 10 ++++----- 8 files changed, 67 insertions(+), 67 deletions(-) diff --git a/core/Tool/Timer.cpp b/core/Tool/Timer.cpp index 26bf5ff6..fa8c8ac1 100644 --- a/core/Tool/Timer.cpp +++ b/core/Tool/Timer.cpp @@ -6,7 +6,7 @@ namespace e2d class TimerEntity { public: - TimerEntity( + explicit TimerEntity( const e2d::Function& func, const e2d::String& name, double delay, diff --git a/core/e2daction.h b/core/e2daction.h index df748ebb..de88ffb3 100644 --- a/core/e2daction.h +++ b/core/e2daction.h @@ -96,7 +96,7 @@ class FiniteTimeAction : { public: // 创建特定时长的持续动作 - FiniteTimeAction( + explicit FiniteTimeAction( double duration ); @@ -124,7 +124,7 @@ class MoveBy : public FiniteTimeAction { public: - MoveBy( + explicit MoveBy( double duration, /* 持续时长 */ Vector vector /* 移动距离 */ ); @@ -153,7 +153,7 @@ class MoveTo : public MoveBy { public: - MoveTo( + explicit MoveTo( double duration, /* 持续时长 */ Point pos /* 目的坐标 */ ); @@ -182,7 +182,7 @@ class JumpBy : public FiniteTimeAction { public: - JumpBy( + explicit JumpBy( double duration, /* 持续时长 */ const Vector& vec, /* 跳跃距离 */ double height, /* 跳跃高度 */ @@ -216,7 +216,7 @@ class JumpTo : public JumpBy { public: - JumpTo( + explicit JumpTo( double duration, /* 持续时长 */ const Point& pos, /* 目的坐标 */ double height, /* 跳跃高度 */ @@ -247,12 +247,12 @@ class ScaleBy : public FiniteTimeAction { public: - ScaleBy( + explicit ScaleBy( double duration, /* 持续时长 */ double scale /* 相对变化值 */ ); - ScaleBy( + explicit ScaleBy( double duration, /* 持续时长 */ double scaleX, /* 横向缩放相对变化值 */ double scaleY /* 纵向缩放相对变化值 */ @@ -284,12 +284,12 @@ class ScaleTo : public ScaleBy { public: - ScaleTo( + explicit ScaleTo( double duration, /* 持续时长 */ double scale /* 目标值 */ ); - ScaleTo( + explicit ScaleTo( double duration, /* 持续时长 */ double scaleX, /* 横向缩放目标值 */ double scaleY /* 纵向缩放目标值 */ @@ -320,7 +320,7 @@ class OpacityBy : public FiniteTimeAction { public: - OpacityBy( + explicit OpacityBy( double duration, /* 持续时长 */ double opacity /* 相对变化值 */ ); @@ -349,7 +349,7 @@ class OpacityTo : public OpacityBy { public: - OpacityTo( + explicit OpacityTo( double duration, /* 持续时长 */ double opacity /* 目标值 */ ); @@ -379,7 +379,7 @@ class FadeIn : { public: // 创建淡入动作 - FadeIn( + explicit FadeIn( double duration /* 持续时长 */ ) : OpacityTo(duration, 1) @@ -394,7 +394,7 @@ class FadeOut : { public: // 创建淡出动作 - FadeOut( + explicit FadeOut( double duration /* 持续时长 */ ) : OpacityTo(duration, 0) @@ -408,7 +408,7 @@ class RotateBy : public FiniteTimeAction { public: - RotateBy( + explicit RotateBy( double duration, /* 持续时长 */ double rotation /* 相对变化值 */ ); @@ -437,7 +437,7 @@ class RotateTo : public RotateBy { public: - RotateTo( + explicit RotateTo( double duration, /* 持续时长 */ double rotation /* 目标值 */ ); @@ -466,7 +466,7 @@ class Delay : public Action { public: - Delay( + explicit Delay( double duration /* 延迟时长(秒) */ ); @@ -500,7 +500,7 @@ class Loop : public Action { public: - Loop( + explicit Loop( Action * action, /* 执行循环的动作 */ int times = -1 /* 循环次数 */ ); @@ -541,7 +541,7 @@ class CallFunc : public Action { public: - CallFunc( + explicit CallFunc( const Function& func /* 函数对象 */ ); @@ -570,7 +570,7 @@ class Sequence : public: Sequence(); - Sequence( + explicit Sequence( const std::vector& actions /* 动作列表 */ ); @@ -621,7 +621,7 @@ class Spawn : public: Spawn(); - Spawn( + explicit Spawn( const std::vector& actions /* 动作列表 */ ); @@ -671,15 +671,15 @@ class Animation : public: Animation(); - Animation( + explicit Animation( const std::vector& frames /* 关键帧数组 */ ); - Animation( + explicit Animation( double interval /* 帧间隔(秒) */ ); - Animation( + explicit Animation( double interval, /* 帧间隔(秒) */ const std::vector& frames /* 关键帧数组 */ ); @@ -729,7 +729,7 @@ class Animate : public: Animate(); - Animate( + explicit Animate( Animation * animation ); diff --git a/core/e2dcollider.h b/core/e2dcollider.h index bcf45348..e7208487 100644 --- a/core/e2dcollider.h +++ b/core/e2dcollider.h @@ -212,14 +212,14 @@ class RectCollider : public: RectCollider(); - RectCollider( + explicit RectCollider( double x, double y, double width, double height ); - RectCollider( + explicit RectCollider( Node * node ); @@ -252,12 +252,12 @@ class CircleCollider : public: CircleCollider(); - CircleCollider( + explicit CircleCollider( Point center, double radius ); - CircleCollider( + explicit CircleCollider( Node * node ); @@ -288,13 +288,13 @@ class EllipseCollider : public: EllipseCollider(); - EllipseCollider( + explicit EllipseCollider( Point center, double radiusX, double radiusY ); - EllipseCollider( + explicit EllipseCollider( Node * node ); diff --git a/core/e2dcommon.h b/core/e2dcommon.h index 8be9a677..1c146389 100644 --- a/core/e2dcommon.h +++ b/core/e2dcommon.h @@ -430,7 +430,7 @@ public: public: Font(); - Font( + explicit Font( const String& family, double size = 22, UINT weight = Font::Weight::NORMAL, @@ -474,21 +474,21 @@ class Image : public: Image(); - Image( + explicit Image( const String& filePath /* 图片文件路径 */ ); - Image( + explicit Image( int resNameId, /* 图片资源名称 */ const String& resType /* 图片资源类型 */ ); - Image( + explicit Image( const String& filePath, /* 图片文件路径 */ const Rect& cropRect /* 裁剪矩形 */ ); - Image( + explicit Image( int resNameId, /* 图片资源名称 */ const String& resType, /* 图片资源类型 */ const Rect& cropRect /* 裁剪矩形 */ diff --git a/core/e2dnode.h b/core/e2dnode.h index 14bf4f65..f88671a1 100644 --- a/core/e2dnode.h +++ b/core/e2dnode.h @@ -468,25 +468,25 @@ class Sprite : public: Sprite(); - Sprite( + explicit Sprite( Image * image ); - Sprite( + explicit Sprite( const String& filePath /* 图片文件路径 */ ); - Sprite( + explicit Sprite( int resNameId, /* 图片资源名称 */ const String& resType /* 图片资源类型 */ ); - Sprite( + explicit Sprite( const String& filePath, /* 图片文件路径 */ const Rect& cropRect /* 裁剪矩形 */ ); - Sprite( + explicit Sprite( int resNameId, /* 图片资源名称 */ const String& resType, /* 图片资源类型 */ const Rect& cropRect /* 裁剪矩形 */ @@ -579,7 +579,7 @@ public: public: Text(); - Text( + explicit Text( const String& text, /* 文字内容 */ const Font& font = Font(), /* 字体 */ const Style& style = Style() /* 文本样式 */ @@ -750,25 +750,25 @@ class Button : public: Button(); - Button( + explicit Button( Node * normal, /* 普通状态 */ const Function& func = nullptr /* 按钮点击后的执行函数 */ ); - Button( + explicit Button( Node * normal, /* 普通状态 */ Node * selected, /* 鼠标按下状态 */ const Function& func = nullptr /* 按钮点击后的执行函数 */ ); - Button( + explicit Button( Node * normal, /* 普通状态 */ Node * mouseover, /* 鼠标移入状态 */ Node * selected, /* 鼠标按下状态 */ const Function& func = nullptr /* 按钮点击后的执行函数 */ ); - Button( + explicit Button( Node * normal, /* 普通状态 */ Node * mouseover, /* 鼠标移入状态 */ Node * selected, /* 鼠标移入状态 */ @@ -843,13 +843,13 @@ class ToggleButton : public: ToggleButton(); - ToggleButton( + explicit ToggleButton( Node * onNormal, /* 按钮打开时,普通状态 */ Node * offNormal, /* 按钮关闭时,普通状态 */ const Function& func = nullptr /* 按钮点击后的执行函数 */ ); - ToggleButton( + explicit ToggleButton( Node * onNormal, /* 按钮打开时,普通状态 */ Node * offNormal, /* 按钮关闭时,普通状态 */ Node * onSelected, /* 按钮打开时,鼠标按下状态 */ @@ -857,7 +857,7 @@ public: const Function& func = nullptr /* 按钮点击后的执行函数 */ ); - ToggleButton( + explicit ToggleButton( Node * onNormal, /* 按钮打开时,普通状态 */ Node * offNormal, /* 按钮关闭时,普通状态 */ Node * onMouseOver, /* 按钮打开时,鼠标移入状态 */ @@ -867,7 +867,7 @@ public: const Function& func = nullptr /* 按钮点击后的执行函数 */ ); - ToggleButton( + explicit ToggleButton( Node * onNormal, /* 按钮打开时,普通状态 */ Node * offNormal, /* 按钮关闭时,普通状态 */ Node * onMouseOver, /* 按钮打开时,鼠标移入状态 */ @@ -949,7 +949,7 @@ class Menu : public: Menu(); - Menu( + explicit Menu( const std::vector& buttons /* 按钮数组 */ ); diff --git a/core/e2dshape.h b/core/e2dshape.h index 17f718fa..262834a2 100644 --- a/core/e2dshape.h +++ b/core/e2dshape.h @@ -78,11 +78,11 @@ class RectShape : public: RectShape(); - RectShape( + explicit RectShape( Size size /* 宽度和高度 */ ); - RectShape( + explicit RectShape( Point topLeft, /* 左上角坐标 */ Size size /* 宽度和高度 */ ); @@ -105,13 +105,13 @@ class RoundRectShape : public: RoundRectShape(); - RoundRectShape( + explicit RoundRectShape( Size size, /* 宽度和高度 */ double radiusX, /* 圆角半径 */ double radiusY /* 圆角半径 */ ); - RoundRectShape( + explicit RoundRectShape( Point topLeft, /* 左上角坐标 */ Size size, /* 宽度和高度 */ double radiusX, /* 圆角半径 */ @@ -156,11 +156,11 @@ class CircleShape : public: CircleShape(); - CircleShape( + explicit CircleShape( double radius /* 半径 */ ); - CircleShape( + explicit CircleShape( Point center, /* 圆心坐标 */ double radius /* 半径 */ ); @@ -194,12 +194,12 @@ class EllipseShape : public: EllipseShape(); - EllipseShape( + explicit EllipseShape( double radiusX, /* 横轴半径 */ double radiusY /* 纵轴半径 */ ); - EllipseShape( + explicit EllipseShape( Point center, /* 圆心坐标 */ double radiusX, /* 横轴半径 */ double radiusY /* 纵轴半径 */ diff --git a/core/e2dtool.h b/core/e2dtool.h index f3aa21e3..51854d8c 100644 --- a/core/e2dtool.h +++ b/core/e2dtool.h @@ -57,11 +57,11 @@ class Music : public: Music(); - Music( + explicit Music( const e2d::String& filePath /* 音乐文件路径 */ ); - Music( + explicit Music( int resNameId, /* 音乐资源名称 */ const String& resType /* 音乐资源类型 */ ); @@ -330,7 +330,7 @@ class Listener public: Listener(); - Listener( + explicit Listener( const Function& func, const String& name, bool paused diff --git a/core/e2dtransition.h b/core/e2dtransition.h index d7af7b9e..a429417d 100644 --- a/core/e2dtransition.h +++ b/core/e2dtransition.h @@ -15,7 +15,7 @@ class Transition : friend class SceneManager; public: - Transition(double duration); + explicit Transition(double duration); virtual ~Transition(); @@ -67,7 +67,7 @@ class FadeTransition : public Transition { public: - FadeTransition( + explicit FadeTransition( double duration /* 动画持续时长 */ ); @@ -89,7 +89,7 @@ class EmergeTransition : public Transition { public: - EmergeTransition( + explicit EmergeTransition( double duration /* 浮现动画持续时长 */ ); @@ -111,7 +111,7 @@ class BoxTransition : public Transition { public: - BoxTransition( + explicit BoxTransition( double duration /* 动画持续时长 */ ); @@ -133,7 +133,7 @@ class MoveTransition : public Transition { public: - MoveTransition( + explicit MoveTransition( double moveDuration, /* 场景移动动画持续时长 */ Direction direction = Direction::LEFT /* 场景移动方向 */ );