remove: SystemException

This commit is contained in:
Nomango 2018-09-10 20:55:20 +08:00
parent f26f385854
commit 6f489a77fe
17 changed files with 101 additions and 187 deletions

View File

@ -14,8 +14,8 @@ namespace e2d
// 基础动作
class Action :
public Ref
class Action
: public Ref
{
friend class ActionManager;
friend class Loop;
@ -90,8 +90,8 @@ namespace e2d
// 持续动作
class FiniteTimeAction :
public Action
class FiniteTimeAction
: public Action
{
public:
// 创建特定时长的持续动作
@ -121,8 +121,8 @@ namespace e2d
// 相对位移动作
class MoveBy :
public FiniteTimeAction
class MoveBy
: public FiniteTimeAction
{
public:
explicit MoveBy(
@ -153,8 +153,8 @@ namespace e2d
// 位移动作
class MoveTo :
public MoveBy
class MoveTo
: public MoveBy
{
public:
explicit MoveTo(
@ -184,8 +184,8 @@ namespace e2d
// 相对跳跃动作
class JumpBy :
public FiniteTimeAction
class JumpBy
: public FiniteTimeAction
{
public:
explicit JumpBy(
@ -220,8 +220,8 @@ namespace e2d
// 跳跃动作
class JumpTo :
public JumpBy
class JumpTo
: public JumpBy
{
public:
explicit JumpTo(
@ -253,8 +253,8 @@ namespace e2d
// 相对缩放动作
class ScaleBy :
public FiniteTimeAction
class ScaleBy
: public FiniteTimeAction
{
public:
explicit ScaleBy(
@ -292,8 +292,8 @@ namespace e2d
// 缩放动作
class ScaleTo :
public ScaleBy
class ScaleTo
: public ScaleBy
{
public:
explicit ScaleTo(
@ -330,8 +330,8 @@ namespace e2d
// 透明度相对渐变动作
class OpacityBy :
public FiniteTimeAction
class OpacityBy
: public FiniteTimeAction
{
public:
explicit OpacityBy(
@ -361,8 +361,8 @@ namespace e2d
// 透明度渐变动作
class OpacityTo :
public OpacityBy
class OpacityTo
: public OpacityBy
{
public:
explicit OpacityTo(
@ -392,8 +392,8 @@ namespace e2d
// 淡入动作
class FadeIn :
public OpacityTo
class FadeIn
: public OpacityTo
{
public:
// 创建淡入动作
@ -407,8 +407,8 @@ namespace e2d
// 淡出动作
class FadeOut :
public OpacityTo
class FadeOut
: public OpacityTo
{
public:
// 创建淡出动作
@ -422,8 +422,8 @@ namespace e2d
// 相对旋转动作
class RotateBy :
public FiniteTimeAction
class RotateBy
: public FiniteTimeAction
{
public:
explicit RotateBy(
@ -453,8 +453,8 @@ namespace e2d
// 旋转动作
class RotateTo :
public RotateBy
class RotateTo
: public RotateBy
{
public:
explicit RotateTo(
@ -484,8 +484,8 @@ namespace e2d
// 延时动作
class Delay :
public Action
class Delay
: public Action
{
public:
explicit Delay(
@ -520,8 +520,8 @@ namespace e2d
// 循环动作
class Loop :
public Action
class Loop
: public Action
{
public:
explicit Loop(
@ -560,8 +560,8 @@ namespace e2d
// 回调动作
class Callback :
public Action
class Callback
: public Action
{
public:
explicit Callback(
@ -589,8 +589,8 @@ namespace e2d
// 顺序动作
class Sequence :
public Action
class Sequence
: public Action
{
public:
typedef std::vector<Action*> Actions;
@ -641,8 +641,8 @@ namespace e2d
// 同步动作
class Spawn :
public Action
class Spawn
: public Action
{
public:
typedef std::vector<Action*> Actions;
@ -692,8 +692,8 @@ namespace e2d
// 帧动画
class Animation :
public Ref
class Animation
: public Ref
{
public:
typedef std::vector<Image*> Images;
@ -752,8 +752,8 @@ namespace e2d
// 精灵动作
class Animate :
public Action
class Animate
: public Action
{
public:
Animate();

View File

@ -5,8 +5,8 @@ namespace e2d
{
class Button :
public Node
class Button
: public Node
{
public:
Button();
@ -113,8 +113,8 @@ namespace e2d
// 꽉데
class Menu :
public Node
class Menu
: public Node
{
public:
Menu();

View File

@ -137,36 +137,22 @@ namespace e2d
};
// 异常
class Exception
// 运行时异常
class RuntimeException
: public std::exception
{
public:
Exception() E2D_NOEXCEPT;
RuntimeException() E2D_NOEXCEPT
: exception("unknown runtime exception", 1)
{
}
explicit Exception(const char * message) E2D_NOEXCEPT;
Exception(Exception const& other) E2D_NOEXCEPT;
virtual ~Exception() E2D_NOEXCEPT;
Exception& operator=(Exception const& other) E2D_NOEXCEPT;
// 获取异常信息
virtual const char * GetMsg() const;
private:
const char * message_;
};
// 系统异常
class SystemException
: public Exception
{
public:
SystemException() E2D_NOEXCEPT;
explicit SystemException(const char * message) E2D_NOEXCEPT;
explicit RuntimeException(
char const* const message
) E2D_NOEXCEPT
: exception(message, 1)
{
}
};
@ -177,7 +163,7 @@ namespace e2d
// 在此处设置断点以捕获 D2D API 异常.
static char s_str[64] = {};
sprintf_s(s_str, "Failure with HRESULT of %08X", static_cast<unsigned int>(hr));
throw SystemException(s_str);
throw RuntimeException(s_str);
}
}

View File

@ -8,8 +8,8 @@ namespace e2d
// 图片
class Image :
public Ref
class Image
: public Ref
{
public:
Image();
@ -111,9 +111,9 @@ namespace e2d
class Node;
// 场景
class Scene :
public Ref,
public EventTarget
class Scene
: public Ref
, public EventTarget
{
public:
Scene();
@ -306,8 +306,8 @@ namespace e2d
// 定时任务
class Task :
public Ref
class Task
: public Ref
{
friend class Node;
@ -406,9 +406,9 @@ namespace e2d
class Action;
// 节点
class Node :
public Ref,
public EventTarget
class Node
: public Ref
, public EventTarget
{
friend class Scene;
friend class Collider;
@ -875,9 +875,9 @@ namespace e2d
// 精灵
class Sprite :
public Node,
public Drawable
class Sprite
: public Node
, public Drawable
{
public:
Sprite();
@ -941,9 +941,9 @@ namespace e2d
// 文本
class Text :
public Node,
public Drawable
class Text
: public Node
, public Drawable
{
public:
// 文本对齐方式
@ -1159,9 +1159,9 @@ namespace e2d
// 画布
class Canvas :
public Node,
public Drawable
class Canvas
: public Node
, public Drawable
{
public:
Canvas(

View File

@ -50,8 +50,8 @@ namespace e2d
// 稜있
class Music :
public Ref
class Music
: public Ref
{
public:
Music();

View File

@ -9,8 +9,8 @@ namespace e2d
class Scene;
// 场景过渡
class Transition :
public Ref
class Transition
: public Ref
{
friend class Game;
@ -58,8 +58,8 @@ namespace e2d
// 淡入淡出过渡
class FadeTransition :
public Transition
class FadeTransition
: public Transition
{
public:
explicit FadeTransition(
@ -78,8 +78,8 @@ namespace e2d
// 渐变过渡
class EmergeTransition :
public Transition
class EmergeTransition
: public Transition
{
public:
explicit EmergeTransition(
@ -97,8 +97,8 @@ namespace e2d
// 盒状过渡
class BoxTransition :
public Transition
class BoxTransition
: public Transition
{
public:
explicit BoxTransition(
@ -116,8 +116,8 @@ namespace e2d
// 移入过渡
class MoveTransition :
public Transition
class MoveTransition
: public Transition
{
public:
explicit MoveTransition(

View File

@ -468,15 +468,15 @@ namespace e2d
);
template<typename Func>
Function(Func func) : func_(func) {}
Function(Func func)
: func_(func)
{
}
template<typename Func, typename Object>
Function(
Func&& func, /* 对象的成员函数 */
Object&& obj /* 对象指针 */
)
Function(Func&& func, Object&& obj)
: func_(std::bind(func, obj))
{
func_ = std::bind(func, obj);
}
void operator() (void) const;

View File

@ -1,37 +0,0 @@
#include "..\e2dimpl.h"
e2d::Exception::Exception() E2D_NOEXCEPT
: message_()
{
}
e2d::Exception::Exception(const char * message) E2D_NOEXCEPT
: message_(message)
{
}
e2d::Exception::Exception(Exception const& other) E2D_NOEXCEPT
: message_(other.message_)
{
}
e2d::Exception& e2d::Exception::operator=(Exception const& other) E2D_NOEXCEPT
{
if (this == &other)
{
return *this;
}
message_ = other.message_;
return *this;
}
e2d::Exception::~Exception() E2D_NOEXCEPT
{
}
const char * e2d::Exception::GetMsg() const
{
return message_;
}

View File

@ -1,11 +0,0 @@
#include "..\e2dimpl.h"
e2d::SystemException::SystemException() E2D_NOEXCEPT
: Exception("Unknown system exception")
{
}
e2d::SystemException::SystemException(const char * message) E2D_NOEXCEPT
: Exception(message)
{
}

View File

@ -200,7 +200,7 @@ HWND e2d::Window::GetHWnd()
else
{
::UnregisterClass(REGISTER_CLASS, HINST_THISCOMPONENT);
throw SystemException("Create window failed");
throw RuntimeException("Create window failed");
}
}
return hWnd_;

View File

@ -671,14 +671,14 @@ void e2d::Node::AddChild(Node * child, int order /* = 0 */)
{
if (child->parent_ != nullptr)
{
throw Exception("节点已有父节点, 不能再添加到其他节点");
throw RuntimeException("节点已有父节点, 不能再添加到其他节点");
}
for (Node * parent = this; parent != nullptr; parent = parent->GetParent())
{
if (child == parent)
{
throw Exception("一个节点不能同时是另一个节点的父节点和子节点");
throw RuntimeException("一个节点不能同时是另一个节点的父节点和子节点");
}
}
@ -855,7 +855,7 @@ void e2d::Node::RunAction(Action * action)
}
else
{
throw Exception("该 Action 已有执行目标");
throw RuntimeException("该 Action 已有执行目标");
}
}
}

View File

@ -45,8 +45,6 @@
<ClCompile Include="..\..\core\event\Collision.cpp" />
<ClCompile Include="..\..\core\event\KeyEvent.cpp" />
<ClCompile Include="..\..\core\event\MouseEvent.cpp" />
<ClCompile Include="..\..\core\impl\Exception.cpp" />
<ClCompile Include="..\..\core\impl\SystemException.cpp" />
<ClCompile Include="..\..\core\impl\TextRenderer.cpp" />
<ClCompile Include="..\..\core\impl\VoiceCallback.cpp" />
<ClCompile Include="..\..\core\manager\CollisionManager.cpp" />

View File

@ -150,12 +150,6 @@
<ClCompile Include="..\..\core\components\Menu.cpp">
<Filter>components</Filter>
</ClCompile>
<ClCompile Include="..\..\core\impl\Exception.cpp">
<Filter>impl</Filter>
</ClCompile>
<ClCompile Include="..\..\core\impl\SystemException.cpp">
<Filter>impl</Filter>
</ClCompile>
<ClCompile Include="..\..\core\impl\TextRenderer.cpp">
<Filter>impl</Filter>
</ClCompile>

View File

@ -189,8 +189,6 @@
<ClCompile Include="..\..\core\event\Collision.cpp" />
<ClCompile Include="..\..\core\event\KeyEvent.cpp" />
<ClCompile Include="..\..\core\event\MouseEvent.cpp" />
<ClCompile Include="..\..\core\impl\Exception.cpp" />
<ClCompile Include="..\..\core\impl\SystemException.cpp" />
<ClCompile Include="..\..\core\impl\TextRenderer.cpp" />
<ClCompile Include="..\..\core\impl\VoiceCallback.cpp" />
<ClCompile Include="..\..\core\manager\CollisionManager.cpp" />

View File

@ -150,12 +150,6 @@
<ClCompile Include="..\..\core\components\Menu.cpp">
<Filter>components</Filter>
</ClCompile>
<ClCompile Include="..\..\core\impl\Exception.cpp">
<Filter>impl</Filter>
</ClCompile>
<ClCompile Include="..\..\core\impl\SystemException.cpp">
<Filter>impl</Filter>
</ClCompile>
<ClCompile Include="..\..\core\impl\TextRenderer.cpp">
<Filter>impl</Filter>
</ClCompile>

View File

@ -222,8 +222,6 @@
<ClCompile Include="..\..\core\event\Collision.cpp" />
<ClCompile Include="..\..\core\event\KeyEvent.cpp" />
<ClCompile Include="..\..\core\event\MouseEvent.cpp" />
<ClCompile Include="..\..\core\impl\Exception.cpp" />
<ClCompile Include="..\..\core\impl\SystemException.cpp" />
<ClCompile Include="..\..\core\impl\TextRenderer.cpp" />
<ClCompile Include="..\..\core\impl\VoiceCallback.cpp" />
<ClCompile Include="..\..\core\manager\CollisionManager.cpp" />

View File

@ -150,12 +150,6 @@
<ClCompile Include="..\..\core\components\Menu.cpp">
<Filter>components</Filter>
</ClCompile>
<ClCompile Include="..\..\core\impl\Exception.cpp">
<Filter>impl</Filter>
</ClCompile>
<ClCompile Include="..\..\core\impl\SystemException.cpp">
<Filter>impl</Filter>
</ClCompile>
<ClCompile Include="..\..\core\impl\TextRenderer.cpp">
<Filter>impl</Filter>
</ClCompile>