Easy2D project renamed to Kiwano
This commit is contained in:
parent
e68e6c41cc
commit
b49d583fd5
|
|
@ -6,7 +6,7 @@ about: 创建一个 Bug 报告,请选择这个模版
|
||||||
|
|
||||||
### 编译环境
|
### 编译环境
|
||||||
|
|
||||||
- Easy2D 版本号:
|
- Kiwano 版本号:
|
||||||
- 操作系统:
|
- 操作系统:
|
||||||
- 编译器:
|
- 编译器:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
name: Confused
|
name: Confused
|
||||||
about: 使用 Easy2D 时有任何疑问,请选择这个模版
|
about: 使用 Kiwano 时有任何疑问,请选择这个模版
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -10,4 +10,4 @@ about: 使用 Easy2D 时有任何疑问,请选择这个模版
|
||||||
|
|
||||||
### 环境
|
### 环境
|
||||||
|
|
||||||
留下你使用的 Easy2D 版本号,以及系统、编译器等信息
|
留下你使用的 Kiwano 版本号,以及系统、编译器等信息
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Compile-time options for Easy2D
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
//---- Define assertion handler. Defaults to calling assert()
|
|
||||||
//#define E2D_ASSERT(EXPR) MyAssert(EXPR)
|
|
||||||
//#define E2D_ASSERT(EXPR) __noop // Disable asserts
|
|
||||||
|
|
||||||
//---- Define debug-output handler. Defaults to calling easy2d::logs::Messageln()/Warningln()/Errorln()
|
|
||||||
//#define E2D_LOG(FORMAT, ...) wprintf(FORMAT L"\n", __VA_ARGS__)
|
|
||||||
//#define E2D_WARNING_LOG(FORMAT, ...) wprintf(FORMAT L"\n", __VA_ARGS__)
|
|
||||||
//#define E2D_ERROR_LOG(FORMAT, ...) wprintf(FORMAT L"\n", __VA_ARGS__)
|
|
||||||
|
|
||||||
//---- Define attributes of all API symbols declarations for DLL
|
|
||||||
//#define E2D_API __declspec( dllexport )
|
|
||||||
//#define E2D_API __declspec( dllimport )
|
|
||||||
|
|
||||||
//---- Define DirectX version. Defaults to using Direct3D11
|
|
||||||
//#define E2D_USE_DIRECTX10
|
|
||||||
|
|
@ -4,7 +4,7 @@ VisualStudioVersion = 16.0.28729.10
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorld", "samples\HelloWorld\HelloWorld.vcxproj", "{3561A359-F9FD-48AB-A977-34E7E568BC8E}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorld", "samples\HelloWorld\HelloWorld.vcxproj", "{3561A359-F9FD-48AB-A977-34E7E568BC8E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Easy2D", "Easy2D\Easy2D.vcxproj", "{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Kiwano", "Kiwano\Kiwano.vcxproj", "{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Samples", "samples\Samples\Samples.vcxproj", "{45F5738D-CDF2-4024-974D-25B64F9043DE}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Samples", "samples\Samples\Samples.vcxproj", "{45F5738D-CDF2-4024-974D-25B64F9043DE}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
#include "Node.h"
|
#include "Node.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Action::Action()
|
Action::Action()
|
||||||
: running_(true)
|
: running_(true)
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,13 +21,13 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "include-forwards.h"
|
#include "include-forwards.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
using ActionCallback = Closure<void()>;
|
using ActionCallback = Closure<void()>;
|
||||||
|
|
||||||
class ActionManager;
|
class ActionManager;
|
||||||
|
|
||||||
class E2D_API Action
|
class KGE_API Action
|
||||||
: public virtual Object
|
: public virtual Object
|
||||||
, protected IntrusiveListItem<ActionPtr>
|
, protected IntrusiveListItem<ActionPtr>
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "ActionGroup.h"
|
#include "ActionGroup.h"
|
||||||
#include "../base/logs.h"
|
#include "../base/logs.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// ActionGroup
|
// ActionGroup
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,10 +21,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// 动作组
|
// 动作组
|
||||||
class E2D_API ActionGroup
|
class KGE_API ActionGroup
|
||||||
: public Action
|
: public Action
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -73,14 +73,14 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 顺序动作
|
// 顺序动作
|
||||||
class E2D_API ActionSequence
|
class KGE_API ActionSequence
|
||||||
: public ActionGroup
|
: public ActionGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
E2D_DEPRECATED("ActionSequence is deprecated, use ActionGroup instead")
|
KGE_DEPRECATED("ActionSequence is deprecated, use ActionGroup instead")
|
||||||
inline ActionSequence() : ActionGroup() {}
|
inline ActionSequence() : ActionGroup() {}
|
||||||
|
|
||||||
E2D_DEPRECATED("ActionSequence is deprecated, use ActionGroup instead")
|
KGE_DEPRECATED("ActionSequence is deprecated, use ActionGroup instead")
|
||||||
inline explicit ActionSequence(Array<ActionPtr> const& actions) : ActionGroup(actions, true) {}
|
inline explicit ActionSequence(Array<ActionPtr> const& actions) : ActionGroup(actions, true) {}
|
||||||
|
|
||||||
virtual ~ActionSequence() {}
|
virtual ~ActionSequence() {}
|
||||||
|
|
@ -88,14 +88,14 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 同步动作
|
// 同步动作
|
||||||
class E2D_API ActionSpawn
|
class KGE_API ActionSpawn
|
||||||
: public ActionGroup
|
: public ActionGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
E2D_DEPRECATED("ActionSpawn is deprecated, use ActionGroup instead")
|
KGE_DEPRECATED("ActionSpawn is deprecated, use ActionGroup instead")
|
||||||
inline ActionSpawn() : ActionGroup() { sequence_ = false; }
|
inline ActionSpawn() : ActionGroup() { sequence_ = false; }
|
||||||
|
|
||||||
E2D_DEPRECATED("ActionSpawn is deprecated, use ActionGroup instead")
|
KGE_DEPRECATED("ActionSpawn is deprecated, use ActionGroup instead")
|
||||||
inline explicit ActionSpawn(Array<ActionPtr> const& actions) : ActionGroup(actions, false) {}
|
inline explicit ActionSpawn(Array<ActionPtr> const& actions) : ActionGroup(actions, false) {}
|
||||||
|
|
||||||
virtual ~ActionSpawn() {}
|
virtual ~ActionSpawn() {}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include "ActionTween.h"
|
#include "ActionTween.h"
|
||||||
#include "Animation.h"
|
#include "Animation.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
struct ActionHelper
|
struct ActionHelper
|
||||||
{
|
{
|
||||||
|
|
@ -100,13 +100,13 @@ namespace easy2d
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
MoveBy(Point const& vector)
|
MoveBy(Point const& vector)
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionMoveBy(0, vector));
|
return TweenHelper(new kiwano::ActionMoveBy(0, vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
MoveTo(Point const& pos)
|
MoveTo(Point const& pos)
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionMoveTo(0, pos));
|
return TweenHelper(new kiwano::ActionMoveTo(0, pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
|
|
@ -115,7 +115,7 @@ namespace easy2d
|
||||||
float height, /* 跳跃高度 */
|
float height, /* 跳跃高度 */
|
||||||
int jumps = 1) /* 跳跃次数 */
|
int jumps = 1) /* 跳跃次数 */
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionJumpBy(0, pos, height, jumps));
|
return TweenHelper(new kiwano::ActionJumpBy(0, pos, height, jumps));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
|
|
@ -124,67 +124,67 @@ namespace easy2d
|
||||||
float height, /* 跳跃高度 */
|
float height, /* 跳跃高度 */
|
||||||
int jumps = 1) /* 跳跃次数 */
|
int jumps = 1) /* 跳跃次数 */
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionJumpTo(0, pos, height, jumps));
|
return TweenHelper(new kiwano::ActionJumpTo(0, pos, height, jumps));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
ScaleBy(float scale)
|
ScaleBy(float scale)
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionScaleBy(0, scale));
|
return TweenHelper(new kiwano::ActionScaleBy(0, scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
ScaleBy(float scale_x, float scale_y)
|
ScaleBy(float scale_x, float scale_y)
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionScaleBy(0, scale_x, scale_y));
|
return TweenHelper(new kiwano::ActionScaleBy(0, scale_x, scale_y));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
ScaleTo(float scale)
|
ScaleTo(float scale)
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionScaleTo(0, scale));
|
return TweenHelper(new kiwano::ActionScaleTo(0, scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
ScaleTo(float scale_x, float scale_y)
|
ScaleTo(float scale_x, float scale_y)
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionScaleTo(0, scale_x, scale_y));
|
return TweenHelper(new kiwano::ActionScaleTo(0, scale_x, scale_y));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
OpacityBy(float opacity)
|
OpacityBy(float opacity)
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionOpacityBy(0, opacity));
|
return TweenHelper(new kiwano::ActionOpacityBy(0, opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
OpacityTo(float opacity)
|
OpacityTo(float opacity)
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionOpacityTo(0, opacity));
|
return TweenHelper(new kiwano::ActionOpacityTo(0, opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
FadeIn(Duration dur)
|
FadeIn(Duration dur)
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionFadeIn(dur));
|
return TweenHelper(new kiwano::ActionFadeIn(dur));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
FadeOut(Duration dur)
|
FadeOut(Duration dur)
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionFadeOut(dur));
|
return TweenHelper(new kiwano::ActionFadeOut(dur));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
RotateBy(float rotation)
|
RotateBy(float rotation)
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionRotateBy(0, rotation));
|
return TweenHelper(new kiwano::ActionRotateBy(0, rotation));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
RotateTo(float rotation)
|
RotateTo(float rotation)
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionRotateTo(0, rotation));
|
return TweenHelper(new kiwano::ActionRotateTo(0, rotation));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
|
|
@ -194,39 +194,39 @@ namespace easy2d
|
||||||
float start = 0.f, /* 起点 */
|
float start = 0.f, /* 起点 */
|
||||||
float end = 1.f) /* 终点 */
|
float end = 1.f) /* 终点 */
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::ActionPath(0, geo, rotating, start, end));
|
return TweenHelper(new kiwano::ActionPath(0, geo, rotating, start, end));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TweenHelper
|
static inline TweenHelper
|
||||||
Animation(FramesPtr const& frames)
|
Animation(FramesPtr const& frames)
|
||||||
{
|
{
|
||||||
return TweenHelper(new easy2d::Animation(0, frames));
|
return TweenHelper(new kiwano::Animation(0, frames));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline ActionHelper
|
static inline ActionHelper
|
||||||
Group(Array<ActionPtr> const& actions, bool sequence = true)
|
Group(Array<ActionPtr> const& actions, bool sequence = true)
|
||||||
{
|
{
|
||||||
return ActionHelper(new easy2d::ActionGroup(actions, sequence));
|
return ActionHelper(new kiwano::ActionGroup(actions, sequence));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline ActionHelper
|
static inline ActionHelper
|
||||||
Multiple(Array<ActionPtr> const& actions)
|
Multiple(Array<ActionPtr> const& actions)
|
||||||
{
|
{
|
||||||
return ActionHelper(new easy2d::ActionGroup(actions, false));
|
return ActionHelper(new kiwano::ActionGroup(actions, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
E2D_DEPRECATED("Tween::Sequence is deprecated, use Tween::Group instead")
|
KGE_DEPRECATED("Tween::Sequence is deprecated, use Tween::Group instead")
|
||||||
static inline ActionHelper
|
static inline ActionHelper
|
||||||
Sequence(Array<ActionPtr> const& actions)
|
Sequence(Array<ActionPtr> const& actions)
|
||||||
{
|
{
|
||||||
return ActionHelper(new easy2d::ActionGroup(actions, true));
|
return ActionHelper(new kiwano::ActionGroup(actions, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
E2D_DEPRECATED("Tween::Spawn is deprecated, use Tween::Multiple instead")
|
KGE_DEPRECATED("Tween::Spawn is deprecated, use Tween::Multiple instead")
|
||||||
static inline ActionHelper
|
static inline ActionHelper
|
||||||
Spawn(Array<ActionPtr> const& actions)
|
Spawn(Array<ActionPtr> const& actions)
|
||||||
{
|
{
|
||||||
return ActionHelper(new easy2d::ActionGroup(actions, false));
|
return ActionHelper(new kiwano::ActionGroup(actions, false));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "ActionManager.h"
|
#include "ActionManager.h"
|
||||||
#include "../base/logs.h"
|
#include "../base/logs.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
void ActionManager::UpdateActions(NodePtr const& target, Duration dt)
|
void ActionManager::UpdateActions(NodePtr const& target, Duration dt)
|
||||||
{
|
{
|
||||||
|
|
@ -43,7 +43,7 @@ namespace easy2d
|
||||||
|
|
||||||
ActionPtr ActionManager::AddAction(ActionPtr const& action)
|
ActionPtr ActionManager::AddAction(ActionPtr const& action)
|
||||||
{
|
{
|
||||||
E2D_ASSERT(action && "AddAction failed, NULL pointer exception");
|
KGE_ASSERT(action && "AddAction failed, NULL pointer exception");
|
||||||
|
|
||||||
if (action)
|
if (action)
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,9 +21,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class E2D_API ActionManager
|
class KGE_API ActionManager
|
||||||
{
|
{
|
||||||
using Actions = IntrusiveList<ActionPtr>;
|
using Actions = IntrusiveList<ActionPtr>;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "include-forwards.h"
|
#include "include-forwards.h"
|
||||||
#include "Node.h"
|
#include "Node.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// Ease Functions
|
// Ease Functions
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include "Geometry.h" // ActionPath
|
#include "Geometry.h" // ActionPath
|
||||||
#include "../base/logs.h"
|
#include "../base/logs.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// 缓动函数
|
// 缓动函数
|
||||||
using EaseFunc = Closure<float(float)>;
|
using EaseFunc = Closure<float(float)>;
|
||||||
|
|
@ -32,37 +32,37 @@ namespace easy2d
|
||||||
// See https://easings.net for more information
|
// See https://easings.net for more information
|
||||||
struct Ease
|
struct Ease
|
||||||
{
|
{
|
||||||
static E2D_API EaseFunc Linear; // 线性
|
static KGE_API EaseFunc Linear; // 线性
|
||||||
static E2D_API EaseFunc EaseIn; // 由慢变快
|
static KGE_API EaseFunc EaseIn; // 由慢变快
|
||||||
static E2D_API EaseFunc EaseOut; // 由快变慢
|
static KGE_API EaseFunc EaseOut; // 由快变慢
|
||||||
static E2D_API EaseFunc EaseInOut; // 由慢变快, 再由快变慢
|
static KGE_API EaseFunc EaseInOut; // 由慢变快, 再由快变慢
|
||||||
static E2D_API EaseFunc ExpoIn; // 由慢变极快
|
static KGE_API EaseFunc ExpoIn; // 由慢变极快
|
||||||
static E2D_API EaseFunc ExpoOut; // 由极快变慢
|
static KGE_API EaseFunc ExpoOut; // 由极快变慢
|
||||||
static E2D_API EaseFunc ExpoInOut; // 由慢至极快, 再由极快边慢
|
static KGE_API EaseFunc ExpoInOut; // 由慢至极快, 再由极快边慢
|
||||||
static E2D_API EaseFunc ElasticIn; // 自起点赋予弹性
|
static KGE_API EaseFunc ElasticIn; // 自起点赋予弹性
|
||||||
static E2D_API EaseFunc ElasticOut; // 自终点赋予弹性
|
static KGE_API EaseFunc ElasticOut; // 自终点赋予弹性
|
||||||
static E2D_API EaseFunc ElasticInOut; // 再起点和终点赋予弹性
|
static KGE_API EaseFunc ElasticInOut; // 再起点和终点赋予弹性
|
||||||
static E2D_API EaseFunc BounceIn; // 自起点赋予反弹力
|
static KGE_API EaseFunc BounceIn; // 自起点赋予反弹力
|
||||||
static E2D_API EaseFunc BounceOut; // 自终点赋予反弹力
|
static KGE_API EaseFunc BounceOut; // 自终点赋予反弹力
|
||||||
static E2D_API EaseFunc BounceInOut; // 在起点和终点赋予反弹力
|
static KGE_API EaseFunc BounceInOut; // 在起点和终点赋予反弹力
|
||||||
static E2D_API EaseFunc BackIn;
|
static KGE_API EaseFunc BackIn;
|
||||||
static E2D_API EaseFunc BackOut;
|
static KGE_API EaseFunc BackOut;
|
||||||
static E2D_API EaseFunc BackInOut;
|
static KGE_API EaseFunc BackInOut;
|
||||||
static E2D_API EaseFunc QuadIn;
|
static KGE_API EaseFunc QuadIn;
|
||||||
static E2D_API EaseFunc QuadOut;
|
static KGE_API EaseFunc QuadOut;
|
||||||
static E2D_API EaseFunc QuadInOut;
|
static KGE_API EaseFunc QuadInOut;
|
||||||
static E2D_API EaseFunc CubicIn;
|
static KGE_API EaseFunc CubicIn;
|
||||||
static E2D_API EaseFunc CubicOut;
|
static KGE_API EaseFunc CubicOut;
|
||||||
static E2D_API EaseFunc CubicInOut;
|
static KGE_API EaseFunc CubicInOut;
|
||||||
static E2D_API EaseFunc QuartIn;
|
static KGE_API EaseFunc QuartIn;
|
||||||
static E2D_API EaseFunc QuartOut;
|
static KGE_API EaseFunc QuartOut;
|
||||||
static E2D_API EaseFunc QuartInOut;
|
static KGE_API EaseFunc QuartInOut;
|
||||||
static E2D_API EaseFunc QuintIn;
|
static KGE_API EaseFunc QuintIn;
|
||||||
static E2D_API EaseFunc QuintOut;
|
static KGE_API EaseFunc QuintOut;
|
||||||
static E2D_API EaseFunc QuintInOut;
|
static KGE_API EaseFunc QuintInOut;
|
||||||
static E2D_API EaseFunc SineIn;
|
static KGE_API EaseFunc SineIn;
|
||||||
static E2D_API EaseFunc SineOut;
|
static KGE_API EaseFunc SineOut;
|
||||||
static E2D_API EaseFunc SineInOut;
|
static KGE_API EaseFunc SineInOut;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline EaseFunc MakeEaseIn(float rate) { return std::bind(math::EaseIn, std::placeholders::_1, rate); }
|
inline EaseFunc MakeEaseIn(float rate) { return std::bind(math::EaseIn, std::placeholders::_1, rate); }
|
||||||
|
|
@ -74,7 +74,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 补间动画
|
// 补间动画
|
||||||
class E2D_API ActionTween
|
class KGE_API ActionTween
|
||||||
: public Action
|
: public Action
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -108,7 +108,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 相对位移动作
|
// 相对位移动作
|
||||||
class E2D_API ActionMoveBy
|
class KGE_API ActionMoveBy
|
||||||
: public ActionTween
|
: public ActionTween
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -137,7 +137,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 位移动作
|
// 位移动作
|
||||||
class E2D_API ActionMoveTo
|
class KGE_API ActionMoveTo
|
||||||
: public ActionMoveBy
|
: public ActionMoveBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -153,7 +153,7 @@ namespace easy2d
|
||||||
// 获取该动作的倒转
|
// 获取该动作的倒转
|
||||||
virtual ActionPtr Reverse() const override
|
virtual ActionPtr Reverse() const override
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Reverse() not supported in ActionMoveTo");
|
KGE_ERROR_LOG(L"Reverse() not supported in ActionMoveTo");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,7 +166,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 相对跳跃动作
|
// 相对跳跃动作
|
||||||
class E2D_API ActionJumpBy
|
class KGE_API ActionJumpBy
|
||||||
: public ActionTween
|
: public ActionTween
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -199,7 +199,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 跳跃动作
|
// 跳跃动作
|
||||||
class E2D_API ActionJumpTo
|
class KGE_API ActionJumpTo
|
||||||
: public ActionJumpBy
|
: public ActionJumpBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -217,7 +217,7 @@ namespace easy2d
|
||||||
// 获取该动作的倒转
|
// 获取该动作的倒转
|
||||||
virtual ActionPtr Reverse() const override
|
virtual ActionPtr Reverse() const override
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Reverse() not supported in ActionJumpTo");
|
KGE_ERROR_LOG(L"Reverse() not supported in ActionJumpTo");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -230,7 +230,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 相对缩放动作
|
// 相对缩放动作
|
||||||
class E2D_API ActionScaleBy
|
class KGE_API ActionScaleBy
|
||||||
: public ActionTween
|
: public ActionTween
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -267,7 +267,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 缩放动作
|
// 缩放动作
|
||||||
class E2D_API ActionScaleTo
|
class KGE_API ActionScaleTo
|
||||||
: public ActionScaleBy
|
: public ActionScaleBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -290,7 +290,7 @@ namespace easy2d
|
||||||
// 获取该动作的倒转
|
// 获取该动作的倒转
|
||||||
virtual ActionPtr Reverse() const override
|
virtual ActionPtr Reverse() const override
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Reverse() not supported in ActionScaleTo");
|
KGE_ERROR_LOG(L"Reverse() not supported in ActionScaleTo");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -304,7 +304,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 透明度相对渐变动作
|
// 透明度相对渐变动作
|
||||||
class E2D_API ActionOpacityBy
|
class KGE_API ActionOpacityBy
|
||||||
: public ActionTween
|
: public ActionTween
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -332,7 +332,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 透明度渐变动作
|
// 透明度渐变动作
|
||||||
class E2D_API ActionOpacityTo
|
class KGE_API ActionOpacityTo
|
||||||
: public ActionOpacityBy
|
: public ActionOpacityBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -348,7 +348,7 @@ namespace easy2d
|
||||||
// 获取该动作的倒转
|
// 获取该动作的倒转
|
||||||
virtual ActionPtr Reverse() const override
|
virtual ActionPtr Reverse() const override
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Reverse() not supported in ActionOpacityTo");
|
KGE_ERROR_LOG(L"Reverse() not supported in ActionOpacityTo");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -361,7 +361,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 淡入动作
|
// 淡入动作
|
||||||
class E2D_API ActionFadeIn
|
class KGE_API ActionFadeIn
|
||||||
: public ActionOpacityTo
|
: public ActionOpacityTo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -374,7 +374,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 淡出动作
|
// 淡出动作
|
||||||
class E2D_API ActionFadeOut
|
class KGE_API ActionFadeOut
|
||||||
: public ActionOpacityTo
|
: public ActionOpacityTo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -387,7 +387,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 相对旋转动作
|
// 相对旋转动作
|
||||||
class E2D_API ActionRotateBy
|
class KGE_API ActionRotateBy
|
||||||
: public ActionTween
|
: public ActionTween
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -415,7 +415,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 旋转动作
|
// 旋转动作
|
||||||
class E2D_API ActionRotateTo
|
class KGE_API ActionRotateTo
|
||||||
: public ActionRotateBy
|
: public ActionRotateBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -431,7 +431,7 @@ namespace easy2d
|
||||||
// 获取该动作的倒转
|
// 获取该动作的倒转
|
||||||
virtual ActionPtr Reverse() const override
|
virtual ActionPtr Reverse() const override
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Reverse() not supported in ActionRotateTo");
|
KGE_ERROR_LOG(L"Reverse() not supported in ActionRotateTo");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -444,7 +444,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 路径动作
|
// 路径动作
|
||||||
class E2D_API ActionPath
|
class KGE_API ActionPath
|
||||||
: public ActionTween
|
: public ActionTween
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include "Image.h"
|
#include "Image.h"
|
||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Animation::Animation()
|
Animation::Animation()
|
||||||
: frames_(nullptr)
|
: frames_(nullptr)
|
||||||
|
|
@ -70,7 +70,7 @@ namespace easy2d
|
||||||
{
|
{
|
||||||
auto sprite_target = dynamic_cast<Sprite*>(target.Get());
|
auto sprite_target = dynamic_cast<Sprite*>(target.Get());
|
||||||
|
|
||||||
E2D_ASSERT(sprite_target && "Animation only supports Sprites");
|
KGE_ASSERT(sprite_target && "Animation only supports Sprites");
|
||||||
|
|
||||||
const auto& frames = frames_->GetFrames();
|
const auto& frames = frames_->GetFrames();
|
||||||
int size = frames.size();
|
int size = frames.size();
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,10 +21,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "ActionTween.h"
|
#include "ActionTween.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// 帧动画
|
// 帧动画
|
||||||
class E2D_API Animation
|
class KGE_API Animation
|
||||||
: public ActionTween
|
: public ActionTween
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include "../base/logs.h"
|
#include "../base/logs.h"
|
||||||
#include "../renderer/render.h"
|
#include "../renderer/render.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Canvas::Canvas()
|
Canvas::Canvas()
|
||||||
: cache_expired_(false)
|
: cache_expired_(false)
|
||||||
|
|
@ -489,7 +489,7 @@ namespace easy2d
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
ComPtr<ID2D1Bitmap> const& easy2d::Canvas::GetBitmap() const
|
ComPtr<ID2D1Bitmap> const& kiwano::Canvas::GetBitmap() const
|
||||||
{
|
{
|
||||||
if (cache_expired_)
|
if (cache_expired_)
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -26,10 +26,10 @@
|
||||||
|
|
||||||
#undef DrawText
|
#undef DrawText
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// »²¼
|
// »²¼
|
||||||
class E2D_API Canvas
|
class KGE_API Canvas
|
||||||
: public VisualNode
|
: public VisualNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "Color.h"
|
#include "Color.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../macros.h"
|
#include "../macros.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// 颜色
|
// 颜色
|
||||||
//
|
//
|
||||||
|
|
@ -30,7 +30,7 @@ namespace easy2d
|
||||||
// 使用 RGBA 表示一个带透明度的颜色: Color not_black(1.0f, 1.0f, 1.0f, 0.5f);
|
// 使用 RGBA 表示一个带透明度的颜色: Color not_black(1.0f, 1.0f, 1.0f, 0.5f);
|
||||||
// 使用一个 unsigned int 类型的值表示 RGB: Color black(0x000000);
|
// 使用一个 unsigned int 类型的值表示 RGB: Color black(0x000000);
|
||||||
//
|
//
|
||||||
class E2D_API Color
|
class KGE_API Color
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Color();
|
Color();
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#pragma comment(lib, "psapi.lib")
|
#pragma comment(lib, "psapi.lib")
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
DebugNode::DebugNode()
|
DebugNode::DebugNode()
|
||||||
{
|
{
|
||||||
|
|
@ -61,7 +61,7 @@ namespace easy2d
|
||||||
|
|
||||||
void DebugNode::OnUpdate(Duration dt)
|
void DebugNode::OnUpdate(Duration dt)
|
||||||
{
|
{
|
||||||
E2D_NOT_USED(dt);
|
KGE_NOT_USED(dt);
|
||||||
|
|
||||||
frame_time_.push_back(Time::Now());
|
frame_time_.push_back(Time::Now());
|
||||||
while (frame_time_.back() - frame_time_.front() >= time::Sec)
|
while (frame_time_.back() - frame_time_.front() >= time::Sec)
|
||||||
|
|
@ -72,7 +72,7 @@ namespace easy2d
|
||||||
std::wstringstream ss;
|
std::wstringstream ss;
|
||||||
ss << "Fps: " << frame_time_.size() << std::endl;
|
ss << "Fps: " << frame_time_.size() << std::endl;
|
||||||
|
|
||||||
#ifdef E2D_DEBUG
|
#ifdef KGE_DEBUG
|
||||||
ss << "Objects: " << Object::__GetTracingObjects().size() << std::endl;
|
ss << "Objects: " << Object::__GetTracingObjects().size() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,9 +21,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Node.h"
|
#include "Node.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class E2D_API DebugNode
|
class KGE_API DebugNode
|
||||||
: public Node
|
: public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// ×ÖÌå´Öϸֵ
|
// ×ÖÌå´Öϸֵ
|
||||||
enum FontWeight : unsigned int
|
enum FontWeight : unsigned int
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "Image.h"
|
#include "Image.h"
|
||||||
#include "../base/logs.h"
|
#include "../base/logs.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Frames::Frames()
|
Frames::Frames()
|
||||||
{
|
{
|
||||||
|
|
@ -39,7 +39,7 @@ namespace easy2d
|
||||||
|
|
||||||
void Frames::Add(ImagePtr const& frame)
|
void Frames::Add(ImagePtr const& frame)
|
||||||
{
|
{
|
||||||
E2D_ASSERT(frame && "Frames::Add failed, NULL pointer exception");
|
KGE_ASSERT(frame && "Frames::Add failed, NULL pointer exception");
|
||||||
|
|
||||||
if (frame)
|
if (frame)
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,10 +21,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "include-forwards.h"
|
#include "include-forwards.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// ÐòÁÐÖ¡
|
// ÐòÁÐÖ¡
|
||||||
class E2D_API Frames
|
class KGE_API Frames
|
||||||
: public virtual Object
|
: public virtual Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "../renderer/render.h"
|
#include "../renderer/render.h"
|
||||||
#include "../base/logs.h"
|
#include "../base/logs.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// Geometry
|
// Geometry
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,10 +22,10 @@
|
||||||
#include "include-forwards.h"
|
#include "include-forwards.h"
|
||||||
#include <d2d1.h>
|
#include <d2d1.h>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// 섯부녜蹶
|
// 섯부녜蹶
|
||||||
class E2D_API Geometry
|
class KGE_API Geometry
|
||||||
: public virtual Object
|
: public virtual Object
|
||||||
{
|
{
|
||||||
friend class Canvas;
|
friend class Canvas;
|
||||||
|
|
@ -63,7 +63,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 殮窟
|
// 殮窟
|
||||||
class E2D_API LineGeometry
|
class KGE_API LineGeometry
|
||||||
: public Geometry
|
: public Geometry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -100,7 +100,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 섯부앤近
|
// 섯부앤近
|
||||||
class E2D_API RectangleGeometry
|
class KGE_API RectangleGeometry
|
||||||
: public Geometry
|
: public Geometry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -127,7 +127,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 섯부途近
|
// 섯부途近
|
||||||
class E2D_API CircleGeometry
|
class KGE_API CircleGeometry
|
||||||
: public Geometry
|
: public Geometry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -164,7 +164,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 섯부哭途
|
// 섯부哭途
|
||||||
class E2D_API EllipseGeometry
|
class KGE_API EllipseGeometry
|
||||||
: public Geometry
|
: public Geometry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -207,7 +207,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 섯부쨌쓺
|
// 섯부쨌쓺
|
||||||
class E2D_API PathGeometry
|
class KGE_API PathGeometry
|
||||||
: public Geometry
|
: public Geometry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -261,7 +261,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 섯부途실앤近
|
// 섯부途실앤近
|
||||||
class E2D_API RoundedRectGeometry
|
class KGE_API RoundedRectGeometry
|
||||||
: public Geometry
|
: public Geometry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "GeometryNode.h"
|
#include "GeometryNode.h"
|
||||||
#include "../renderer/render.h"
|
#include "../renderer/render.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
GeometryNode::GeometryNode()
|
GeometryNode::GeometryNode()
|
||||||
: fill_color_(Color::White)
|
: fill_color_(Color::White)
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,10 +22,10 @@
|
||||||
#include "Geometry.h"
|
#include "Geometry.h"
|
||||||
#include "Node.h"
|
#include "Node.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// 섯부暠近
|
// 섯부暠近
|
||||||
class E2D_API GeometryNode
|
class KGE_API GeometryNode
|
||||||
: public VisualNode
|
: public VisualNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include "../renderer/render.h"
|
#include "../renderer/render.h"
|
||||||
#include "../platform/modules.h"
|
#include "../platform/modules.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Image::Image()
|
Image::Image()
|
||||||
: bitmap_(nullptr)
|
: bitmap_(nullptr)
|
||||||
|
|
@ -63,7 +63,7 @@ namespace easy2d
|
||||||
{
|
{
|
||||||
if (!modules::Shlwapi::Get().PathFileExistsW(res.GetFileName().c_str()))
|
if (!modules::Shlwapi::Get().PathFileExistsW(res.GetFileName().c_str()))
|
||||||
{
|
{
|
||||||
E2D_WARNING_LOG(L"Image file '%s' not found!", res.GetFileName().c_str());
|
KGE_WARNING_LOG(L"Image file '%s' not found!", res.GetFileName().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
hr = Renderer::Instance().GetDeviceResources()->CreateBitmapFromFile(bitmap, res.GetFileName());
|
hr = Renderer::Instance().GetDeviceResources()->CreateBitmapFromFile(bitmap, res.GetFileName());
|
||||||
|
|
@ -75,7 +75,7 @@ namespace easy2d
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Load image file failed with HRESULT of %08X", hr);
|
KGE_ERROR_LOG(L"Load image file failed with HRESULT of %08X", hr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,10 +23,10 @@
|
||||||
#include "../base/Resource.h"
|
#include "../base/Resource.h"
|
||||||
#include <d2d1.h>
|
#include <d2d1.h>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// ͼƬ
|
// ͼƬ
|
||||||
class E2D_API Image
|
class KGE_API Image
|
||||||
: public virtual Object
|
: public virtual Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
#include "../renderer/render.h"
|
#include "../renderer/render.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Layer::Layer()
|
Layer::Layer()
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,9 +21,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Node.h"
|
#include "Node.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class E2D_API Layer
|
class KGE_API Layer
|
||||||
: public Node
|
: public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include "../base/logs.h"
|
#include "../base/logs.h"
|
||||||
#include "../renderer/render.h"
|
#include "../renderer/render.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
@ -453,20 +453,20 @@ namespace easy2d
|
||||||
|
|
||||||
void Node::AddChild(NodePtr const& child)
|
void Node::AddChild(NodePtr const& child)
|
||||||
{
|
{
|
||||||
E2D_ASSERT(child && "Node::AddChild failed, NULL pointer exception");
|
KGE_ASSERT(child && "Node::AddChild failed, NULL pointer exception");
|
||||||
|
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
#ifdef E2D_DEBUG
|
#ifdef KGE_DEBUG
|
||||||
|
|
||||||
if (child->parent_)
|
if (child->parent_)
|
||||||
E2D_ERROR_LOG(L"The node to be added already has a parent");
|
KGE_ERROR_LOG(L"The node to be added already has a parent");
|
||||||
|
|
||||||
for (Node* parent = parent_; parent; parent = parent->parent_)
|
for (Node* parent = parent_; parent; parent = parent->parent_)
|
||||||
if (parent == child)
|
if (parent == child)
|
||||||
E2D_ERROR_LOG(L"A node cannot be its own parent");
|
KGE_ERROR_LOG(L"A node cannot be its own parent");
|
||||||
|
|
||||||
#endif // E2D_DEBUG
|
#endif // KGE_DEBUG
|
||||||
|
|
||||||
children_.PushBack(child);
|
children_.PushBack(child);
|
||||||
child->parent_ = this;
|
child->parent_ = this;
|
||||||
|
|
@ -544,7 +544,7 @@ namespace easy2d
|
||||||
|
|
||||||
void Node::RemoveChild(Node * child)
|
void Node::RemoveChild(Node * child)
|
||||||
{
|
{
|
||||||
E2D_ASSERT(child && "Node::RemoveChild failed, NULL pointer exception");
|
KGE_ASSERT(child && "Node::RemoveChild failed, NULL pointer exception");
|
||||||
|
|
||||||
if (children_.IsEmpty())
|
if (children_.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -25,12 +25,12 @@
|
||||||
#include "../base/TimerManager.h"
|
#include "../base/TimerManager.h"
|
||||||
#include "../base/EventDispatcher.h"
|
#include "../base/EventDispatcher.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class Application;
|
class Application;
|
||||||
|
|
||||||
// 节点
|
// 节点
|
||||||
class E2D_API Node
|
class KGE_API Node
|
||||||
: public virtual Object
|
: public virtual Object
|
||||||
, public TimerManager
|
, public TimerManager
|
||||||
, public ActionManager
|
, public ActionManager
|
||||||
|
|
@ -48,7 +48,7 @@ namespace easy2d
|
||||||
Node();
|
Node();
|
||||||
|
|
||||||
// 更新节点
|
// 更新节点
|
||||||
virtual void OnUpdate(Duration dt) { E2D_NOT_USED(dt); }
|
virtual void OnUpdate(Duration dt) { KGE_NOT_USED(dt); }
|
||||||
|
|
||||||
// 渲染节点
|
// 渲染节点
|
||||||
virtual void OnRender() {}
|
virtual void OnRender() {}
|
||||||
|
|
@ -431,7 +431,7 @@ namespace easy2d
|
||||||
|
|
||||||
|
|
||||||
// 可视化节点
|
// 可视化节点
|
||||||
class E2D_API VisualNode
|
class KGE_API VisualNode
|
||||||
: public Node
|
: public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "../base/logs.h"
|
#include "../base/logs.h"
|
||||||
#include "../renderer/render.h"
|
#include "../renderer/render.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Scene::Scene()
|
Scene::Scene()
|
||||||
: mouse_cursor_(MouseCursor::Arrow)
|
: mouse_cursor_(MouseCursor::Arrow)
|
||||||
|
|
@ -39,12 +39,12 @@ namespace easy2d
|
||||||
|
|
||||||
void Scene::OnEnter()
|
void Scene::OnEnter()
|
||||||
{
|
{
|
||||||
E2D_LOG(L"Scene entered");
|
KGE_LOG(L"Scene entered");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::OnExit()
|
void Scene::OnExit()
|
||||||
{
|
{
|
||||||
E2D_LOG(L"Scene exited");
|
KGE_LOG(L"Scene exited");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::Update(Duration dt)
|
void Scene::Update(Duration dt)
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,10 +21,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Node.h"
|
#include "Node.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// ³¡¾°
|
// ³¡¾°
|
||||||
class E2D_API Scene
|
class KGE_API Scene
|
||||||
: public Node
|
: public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
#include "../renderer/render.h"
|
#include "../renderer/render.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Sprite::Sprite()
|
Sprite::Sprite()
|
||||||
: image_(nullptr)
|
: image_(nullptr)
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,10 +22,10 @@
|
||||||
#include "Node.h"
|
#include "Node.h"
|
||||||
#include "Image.h"
|
#include "Image.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// ¾«Áé
|
// ¾«Áé
|
||||||
class E2D_API Sprite
|
class KGE_API Sprite
|
||||||
: public VisualNode
|
: public VisualNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "../base/logs.h"
|
#include "../base/logs.h"
|
||||||
#include "../renderer/render.h"
|
#include "../renderer/render.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
@ -30,12 +30,12 @@ namespace easy2d
|
||||||
TextStyle text_default_style;
|
TextStyle text_default_style;
|
||||||
}
|
}
|
||||||
|
|
||||||
void easy2d::Text::SetDefaultFont(Font const & font)
|
void kiwano::Text::SetDefaultFont(Font const & font)
|
||||||
{
|
{
|
||||||
text_default_font = font;
|
text_default_font = font;
|
||||||
}
|
}
|
||||||
|
|
||||||
void easy2d::Text::SetDefaultStyle(TextStyle const & style)
|
void kiwano::Text::SetDefaultStyle(TextStyle const & style)
|
||||||
{
|
{
|
||||||
text_default_style = style;
|
text_default_style = style;
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -24,10 +24,10 @@
|
||||||
#include "TextStyle.hpp"
|
#include "TextStyle.hpp"
|
||||||
#include <dwrite.h>
|
#include <dwrite.h>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// Îı¾
|
// Îı¾
|
||||||
class E2D_API Text
|
class KGE_API Text
|
||||||
: public VisualNode
|
: public VisualNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "include-forwards.h"
|
#include "include-forwards.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// 文本对齐方式
|
// 文本对齐方式
|
||||||
enum class TextAlign
|
enum class TextAlign
|
||||||
|
|
@ -32,7 +32,7 @@ namespace easy2d
|
||||||
};
|
};
|
||||||
|
|
||||||
// 文本样式
|
// 文本样式
|
||||||
class E2D_API TextStyle
|
class KGE_API TextStyle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Color color; // 颜色
|
Color color; // 颜色
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../math/Matrix.hpp"
|
#include "../math/Matrix.hpp"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class Transform
|
class Transform
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include "../base/logs.h"
|
#include "../base/logs.h"
|
||||||
#include "../renderer/render.h"
|
#include "../renderer/render.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// Transition
|
// Transition
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,12 +22,12 @@
|
||||||
#include "include-forwards.h"
|
#include "include-forwards.h"
|
||||||
#include <d2d1.h>
|
#include <d2d1.h>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class Scene;
|
class Scene;
|
||||||
|
|
||||||
// 场景过渡
|
// 场景过渡
|
||||||
class E2D_API Transition
|
class KGE_API Transition
|
||||||
: public virtual Object
|
: public virtual Object
|
||||||
{
|
{
|
||||||
friend class Application;
|
friend class Application;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -31,58 +31,58 @@
|
||||||
#include "../base/Object.h"
|
#include "../base/Object.h"
|
||||||
#include "../math/helper.h"
|
#include "../math/helper.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
E2D_DECLARE_SMART_PTR(Image);
|
KGE_DECLARE_SMART_PTR(Image);
|
||||||
E2D_DECLARE_SMART_PTR(Frames);
|
KGE_DECLARE_SMART_PTR(Frames);
|
||||||
|
|
||||||
E2D_DECLARE_SMART_PTR(Geometry);
|
KGE_DECLARE_SMART_PTR(Geometry);
|
||||||
E2D_DECLARE_SMART_PTR(LineGeometry);
|
KGE_DECLARE_SMART_PTR(LineGeometry);
|
||||||
E2D_DECLARE_SMART_PTR(RectangleGeometry);
|
KGE_DECLARE_SMART_PTR(RectangleGeometry);
|
||||||
E2D_DECLARE_SMART_PTR(RoundedRectGeometry);
|
KGE_DECLARE_SMART_PTR(RoundedRectGeometry);
|
||||||
E2D_DECLARE_SMART_PTR(CircleGeometry);
|
KGE_DECLARE_SMART_PTR(CircleGeometry);
|
||||||
E2D_DECLARE_SMART_PTR(EllipseGeometry);
|
KGE_DECLARE_SMART_PTR(EllipseGeometry);
|
||||||
E2D_DECLARE_SMART_PTR(PathGeometry);
|
KGE_DECLARE_SMART_PTR(PathGeometry);
|
||||||
|
|
||||||
E2D_DECLARE_SMART_PTR(Node);
|
KGE_DECLARE_SMART_PTR(Node);
|
||||||
E2D_DECLARE_SMART_PTR(Scene);
|
KGE_DECLARE_SMART_PTR(Scene);
|
||||||
E2D_DECLARE_SMART_PTR(Layer);
|
KGE_DECLARE_SMART_PTR(Layer);
|
||||||
E2D_DECLARE_SMART_PTR(Sprite);
|
KGE_DECLARE_SMART_PTR(Sprite);
|
||||||
E2D_DECLARE_SMART_PTR(Text);
|
KGE_DECLARE_SMART_PTR(Text);
|
||||||
E2D_DECLARE_SMART_PTR(Canvas);
|
KGE_DECLARE_SMART_PTR(Canvas);
|
||||||
E2D_DECLARE_SMART_PTR(GeometryNode);
|
KGE_DECLARE_SMART_PTR(GeometryNode);
|
||||||
|
|
||||||
E2D_DECLARE_SMART_PTR(Action);
|
KGE_DECLARE_SMART_PTR(Action);
|
||||||
E2D_DECLARE_SMART_PTR(ActionTween);
|
KGE_DECLARE_SMART_PTR(ActionTween);
|
||||||
E2D_DECLARE_SMART_PTR(ActionMoveBy);
|
KGE_DECLARE_SMART_PTR(ActionMoveBy);
|
||||||
E2D_DECLARE_SMART_PTR(ActionMoveTo);
|
KGE_DECLARE_SMART_PTR(ActionMoveTo);
|
||||||
E2D_DECLARE_SMART_PTR(ActionJumpBy);
|
KGE_DECLARE_SMART_PTR(ActionJumpBy);
|
||||||
E2D_DECLARE_SMART_PTR(ActionJumpTo);
|
KGE_DECLARE_SMART_PTR(ActionJumpTo);
|
||||||
E2D_DECLARE_SMART_PTR(ActionScaleBy);
|
KGE_DECLARE_SMART_PTR(ActionScaleBy);
|
||||||
E2D_DECLARE_SMART_PTR(ActionScaleTo);
|
KGE_DECLARE_SMART_PTR(ActionScaleTo);
|
||||||
E2D_DECLARE_SMART_PTR(ActionOpacityBy);
|
KGE_DECLARE_SMART_PTR(ActionOpacityBy);
|
||||||
E2D_DECLARE_SMART_PTR(ActionOpacityTo);
|
KGE_DECLARE_SMART_PTR(ActionOpacityTo);
|
||||||
E2D_DECLARE_SMART_PTR(ActionFadeIn);
|
KGE_DECLARE_SMART_PTR(ActionFadeIn);
|
||||||
E2D_DECLARE_SMART_PTR(ActionFadeOut);
|
KGE_DECLARE_SMART_PTR(ActionFadeOut);
|
||||||
E2D_DECLARE_SMART_PTR(ActionRotateBy);
|
KGE_DECLARE_SMART_PTR(ActionRotateBy);
|
||||||
E2D_DECLARE_SMART_PTR(ActionRotateTo);
|
KGE_DECLARE_SMART_PTR(ActionRotateTo);
|
||||||
E2D_DECLARE_SMART_PTR(ActionPath);
|
KGE_DECLARE_SMART_PTR(ActionPath);
|
||||||
E2D_DECLARE_SMART_PTR(Animation);
|
KGE_DECLARE_SMART_PTR(Animation);
|
||||||
E2D_DECLARE_SMART_PTR(ActionGroup);
|
KGE_DECLARE_SMART_PTR(ActionGroup);
|
||||||
E2D_DECLARE_SMART_PTR(ActionSpawn);
|
KGE_DECLARE_SMART_PTR(ActionSpawn);
|
||||||
|
|
||||||
E2D_DECLARE_SMART_PTR(Transition);
|
KGE_DECLARE_SMART_PTR(Transition);
|
||||||
E2D_DECLARE_SMART_PTR(FadeTransition);
|
KGE_DECLARE_SMART_PTR(FadeTransition);
|
||||||
E2D_DECLARE_SMART_PTR(EmergeTransition);
|
KGE_DECLARE_SMART_PTR(EmergeTransition);
|
||||||
E2D_DECLARE_SMART_PTR(BoxTransition);
|
KGE_DECLARE_SMART_PTR(BoxTransition);
|
||||||
E2D_DECLARE_SMART_PTR(MoveTransition);
|
KGE_DECLARE_SMART_PTR(MoveTransition);
|
||||||
E2D_DECLARE_SMART_PTR(RotationTransition);
|
KGE_DECLARE_SMART_PTR(RotationTransition);
|
||||||
|
|
||||||
E2D_DECLARE_SMART_PTR(Button);
|
KGE_DECLARE_SMART_PTR(Button);
|
||||||
E2D_DECLARE_SMART_PTR(Menu);
|
KGE_DECLARE_SMART_PTR(Menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// »±ÊÑùʽ
|
// »±ÊÑùʽ
|
||||||
enum class StrokeStyle : int
|
enum class StrokeStyle : int
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="easy2d.h" />
|
<ClInclude Include="kiwano.h" />
|
||||||
<ClInclude Include="config.h" />
|
<ClInclude Include="config.h" />
|
||||||
<ClInclude Include="macros.h" />
|
<ClInclude Include="macros.h" />
|
||||||
<ClInclude Include="easy2d-audio.h" />
|
<ClInclude Include="kiwano-audio.h" />
|
||||||
<ClInclude Include="easy2d-imgui.h" />
|
<ClInclude Include="kiwano-imgui.h" />
|
||||||
<ClInclude Include="easy2d-network.h" />
|
<ClInclude Include="kiwano-network.h" />
|
||||||
<ClInclude Include="audio\audio-modules.h" />
|
<ClInclude Include="audio\audio-modules.h" />
|
||||||
<ClInclude Include="audio\audio.h" />
|
<ClInclude Include="audio\audio.h" />
|
||||||
<ClInclude Include="audio\Music.h" />
|
<ClInclude Include="audio\Music.h" />
|
||||||
|
|
@ -177,7 +177,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}</ProjectGuid>
|
<ProjectGuid>{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}</ProjectGuid>
|
||||||
<RootNamespace>Easy2D</RootNamespace>
|
<RootNamespace>Kiwano</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
|
@ -245,7 +245,7 @@
|
||||||
<ClInclude Include="base\Object.h">
|
<ClInclude Include="base\Object.h">
|
||||||
<Filter>base</Filter>
|
<Filter>base</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="easy2d.h" />
|
<ClInclude Include="kiwano.h" />
|
||||||
<ClInclude Include="utils\DataUtil.h">
|
<ClInclude Include="utils\DataUtil.h">
|
||||||
<Filter>utils</Filter>
|
<Filter>utils</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
@ -300,9 +300,9 @@
|
||||||
<ClInclude Include="imgui\ImGuiView.h">
|
<ClInclude Include="imgui\ImGuiView.h">
|
||||||
<Filter>imgui</Filter>
|
<Filter>imgui</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="easy2d-audio.h" />
|
<ClInclude Include="kiwano-audio.h" />
|
||||||
<ClInclude Include="easy2d-imgui.h" />
|
<ClInclude Include="kiwano-imgui.h" />
|
||||||
<ClInclude Include="easy2d-network.h" />
|
<ClInclude Include="kiwano-network.h" />
|
||||||
<ClInclude Include="third-party\ImGui\imconfig.h">
|
<ClInclude Include="third-party\ImGui\imconfig.h">
|
||||||
<Filter>third-party\ImGui</Filter>
|
<Filter>third-party\ImGui</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -18,11 +18,11 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include "../easy2d-audio.h"
|
#include "../kiwano-audio.h"
|
||||||
#include "Music.h"
|
#include "Music.h"
|
||||||
#include "Transcoder.h"
|
#include "Transcoder.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Music::Music()
|
Music::Music()
|
||||||
: opened_(false)
|
: opened_(false)
|
||||||
|
|
@ -58,7 +58,7 @@ namespace easy2d
|
||||||
{
|
{
|
||||||
if (!modules::Shlwapi::Get().PathFileExistsW(res.GetFileName().c_str()))
|
if (!modules::Shlwapi::Get().PathFileExistsW(res.GetFileName().c_str()))
|
||||||
{
|
{
|
||||||
E2D_WARNING_LOG(L"Media file '%s' not found", res.GetFileName().c_str());
|
KGE_WARNING_LOG(L"Media file '%s' not found", res.GetFileName().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
hr = transcoder.LoadMediaFile(res.GetFileName(), &wave_data_, &size_);
|
hr = transcoder.LoadMediaFile(res.GetFileName(), &wave_data_, &size_);
|
||||||
|
|
@ -70,7 +70,7 @@ namespace easy2d
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Load media file failed with HRESULT of %08X", hr);
|
KGE_ERROR_LOG(L"Load media file failed with HRESULT of %08X", hr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@ namespace easy2d
|
||||||
delete[] wave_data_;
|
delete[] wave_data_;
|
||||||
wave_data_ = nullptr;
|
wave_data_ = nullptr;
|
||||||
}
|
}
|
||||||
E2D_ERROR_LOG(L"Create source voice failed with HRESULT of %08X", hr);
|
KGE_ERROR_LOG(L"Create source voice failed with HRESULT of %08X", hr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ namespace easy2d
|
||||||
{
|
{
|
||||||
if (!opened_)
|
if (!opened_)
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Music must be opened first!");
|
KGE_ERROR_LOG(L"Music must be opened first!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ namespace easy2d
|
||||||
HRESULT hr = voice_.Play(wave_data_, size_, static_cast<UINT32>(loop_count));
|
HRESULT hr = voice_.Play(wave_data_, size_, static_cast<UINT32>(loop_count));
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Submitting source buffer failed with HRESULT of %08X", hr);
|
KGE_ERROR_LOG(L"Submitting source buffer failed with HRESULT of %08X", hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
playing_ = SUCCEEDED(hr);
|
playing_ = SUCCEEDED(hr);
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,12 +21,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Voice.h"
|
#include "Voice.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
E2D_DECLARE_SMART_PTR(Music);
|
KGE_DECLARE_SMART_PTR(Music);
|
||||||
|
|
||||||
// 音乐对象
|
// 音乐对象
|
||||||
class E2D_API Music
|
class KGE_API Music
|
||||||
: public virtual Object
|
: public virtual Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -18,10 +18,10 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include "../easy2d-audio.h"
|
#include "../kiwano-audio.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Player::Player()
|
Player::Player()
|
||||||
: volume_(1.f)
|
: volume_(1.f)
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -20,12 +20,12 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
E2D_DECLARE_SMART_PTR(Player);
|
KGE_DECLARE_SMART_PTR(Player);
|
||||||
|
|
||||||
// 音乐播放器
|
// 音乐播放器
|
||||||
class E2D_API Player
|
class KGE_API Player
|
||||||
: protected Object
|
: protected Object
|
||||||
{
|
{
|
||||||
using MusicMap = Map<size_t, MusicPtr>;
|
using MusicMap = Map<size_t, MusicPtr>;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,11 +22,11 @@
|
||||||
# define INITGUID // MFAudioFormat_PCM, MF_MT_MAJOR_TYPE, MF_MT_SUBTYPE, MFMediaType_Audio
|
# define INITGUID // MFAudioFormat_PCM, MF_MT_MAJOR_TYPE, MF_MT_SUBTYPE, MFMediaType_Audio
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../easy2d-audio.h"
|
#include "../kiwano-audio.h"
|
||||||
#include "Transcoder.h"
|
#include "Transcoder.h"
|
||||||
#include "audio-modules.h"
|
#include "audio-modules.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Transcoder::Transcoder()
|
Transcoder::Transcoder()
|
||||||
: wave_format_(nullptr)
|
: wave_format_(nullptr)
|
||||||
|
|
@ -86,7 +86,7 @@ namespace easy2d
|
||||||
|
|
||||||
if (stream == nullptr)
|
if (stream == nullptr)
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"SHCreateMemStream failed");
|
KGE_ERROR_LOG(L"SHCreateMemStream failed");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -203,7 +203,7 @@ namespace easy2d
|
||||||
|
|
||||||
if (data == nullptr)
|
if (data == nullptr)
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Low memory");
|
KGE_ERROR_LOG(L"Low memory");
|
||||||
hr = E_OUTOFMEMORY;
|
hr = E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,9 +23,9 @@
|
||||||
#include <mfidl.h>
|
#include <mfidl.h>
|
||||||
#include <mfreadwrite.h>
|
#include <mfreadwrite.h>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class E2D_API Transcoder
|
class KGE_API Transcoder
|
||||||
{
|
{
|
||||||
WAVEFORMATEX* wave_format_;
|
WAVEFORMATEX* wave_format_;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -18,10 +18,10 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include "../easy2d-audio.h"
|
#include "../kiwano-audio.h"
|
||||||
#include "Voice.h"
|
#include "Voice.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Voice::Voice()
|
Voice::Voice()
|
||||||
: source_voice_(nullptr)
|
: source_voice_(nullptr)
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,9 +21,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <xaudio2.h>
|
#include <xaudio2.h>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class E2D_API Voice
|
class KGE_API Voice
|
||||||
: protected Noncopyable
|
: protected Noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -18,10 +18,10 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include "../easy2d-audio.h"
|
#include "../kiwano-audio.h"
|
||||||
#include "audio-modules.h"
|
#include "audio-modules.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace modules
|
namespace modules
|
||||||
{
|
{
|
||||||
|
|
@ -47,7 +47,7 @@ namespace easy2d
|
||||||
|
|
||||||
if (!xaudio2)
|
if (!xaudio2)
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Load xaudio2.dll failed");
|
KGE_ERROR_LOG(L"Load xaudio2.dll failed");
|
||||||
throw std::runtime_error("Load xaudio2.dll failed");
|
throw std::runtime_error("Load xaudio2.dll failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +74,7 @@ namespace easy2d
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
E2D_LOG(L"Load Mfplat.dll failed");
|
KGE_LOG(L"Load Mfplat.dll failed");
|
||||||
throw std::runtime_error("Load Mfplat.dll failed");
|
throw std::runtime_error("Load Mfplat.dll failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -89,7 +89,7 @@ namespace easy2d
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
E2D_LOG(L"Load Mfreadwrite.dll failed");
|
KGE_LOG(L"Load Mfreadwrite.dll failed");
|
||||||
throw std::runtime_error("Load Mfreadwrite.dll failed");
|
throw std::runtime_error("Load Mfreadwrite.dll failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -24,11 +24,11 @@
|
||||||
#include <mfidl.h>
|
#include <mfidl.h>
|
||||||
#include <mfreadwrite.h>
|
#include <mfreadwrite.h>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace modules
|
namespace modules
|
||||||
{
|
{
|
||||||
class E2D_API XAudio2
|
class KGE_API XAudio2
|
||||||
{
|
{
|
||||||
XAudio2();
|
XAudio2();
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@ namespace easy2d
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class E2D_API MediaFoundation
|
class KGE_API MediaFoundation
|
||||||
{
|
{
|
||||||
MediaFoundation();
|
MediaFoundation();
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -18,11 +18,11 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include "../easy2d-audio.h"
|
#include "../kiwano-audio.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "audio-modules.h"
|
#include "audio-modules.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Audio::Audio()
|
Audio::Audio()
|
||||||
: x_audio2_(nullptr)
|
: x_audio2_(nullptr)
|
||||||
|
|
@ -36,7 +36,7 @@ namespace easy2d
|
||||||
|
|
||||||
void Audio::SetupComponent(Application*)
|
void Audio::SetupComponent(Application*)
|
||||||
{
|
{
|
||||||
E2D_LOG(L"Creating audio resources");
|
KGE_LOG(L"Creating audio resources");
|
||||||
|
|
||||||
HRESULT hr = modules::MediaFoundation::Get().MFStartup(MF_VERSION, MFSTARTUP_FULL);
|
HRESULT hr = modules::MediaFoundation::Get().MFStartup(MF_VERSION, MFSTARTUP_FULL);
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ namespace easy2d
|
||||||
|
|
||||||
void Audio::DestroyComponent()
|
void Audio::DestroyComponent()
|
||||||
{
|
{
|
||||||
E2D_LOG(L"Destroying audio resources");
|
KGE_LOG(L"Destroying audio resources");
|
||||||
|
|
||||||
ClearVoiceCache();
|
ClearVoiceCache();
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,13 +21,13 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Voice.h"
|
#include "Voice.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class E2D_API Audio
|
class KGE_API Audio
|
||||||
: public Singleton<Audio>
|
: public Singleton<Audio>
|
||||||
, public Component
|
, public Component
|
||||||
{
|
{
|
||||||
E2D_DECLARE_SINGLETON(Audio);
|
KGE_DECLARE_SINGLETON(Audio);
|
||||||
|
|
||||||
using VoiceMap = UnorderedSet<Voice*>;
|
using VoiceMap = UnorderedSet<Voice*>;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include "../platform/Application.h"
|
#include "../platform/Application.h"
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// AsyncTask
|
// AsyncTask
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -26,9 +26,9 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
E2D_DECLARE_SMART_PTR(AsyncTask);
|
KGE_DECLARE_SMART_PTR(AsyncTask);
|
||||||
|
|
||||||
typedef Closure<void()> AsyncTaskFunc;
|
typedef Closure<void()> AsyncTaskFunc;
|
||||||
typedef Closure<void()> AsyncTaskCallback;
|
typedef Closure<void()> AsyncTaskCallback;
|
||||||
|
|
@ -68,7 +68,7 @@ namespace easy2d
|
||||||
: public Singleton<AsyncTaskThread>
|
: public Singleton<AsyncTaskThread>
|
||||||
, public Component
|
, public Component
|
||||||
{
|
{
|
||||||
E2D_DECLARE_SINGLETON(AsyncTaskThread);
|
KGE_DECLARE_SINGLETON(AsyncTaskThread);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void SetupComponent(Application*);
|
virtual void SetupComponent(Application*);
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class Application;
|
class Application;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "keys.hpp"
|
#include "keys.hpp"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
||||||
// 鼠标事件
|
// 鼠标事件
|
||||||
|
|
@ -108,7 +108,7 @@ namespace easy2d
|
||||||
class Node;
|
class Node;
|
||||||
|
|
||||||
// 事件
|
// 事件
|
||||||
struct E2D_API Event
|
struct KGE_API Event
|
||||||
{
|
{
|
||||||
enum Type : UINT
|
enum Type : UINT
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "EventDispatcher.h"
|
#include "EventDispatcher.h"
|
||||||
#include "../base/logs.h"
|
#include "../base/logs.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
void EventDispatcher::Dispatch(Event& evt)
|
void EventDispatcher::Dispatch(Event& evt)
|
||||||
{
|
{
|
||||||
|
|
@ -42,7 +42,7 @@ namespace easy2d
|
||||||
|
|
||||||
EventListenerPtr EventDispatcher::AddListener(EventListenerPtr const & listener)
|
EventListenerPtr EventDispatcher::AddListener(EventListenerPtr const & listener)
|
||||||
{
|
{
|
||||||
E2D_ASSERT(listener && "AddListener failed, NULL pointer exception");
|
KGE_ASSERT(listener && "AddListener failed, NULL pointer exception");
|
||||||
|
|
||||||
if (listener)
|
if (listener)
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,9 +21,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "EventListener.h"
|
#include "EventListener.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class E2D_API EventDispatcher
|
class KGE_API EventDispatcher
|
||||||
{
|
{
|
||||||
using Listeners = IntrusiveList<EventListenerPtr>;
|
using Listeners = IntrusiveList<EventListenerPtr>;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "EventListener.h"
|
#include "EventListener.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
EventListener::EventListener(UINT type, EventCallback const & callback, String const & name)
|
EventListener::EventListener(UINT type, EventCallback const & callback, String const & name)
|
||||||
: type_(type)
|
: type_(type)
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -27,16 +27,16 @@
|
||||||
#include "Event.hpp"
|
#include "Event.hpp"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
typedef Closure<void(Event const&)> EventCallback;
|
typedef Closure<void(Event const&)> EventCallback;
|
||||||
|
|
||||||
class EventDispatcher;
|
class EventDispatcher;
|
||||||
|
|
||||||
E2D_DECLARE_SMART_PTR(EventListener);
|
KGE_DECLARE_SMART_PTR(EventListener);
|
||||||
|
|
||||||
// ʼþ¼àÌýÆ÷
|
// ʼþ¼àÌýÆ÷
|
||||||
class E2D_API EventListener
|
class KGE_API EventListener
|
||||||
: public virtual Object
|
: public virtual Object
|
||||||
, protected IntrusiveListItem<EventListenerPtr>
|
, protected IntrusiveListItem<EventListenerPtr>
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "logs.h"
|
#include "logs.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Input::Input()
|
Input::Input()
|
||||||
: want_update_(false)
|
: want_update_(false)
|
||||||
|
|
@ -69,19 +69,19 @@ namespace easy2d
|
||||||
|
|
||||||
bool Input::IsDown(int key_or_btn)
|
bool Input::IsDown(int key_or_btn)
|
||||||
{
|
{
|
||||||
E2D_ASSERT(key_or_btn >= 0 && key_or_btn < KEY_NUM);
|
KGE_ASSERT(key_or_btn >= 0 && key_or_btn < KEY_NUM);
|
||||||
return keys_[key_or_btn];
|
return keys_[key_or_btn];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Input::WasPressed(int key_or_btn)
|
bool Input::WasPressed(int key_or_btn)
|
||||||
{
|
{
|
||||||
E2D_ASSERT(key_or_btn >= 0 && key_or_btn < KEY_NUM);
|
KGE_ASSERT(key_or_btn >= 0 && key_or_btn < KEY_NUM);
|
||||||
return keys_pressed_[key_or_btn];
|
return keys_pressed_[key_or_btn];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Input::WasReleased(int key_or_btn)
|
bool Input::WasReleased(int key_or_btn)
|
||||||
{
|
{
|
||||||
E2D_ASSERT(key_or_btn >= 0 && key_or_btn < KEY_NUM);
|
KGE_ASSERT(key_or_btn >= 0 && key_or_btn < KEY_NUM);
|
||||||
return keys_released_[key_or_btn];
|
return keys_released_[key_or_btn];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -25,13 +25,13 @@
|
||||||
#include "keys.hpp"
|
#include "keys.hpp"
|
||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class E2D_API Input
|
class KGE_API Input
|
||||||
: public Singleton<Input>
|
: public Singleton<Input>
|
||||||
, public Component
|
, public Component
|
||||||
{
|
{
|
||||||
E2D_DECLARE_SINGLETON(Input);
|
KGE_DECLARE_SINGLETON(Input);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// 检测键盘或鼠标按键是否正被按下
|
// 检测键盘或鼠标按键是否正被按下
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "logs.h"
|
#include "logs.h"
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
@ -38,7 +38,7 @@ namespace easy2d
|
||||||
, name_(nullptr)
|
, name_(nullptr)
|
||||||
, id_(++last_object_id)
|
, id_(++last_object_id)
|
||||||
{
|
{
|
||||||
#ifdef E2D_DEBUG
|
#ifdef KGE_DEBUG
|
||||||
|
|
||||||
Object::__AddObjectToTracingList(this);
|
Object::__AddObjectToTracingList(this);
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ namespace easy2d
|
||||||
if (name_)
|
if (name_)
|
||||||
delete name_;
|
delete name_;
|
||||||
|
|
||||||
#ifdef E2D_DEBUG
|
#ifdef KGE_DEBUG
|
||||||
|
|
||||||
Object::__RemoveObjectFromTracingList(this);
|
Object::__RemoveObjectFromTracingList(this);
|
||||||
|
|
||||||
|
|
@ -107,22 +107,22 @@ namespace easy2d
|
||||||
|
|
||||||
void Object::DumpTracingObjects()
|
void Object::DumpTracingObjects()
|
||||||
{
|
{
|
||||||
E2D_LOG(L"-------------------------- All Objects --------------------------");
|
KGE_LOG(L"-------------------------- All Objects --------------------------");
|
||||||
for (const auto object : tracing_objects)
|
for (const auto object : tracing_objects)
|
||||||
{
|
{
|
||||||
E2D_LOG(L"%s", object->DumpObject().c_str());
|
KGE_LOG(L"%s", object->DumpObject().c_str());
|
||||||
}
|
}
|
||||||
E2D_LOG(L"------------------------- Total size: %d -------------------------", tracing_objects.size());
|
KGE_LOG(L"------------------------- Total size: %d -------------------------", tracing_objects.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
Array<Object*>& easy2d::Object::__GetTracingObjects()
|
Array<Object*>& kiwano::Object::__GetTracingObjects()
|
||||||
{
|
{
|
||||||
return tracing_objects;
|
return tracing_objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::__AddObjectToTracingList(Object * obj)
|
void Object::__AddObjectToTracingList(Object * obj)
|
||||||
{
|
{
|
||||||
#ifdef E2D_DEBUG
|
#ifdef KGE_DEBUG
|
||||||
|
|
||||||
if (tracing_leaks && !obj->tracing_leak_)
|
if (tracing_leaks && !obj->tracing_leak_)
|
||||||
{
|
{
|
||||||
|
|
@ -135,7 +135,7 @@ namespace easy2d
|
||||||
|
|
||||||
void Object::__RemoveObjectFromTracingList(Object * obj)
|
void Object::__RemoveObjectFromTracingList(Object * obj)
|
||||||
{
|
{
|
||||||
#ifdef E2D_DEBUG
|
#ifdef KGE_DEBUG
|
||||||
|
|
||||||
if (tracing_leaks && obj->tracing_leak_)
|
if (tracing_leaks && obj->tracing_leak_)
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -24,11 +24,11 @@
|
||||||
#include "RefCounter.hpp"
|
#include "RefCounter.hpp"
|
||||||
#include "SmartPtr.hpp"
|
#include "SmartPtr.hpp"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
E2D_DECLARE_SMART_PTR(Object);
|
KGE_DECLARE_SMART_PTR(Object);
|
||||||
|
|
||||||
class E2D_API Object
|
class KGE_API Object
|
||||||
: public RefCounter
|
: public RefCounter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,9 +22,9 @@
|
||||||
#include "../macros.h"
|
#include "../macros.h"
|
||||||
#include "../common/noncopyable.hpp"
|
#include "../common/noncopyable.hpp"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class E2D_API RefCounter
|
class KGE_API RefCounter
|
||||||
: protected Noncopyable
|
: protected Noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "Resource.h"
|
#include "Resource.h"
|
||||||
#include "../base/logs.h"
|
#include "../base/logs.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Resource::Resource(LPCWSTR file_name)
|
Resource::Resource(LPCWSTR file_name)
|
||||||
: type_(Type::File)
|
: type_(Type::File)
|
||||||
|
|
@ -95,7 +95,7 @@ namespace easy2d
|
||||||
{
|
{
|
||||||
if (type_ != Type::Binary)
|
if (type_ != Type::Binary)
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Only binary resource can be loaded");
|
KGE_ERROR_LOG(L"Only binary resource can be loaded");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,28 +105,28 @@ namespace easy2d
|
||||||
res_info = FindResourceW(nullptr, bin_name_, bin_type_);
|
res_info = FindResourceW(nullptr, bin_name_, bin_type_);
|
||||||
if (res_info == nullptr)
|
if (res_info == nullptr)
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"FindResource failed");
|
KGE_ERROR_LOG(L"FindResource failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
res_data = LoadResource(nullptr, res_info);
|
res_data = LoadResource(nullptr, res_info);
|
||||||
if (res_data == nullptr)
|
if (res_data == nullptr)
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"LoadResource failed");
|
KGE_ERROR_LOG(L"LoadResource failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer_size = SizeofResource(nullptr, res_info);
|
buffer_size = SizeofResource(nullptr, res_info);
|
||||||
if (buffer_size == 0)
|
if (buffer_size == 0)
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"SizeofResource failed");
|
KGE_ERROR_LOG(L"SizeofResource failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = LockResource(res_data);
|
buffer = LockResource(res_data);
|
||||||
if (buffer == nullptr)
|
if (buffer == nullptr)
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"LockResource failed");
|
KGE_ERROR_LOG(L"LockResource failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "../macros.h"
|
#include "../macros.h"
|
||||||
#include "../common/helper.h"
|
#include "../common/helper.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// 资源
|
// 资源
|
||||||
//
|
//
|
||||||
|
|
@ -32,7 +32,7 @@ namespace easy2d
|
||||||
//
|
//
|
||||||
// 了解资源的更多信息: https://docs.microsoft.com/en-us/windows/desktop/menurc/resources
|
// 了解资源的更多信息: https://docs.microsoft.com/en-us/windows/desktop/menurc/resources
|
||||||
//
|
//
|
||||||
class E2D_API Resource
|
class KGE_API Resource
|
||||||
{
|
{
|
||||||
enum class Type { File, Binary };
|
enum class Type { File, Binary };
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "../base/RefCounter.hpp"
|
#include "../base/RefCounter.hpp"
|
||||||
#include "../common/IntrusivePtr.hpp"
|
#include "../common/IntrusivePtr.hpp"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
struct DefaultIntrusivePtrManager
|
struct DefaultIntrusivePtrManager
|
||||||
{
|
{
|
||||||
|
|
@ -42,8 +42,8 @@ namespace easy2d
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef E2D_DECLARE_SMART_PTR
|
#ifndef KGE_DECLARE_SMART_PTR
|
||||||
#define E2D_DECLARE_SMART_PTR(CLASS)\
|
#define KGE_DECLARE_SMART_PTR(CLASS)\
|
||||||
class CLASS;\
|
class CLASS;\
|
||||||
using CLASS##Ptr = ::easy2d::SmartPtr< CLASS >
|
using CLASS##Ptr = ::kiwano::SmartPtr< CLASS >
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
Timer::Timer(Callback const& func, String const& name)
|
Timer::Timer(Callback const& func, String const& name)
|
||||||
: Timer(func, Duration{}, -1, name)
|
: Timer(func, Duration{}, -1, name)
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -26,14 +26,14 @@
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class TimerManager;
|
class TimerManager;
|
||||||
|
|
||||||
E2D_DECLARE_SMART_PTR(Timer);
|
KGE_DECLARE_SMART_PTR(Timer);
|
||||||
|
|
||||||
// 定时任务
|
// 定时任务
|
||||||
class E2D_API Timer
|
class KGE_API Timer
|
||||||
: public virtual Object
|
: public virtual Object
|
||||||
, protected IntrusiveListItem<TimerPtr>
|
, protected IntrusiveListItem<TimerPtr>
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "TimerManager.h"
|
#include "TimerManager.h"
|
||||||
#include "../base/logs.h"
|
#include "../base/logs.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
void TimerManager::UpdateTimers(Duration dt)
|
void TimerManager::UpdateTimers(Duration dt)
|
||||||
{
|
{
|
||||||
|
|
@ -43,7 +43,7 @@ namespace easy2d
|
||||||
|
|
||||||
void TimerManager::AddTimer(TimerPtr const& timer)
|
void TimerManager::AddTimer(TimerPtr const& timer)
|
||||||
{
|
{
|
||||||
E2D_ASSERT(timer && "AddTimer failed, NULL pointer exception");
|
KGE_ASSERT(timer && "AddTimer failed, NULL pointer exception");
|
||||||
|
|
||||||
if (timer)
|
if (timer)
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,9 +21,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class E2D_API TimerManager
|
class KGE_API TimerManager
|
||||||
{
|
{
|
||||||
using Timers = IntrusiveList<TimerPtr>;
|
using Timers = IntrusiveList<TimerPtr>;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../macros.h"
|
#include "../macros.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
// 報炎梓囚
|
// 報炎梓囚
|
||||||
struct MouseButton
|
struct MouseButton
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "logs.h"
|
#include "logs.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace __console_colors
|
namespace __console_colors
|
||||||
{
|
{
|
||||||
|
|
@ -197,7 +197,7 @@ namespace easy2d
|
||||||
std::time_t unix = std::time(nullptr);
|
std::time_t unix = std::time(nullptr);
|
||||||
std::tm tmbuf;
|
std::tm tmbuf;
|
||||||
localtime_s(&tmbuf, &unix);
|
localtime_s(&tmbuf, &unix);
|
||||||
out << std::put_time(&tmbuf, L"[easy2d] %H:%M:%S");
|
out << std::put_time(&tmbuf, L"[kiwano] %H:%M:%S");
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -25,28 +25,28 @@
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#ifndef E2D_LOG
|
#ifndef KGE_LOG
|
||||||
# ifdef E2D_DEBUG
|
# ifdef KGE_DEBUG
|
||||||
# define E2D_LOG(FORMAT, ...) easy2d::Logger::Instance().Messagef((FORMAT ## "\n"), __VA_ARGS__)
|
# define KGE_LOG(FORMAT, ...) kiwano::Logger::Instance().Messagef((FORMAT ## "\n"), __VA_ARGS__)
|
||||||
# else
|
# else
|
||||||
# define E2D_LOG __noop
|
# define KGE_LOG __noop
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef E2D_WARNING_LOG
|
#ifndef KGE_WARNING_LOG
|
||||||
# define E2D_WARNING_LOG(FORMAT, ...) easy2d::Logger::Instance().Warningf((FORMAT ## "\n"), __VA_ARGS__)
|
# define KGE_WARNING_LOG(FORMAT, ...) kiwano::Logger::Instance().Warningf((FORMAT ## "\n"), __VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef E2D_ERROR_LOG
|
#ifndef KGE_ERROR_LOG
|
||||||
# define E2D_ERROR_LOG(FORMAT, ...) easy2d::Logger::Instance().Errorf((FORMAT ## "\n"), __VA_ARGS__)
|
# define KGE_ERROR_LOG(FORMAT, ...) kiwano::Logger::Instance().Errorf((FORMAT ## "\n"), __VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class E2D_API Logger
|
class KGE_API Logger
|
||||||
: public Singleton<Logger>
|
: public Singleton<Logger>
|
||||||
{
|
{
|
||||||
E2D_DECLARE_SINGLETON(Logger);
|
KGE_DECLARE_SINGLETON(Logger);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Enable();
|
void Enable();
|
||||||
|
|
@ -273,13 +273,13 @@ namespace easy2d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
inline void ThrowIfFailed(HRESULT hr)
|
inline void ThrowIfFailed(HRESULT hr)
|
||||||
{
|
{
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Fatal error with HRESULT of %08X", hr);
|
KGE_ERROR_LOG(L"Fatal error with HRESULT of %08X", hr);
|
||||||
|
|
||||||
static char buffer[1024 + 1];
|
static char buffer[1024 + 1];
|
||||||
sprintf_s(buffer, "Fatal error with HRESULT of %08X", hr);
|
sprintf_s(buffer, "Fatal error with HRESULT of %08X", hr);
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace time
|
namespace time
|
||||||
{
|
{
|
||||||
|
|
@ -67,7 +67,7 @@ namespace easy2d
|
||||||
return Duration(dur_ - other.dur_);
|
return Duration(dur_ - other.dur_);
|
||||||
}
|
}
|
||||||
|
|
||||||
Time Time::Now() E2D_NOEXCEPT
|
Time Time::Now() KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
static LARGE_INTEGER freq = {};
|
static LARGE_INTEGER freq = {};
|
||||||
if (freq.QuadPart == 0LL)
|
if (freq.QuadPart == 0LL)
|
||||||
|
|
@ -139,7 +139,7 @@ namespace easy2d
|
||||||
return static_cast<float>(hour) + static_cast<float>(ms) / (60 * 60 * 1000.f);
|
return static_cast<float>(hour) + static_cast<float>(ms) / (60 * 60 * 1000.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
String easy2d::time::Duration::ToString() const
|
String kiwano::time::Duration::ToString() const
|
||||||
{
|
{
|
||||||
if (IsZero())
|
if (IsZero())
|
||||||
{
|
{
|
||||||
|
|
@ -161,12 +161,12 @@ namespace easy2d
|
||||||
|
|
||||||
if (hour)
|
if (hour)
|
||||||
{
|
{
|
||||||
result.append(easy2d::to_wstring(hour)).append(L"h");
|
result.append(kiwano::to_wstring(hour)).append(L"h");
|
||||||
result.append(easy2d::to_wstring(min)).append(L"m");
|
result.append(kiwano::to_wstring(min)).append(L"m");
|
||||||
}
|
}
|
||||||
else if(min)
|
else if(min)
|
||||||
{
|
{
|
||||||
result.append(easy2d::to_wstring(min)).append(L"m");
|
result.append(kiwano::to_wstring(min)).append(L"m");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ms != 0)
|
if (ms != 0)
|
||||||
|
|
@ -183,7 +183,7 @@ namespace easy2d
|
||||||
}
|
}
|
||||||
else if (sec != 0)
|
else if (sec != 0)
|
||||||
{
|
{
|
||||||
result.append(easy2d::to_wstring(sec)).append(L"s");
|
result.append(kiwano::to_wstring(sec)).append(L"s");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -218,7 +218,7 @@ namespace easy2d
|
||||||
return milliseconds_ <= other.milliseconds_;
|
return milliseconds_ <= other.milliseconds_;
|
||||||
}
|
}
|
||||||
|
|
||||||
float easy2d::time::Duration::operator/(const Duration & other) const
|
float kiwano::time::Duration::operator/(const Duration & other) const
|
||||||
{
|
{
|
||||||
return static_cast<float>(milliseconds_) / other.milliseconds_;
|
return static_cast<float>(milliseconds_) / other.milliseconds_;
|
||||||
}
|
}
|
||||||
|
|
@ -243,7 +243,7 @@ namespace easy2d
|
||||||
return Duration(milliseconds_ * val);
|
return Duration(milliseconds_ * val);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Duration easy2d::time::Duration::operator*(unsigned long long val) const
|
const Duration kiwano::time::Duration::operator*(unsigned long long val) const
|
||||||
{
|
{
|
||||||
return Duration(static_cast<long>(milliseconds_ * val));
|
return Duration(static_cast<long>(milliseconds_ * val));
|
||||||
}
|
}
|
||||||
|
|
@ -326,37 +326,37 @@ namespace easy2d
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Duration easy2d::time::operator*(int val, const Duration & dur)
|
const Duration kiwano::time::operator*(int val, const Duration & dur)
|
||||||
{
|
{
|
||||||
return dur * val;
|
return dur * val;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Duration easy2d::time::operator/(int val, const Duration & dur)
|
const Duration kiwano::time::operator/(int val, const Duration & dur)
|
||||||
{
|
{
|
||||||
return dur / val;
|
return dur / val;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Duration easy2d::time::operator*(float val, const Duration & dur)
|
const Duration kiwano::time::operator*(float val, const Duration & dur)
|
||||||
{
|
{
|
||||||
return dur * val;
|
return dur * val;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Duration easy2d::time::operator/(float val, const Duration & dur)
|
const Duration kiwano::time::operator/(float val, const Duration & dur)
|
||||||
{
|
{
|
||||||
return dur / val;
|
return dur / val;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Duration easy2d::time::operator*(double val, const Duration & dur)
|
const Duration kiwano::time::operator*(double val, const Duration & dur)
|
||||||
{
|
{
|
||||||
return dur * val;
|
return dur * val;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Duration easy2d::time::operator/(double val, const Duration & dur)
|
const Duration kiwano::time::operator/(double val, const Duration & dur)
|
||||||
{
|
{
|
||||||
return dur / val;
|
return dur / val;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Duration easy2d::time::operator*(long double val, const Duration & dur)
|
const Duration kiwano::time::operator*(long double val, const Duration & dur)
|
||||||
{
|
{
|
||||||
return dur * val;
|
return dur * val;
|
||||||
}
|
}
|
||||||
|
|
@ -370,7 +370,7 @@ namespace easy2d
|
||||||
|
|
||||||
if (!std::regex_match(str.c_str(), duration_regex))
|
if (!std::regex_match(str.c_str(), duration_regex))
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Duration::Parse failed, invalid duration");
|
KGE_ERROR_LOG(L"Duration::Parse failed, invalid duration");
|
||||||
return Duration();
|
return Duration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -401,7 +401,7 @@ namespace easy2d
|
||||||
|
|
||||||
if (num_str.empty() || num_str == L".")
|
if (num_str.empty() || num_str == L".")
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Duration::Parse failed, invalid duration");
|
KGE_ERROR_LOG(L"Duration::Parse failed, invalid duration");
|
||||||
return Duration();
|
return Duration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -420,7 +420,7 @@ namespace easy2d
|
||||||
|
|
||||||
if (unit_map.find(unit_str) == unit_map.end())
|
if (unit_map.find(unit_str) == unit_map.end())
|
||||||
{
|
{
|
||||||
E2D_ERROR_LOG(L"Duration::Parse failed, invalid duration");
|
KGE_ERROR_LOG(L"Duration::Parse failed, invalid duration");
|
||||||
return Duration();
|
return Duration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace time
|
namespace time
|
||||||
{
|
{
|
||||||
|
|
@ -39,7 +39,7 @@ namespace easy2d
|
||||||
// 1.5 小时: 1.5_h
|
// 1.5 小时: 1.5_h
|
||||||
// 3 小时 45 分 15 秒: 3_h + 45_m + 15_s
|
// 3 小时 45 分 15 秒: 3_h + 45_m + 15_s
|
||||||
//
|
//
|
||||||
struct E2D_API Duration
|
struct KGE_API Duration
|
||||||
{
|
{
|
||||||
Duration();
|
Duration();
|
||||||
|
|
||||||
|
|
@ -135,10 +135,10 @@ namespace easy2d
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 预定义的时间段 */
|
/* 预定义的时间段 */
|
||||||
E2D_API extern const Duration Ms; // ºÁÃë
|
KGE_API extern const Duration Ms; // ºÁÃë
|
||||||
E2D_API extern const Duration Sec; // Ãë
|
KGE_API extern const Duration Sec; // Ãë
|
||||||
E2D_API extern const Duration Min; // ·ÖÖÓ
|
KGE_API extern const Duration Min; // ·ÖÖÓ
|
||||||
E2D_API extern const Duration Hour; // Сʱ
|
KGE_API extern const Duration Hour; // Сʱ
|
||||||
|
|
||||||
|
|
||||||
// 时间
|
// 时间
|
||||||
|
|
@ -148,7 +148,7 @@ namespace easy2d
|
||||||
// Time t1, t2;
|
// Time t1, t2;
|
||||||
// int ms = (t2 - t1).Milliseconds(); // 获取两时间相差的毫秒数
|
// int ms = (t2 - t1).Milliseconds(); // 获取两时间相差的毫秒数
|
||||||
//
|
//
|
||||||
struct E2D_API Time
|
struct KGE_API Time
|
||||||
{
|
{
|
||||||
Time();
|
Time();
|
||||||
|
|
||||||
|
|
@ -169,7 +169,7 @@ namespace easy2d
|
||||||
// 获取当前时间
|
// 获取当前时间
|
||||||
// 由于该时间点基于系统启动时间开始计算, 所以无法格式化该时间,
|
// 由于该时间点基于系统启动时间开始计算, 所以无法格式化该时间,
|
||||||
// 也无法获得该时间的 Unix 时间戳
|
// 也无法获得该时间的 Unix 时间戳
|
||||||
static Time Now() E2D_NOEXCEPT;
|
static Time Now() KGE_NOEXCEPT;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
long dur_;
|
long dur_;
|
||||||
|
|
@ -177,61 +177,61 @@ namespace easy2d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
using namespace time;
|
using namespace time;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if VS_VER >= VS_2015
|
#if VS_VER >= VS_2015
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
inline namespace literals
|
inline namespace literals
|
||||||
{
|
{
|
||||||
inline const easy2d::time::Duration operator "" _ms(long double val)
|
inline const kiwano::time::Duration operator "" _ms(long double val)
|
||||||
{
|
{
|
||||||
return easy2d::time::Ms * val;
|
return kiwano::time::Ms * val;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const easy2d::time::Duration operator "" _s(long double val)
|
inline const kiwano::time::Duration operator "" _s(long double val)
|
||||||
{
|
{
|
||||||
return easy2d::time::Sec * val;
|
return kiwano::time::Sec * val;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const easy2d::time::Duration operator "" _m(long double val)
|
inline const kiwano::time::Duration operator "" _m(long double val)
|
||||||
{
|
{
|
||||||
return easy2d::time::Min * val;
|
return kiwano::time::Min * val;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const easy2d::time::Duration operator "" _h(long double val)
|
inline const kiwano::time::Duration operator "" _h(long double val)
|
||||||
{
|
{
|
||||||
return easy2d::time::Hour * val;
|
return kiwano::time::Hour * val;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const easy2d::time::Duration operator "" _ms(unsigned long long val)
|
inline const kiwano::time::Duration operator "" _ms(unsigned long long val)
|
||||||
{
|
{
|
||||||
return easy2d::time::Ms * val;
|
return kiwano::time::Ms * val;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const easy2d::time::Duration operator "" _s(unsigned long long val)
|
inline const kiwano::time::Duration operator "" _s(unsigned long long val)
|
||||||
{
|
{
|
||||||
return easy2d::time::Sec * val;
|
return kiwano::time::Sec * val;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const easy2d::time::Duration operator "" _m(unsigned long long val)
|
inline const kiwano::time::Duration operator "" _m(unsigned long long val)
|
||||||
{
|
{
|
||||||
return easy2d::time::Min * val;
|
return kiwano::time::Min * val;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const easy2d::time::Duration operator "" _h(unsigned long long val)
|
inline const kiwano::time::Duration operator "" _h(unsigned long long val)
|
||||||
{
|
{
|
||||||
return easy2d::time::Hour * val;
|
return kiwano::time::Hour * val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace time
|
namespace time
|
||||||
{
|
{
|
||||||
using namespace easy2d::literals;
|
using namespace kiwano::literals;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,9 +23,9 @@
|
||||||
|
|
||||||
#define WINDOW_STYLE WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX
|
#define WINDOW_STYLE WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX
|
||||||
#define WINDOW_FULLSCREEN_STYLE WS_CLIPCHILDREN | WS_POPUP
|
#define WINDOW_FULLSCREEN_STYLE WS_CLIPCHILDREN | WS_POPUP
|
||||||
#define E2D_WND_CLASS_NAME L"Easy2DAppWnd"
|
#define KGE_WND_CLASS_NAME L"KiwanoAppWnd"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
@ -70,7 +70,7 @@ namespace easy2d
|
||||||
HINSTANCE hinst = GetModuleHandleW(nullptr);
|
HINSTANCE hinst = GetModuleHandleW(nullptr);
|
||||||
WNDCLASSEX wcex = { 0 };
|
WNDCLASSEX wcex = { 0 };
|
||||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||||
wcex.lpszClassName = E2D_WND_CLASS_NAME;
|
wcex.lpszClassName = KGE_WND_CLASS_NAME;
|
||||||
wcex.style = CS_HREDRAW | CS_VREDRAW /* | CS_DBLCLKS */;
|
wcex.style = CS_HREDRAW | CS_VREDRAW /* | CS_DBLCLKS */;
|
||||||
wcex.lpfnWndProc = proc;
|
wcex.lpfnWndProc = proc;
|
||||||
wcex.hIcon = nullptr;
|
wcex.hIcon = nullptr;
|
||||||
|
|
@ -140,7 +140,7 @@ namespace easy2d
|
||||||
|
|
||||||
handle_ = ::CreateWindowExW(
|
handle_ = ::CreateWindowExW(
|
||||||
is_fullscreen_ ? WS_EX_TOPMOST : 0,
|
is_fullscreen_ ? WS_EX_TOPMOST : 0,
|
||||||
E2D_WND_CLASS_NAME,
|
KGE_WND_CLASS_NAME,
|
||||||
title.c_str(),
|
title.c_str(),
|
||||||
GetWindowStyle(),
|
GetWindowStyle(),
|
||||||
left,
|
left,
|
||||||
|
|
@ -155,7 +155,7 @@ namespace easy2d
|
||||||
|
|
||||||
if (handle_ == nullptr)
|
if (handle_ == nullptr)
|
||||||
{
|
{
|
||||||
::UnregisterClass(E2D_WND_CLASS_NAME, hinst);
|
::UnregisterClass(KGE_WND_CLASS_NAME, hinst);
|
||||||
return HRESULT_FROM_WIN32(GetLastError());
|
return HRESULT_FROM_WIN32(GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -382,7 +382,7 @@ namespace easy2d
|
||||||
mode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
|
mode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
|
||||||
|
|
||||||
if (::ChangeDisplaySettingsExW(device_name, &mode, NULL, CDS_FULLSCREEN, NULL) != DISP_CHANGE_SUCCESSFUL)
|
if (::ChangeDisplaySettingsExW(device_name, &mode, NULL, CDS_FULLSCREEN, NULL) != DISP_CHANGE_SUCCESSFUL)
|
||||||
E2D_ERROR_LOG(L"ChangeDisplaySettings failed");
|
KGE_ERROR_LOG(L"ChangeDisplaySettings failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestoreResolution(WCHAR* device_name)
|
void RestoreResolution(WCHAR* device_name)
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,9 +23,9 @@
|
||||||
#include "../common/helper.h"
|
#include "../common/helper.h"
|
||||||
#include "../math/helper.h"
|
#include "../math/helper.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class E2D_API Window
|
class KGE_API Window
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// »ñÈ¡±êÌâ
|
// »ñÈ¡±êÌâ
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Array
|
// Array
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include <Unknwnbase.h>
|
#include <Unknwnbase.h>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
struct ComPtrManager
|
struct ComPtrManager
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -22,13 +22,13 @@
|
||||||
#include "../macros.h"
|
#include "../macros.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#ifdef E2D_DEBUG
|
#ifdef KGE_DEBUG
|
||||||
# define E2D_DEBUG_CHECK_LIST(list_ptr) list_ptr->Check()
|
# define KGE_DEBUG_CHECK_LIST(list_ptr) list_ptr->Check()
|
||||||
#else
|
#else
|
||||||
# define E2D_DEBUG_CHECK_LIST __noop
|
# define KGE_DEBUG_CHECK_LIST __noop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
template <typename T> class IntrusiveList;
|
template <typename T> class IntrusiveList;
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ namespace easy2d
|
||||||
|
|
||||||
last_ = child;
|
last_ = child;
|
||||||
|
|
||||||
E2D_DEBUG_CHECK_LIST(this);
|
KGE_DEBUG_CHECK_LIST(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PushFront(T const& child)
|
void PushFront(T const& child)
|
||||||
|
|
@ -124,7 +124,7 @@ namespace easy2d
|
||||||
|
|
||||||
first_ = child;
|
first_ = child;
|
||||||
|
|
||||||
E2D_DEBUG_CHECK_LIST(this);
|
KGE_DEBUG_CHECK_LIST(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsertBefore(T const& child, T const& before)
|
void InsertBefore(T const& child, T const& before)
|
||||||
|
|
@ -143,7 +143,7 @@ namespace easy2d
|
||||||
child->next_ = before;
|
child->next_ = before;
|
||||||
before->prev_ = child;
|
before->prev_ = child;
|
||||||
|
|
||||||
E2D_DEBUG_CHECK_LIST(this);
|
KGE_DEBUG_CHECK_LIST(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsertAfter(T const& child, T const& after)
|
void InsertAfter(T const& child, T const& after)
|
||||||
|
|
@ -162,16 +162,16 @@ namespace easy2d
|
||||||
child->prev_ = after;
|
child->prev_ = after;
|
||||||
after->next_ = child;
|
after->next_ = child;
|
||||||
|
|
||||||
E2D_DEBUG_CHECK_LIST(this);
|
KGE_DEBUG_CHECK_LIST(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Remove(T const& child)
|
void Remove(T const& child)
|
||||||
{
|
{
|
||||||
#ifdef E2D_DEBUG
|
#ifdef KGE_DEBUG
|
||||||
T tmp = first_;
|
T tmp = first_;
|
||||||
while (tmp != child)
|
while (tmp != child)
|
||||||
{
|
{
|
||||||
E2D_ASSERT((tmp != last_) && "The node to be removed is not in this list");
|
KGE_ASSERT((tmp != last_) && "The node to be removed is not in this list");
|
||||||
tmp = tmp->next_;
|
tmp = tmp->next_;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -197,7 +197,7 @@ namespace easy2d
|
||||||
child->prev_ = nullptr;
|
child->prev_ = nullptr;
|
||||||
child->next_ = nullptr;
|
child->next_ = nullptr;
|
||||||
|
|
||||||
E2D_DEBUG_CHECK_LIST(this);
|
KGE_DEBUG_CHECK_LIST(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clear()
|
void Clear()
|
||||||
|
|
@ -217,7 +217,7 @@ namespace easy2d
|
||||||
last_ = nullptr;
|
last_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef E2D_DEBUG
|
#ifdef KGE_DEBUG
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Check()
|
void Check()
|
||||||
|
|
@ -236,11 +236,11 @@ namespace easy2d
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
E2D_ASSERT(p->prev_ == tmp && "Check list failed");
|
KGE_ASSERT(p->prev_ == tmp && "Check list failed");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
E2D_ASSERT(tmp == last_ && "Check list failed");
|
KGE_ASSERT(tmp == last_ && "Check list failed");
|
||||||
}
|
}
|
||||||
} while (p);
|
} while (p);
|
||||||
}
|
}
|
||||||
|
|
@ -249,4 +249,4 @@ namespace easy2d
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef E2D_DEBUG_CHECK_LIST
|
#undef KGE_DEBUG_CHECK_LIST
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining lhs copy
|
// Permission is hereby granted, free of charge, to any person obtaining lhs copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
template <typename _Ty, typename _Manager, bool _Enable>
|
template <typename _Ty, typename _Manager, bool _Enable>
|
||||||
class IntrusivePtr;
|
class IntrusivePtr;
|
||||||
|
|
@ -43,81 +43,81 @@ namespace easy2d
|
||||||
public:
|
public:
|
||||||
using Type = _Ty;
|
using Type = _Ty;
|
||||||
|
|
||||||
IntrusivePtr() E2D_NOEXCEPT {}
|
IntrusivePtr() KGE_NOEXCEPT {}
|
||||||
|
|
||||||
IntrusivePtr(nullptr_t) E2D_NOEXCEPT {}
|
IntrusivePtr(nullptr_t) KGE_NOEXCEPT {}
|
||||||
|
|
||||||
IntrusivePtr(Type* p) E2D_NOEXCEPT : ptr_(p)
|
IntrusivePtr(Type* p) KGE_NOEXCEPT : ptr_(p)
|
||||||
{
|
{
|
||||||
typename _Manager::AddRef(ptr_);
|
typename _Manager::AddRef(ptr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntrusivePtr(const IntrusivePtr& other) E2D_NOEXCEPT
|
IntrusivePtr(const IntrusivePtr& other) KGE_NOEXCEPT
|
||||||
: ptr_(other.ptr_)
|
: ptr_(other.ptr_)
|
||||||
{
|
{
|
||||||
typename _Manager::AddRef(ptr_);
|
typename _Manager::AddRef(ptr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename _UTy>
|
template <typename _UTy>
|
||||||
IntrusivePtr(const RealIntrusivePtr<_UTy, _Manager>& other) E2D_NOEXCEPT
|
IntrusivePtr(const RealIntrusivePtr<_UTy, _Manager>& other) KGE_NOEXCEPT
|
||||||
: ptr_(other.Get())
|
: ptr_(other.Get())
|
||||||
{
|
{
|
||||||
typename _Manager::AddRef(ptr_);
|
typename _Manager::AddRef(ptr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntrusivePtr(IntrusivePtr&& other) E2D_NOEXCEPT
|
IntrusivePtr(IntrusivePtr&& other) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
ptr_ = other.ptr_;
|
ptr_ = other.ptr_;
|
||||||
other.ptr_ = nullptr;
|
other.ptr_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
~IntrusivePtr() E2D_NOEXCEPT
|
~IntrusivePtr() KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
typename _Manager::Release(ptr_);
|
typename _Manager::Release(ptr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Type* Get() const E2D_NOEXCEPT { return ptr_; }
|
inline Type* Get() const KGE_NOEXCEPT { return ptr_; }
|
||||||
|
|
||||||
inline void Reset() E2D_NOEXCEPT
|
inline void Reset() KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
IntrusivePtr{}.Swap(*this);
|
IntrusivePtr{}.Swap(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Swap(IntrusivePtr& other) E2D_NOEXCEPT
|
inline void Swap(IntrusivePtr& other) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
std::swap(ptr_, other.ptr_);
|
std::swap(ptr_, other.ptr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Type* operator ->() const
|
inline Type* operator ->() const
|
||||||
{
|
{
|
||||||
E2D_ASSERT(ptr_ != nullptr && "Invalid pointer");
|
KGE_ASSERT(ptr_ != nullptr && "Invalid pointer");
|
||||||
return ptr_;
|
return ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Type& operator *() const
|
inline Type& operator *() const
|
||||||
{
|
{
|
||||||
E2D_ASSERT(ptr_ != nullptr && "Invalid pointer");
|
KGE_ASSERT(ptr_ != nullptr && "Invalid pointer");
|
||||||
return *ptr_;
|
return *ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Type** operator &()
|
inline Type** operator &()
|
||||||
{
|
{
|
||||||
E2D_ASSERT(ptr_ == nullptr && "Memory leak");
|
KGE_ASSERT(ptr_ == nullptr && "Memory leak");
|
||||||
return &ptr_;
|
return &ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline operator bool() const E2D_NOEXCEPT { return ptr_ != nullptr; }
|
inline operator bool() const KGE_NOEXCEPT { return ptr_ != nullptr; }
|
||||||
|
|
||||||
inline bool operator !() const E2D_NOEXCEPT { return ptr_ == 0; }
|
inline bool operator !() const KGE_NOEXCEPT { return ptr_ == 0; }
|
||||||
|
|
||||||
inline IntrusivePtr& operator =(const IntrusivePtr& other) E2D_NOEXCEPT
|
inline IntrusivePtr& operator =(const IntrusivePtr& other) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
if (other.ptr_ != ptr_)
|
if (other.ptr_ != ptr_)
|
||||||
IntrusivePtr(other).Swap(*this);
|
IntrusivePtr(other).Swap(*this);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline IntrusivePtr& operator =(IntrusivePtr&& other) E2D_NOEXCEPT
|
inline IntrusivePtr& operator =(IntrusivePtr&& other) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
typename _Manager::Release(ptr_);
|
typename _Manager::Release(ptr_);
|
||||||
ptr_ = other.ptr_;
|
ptr_ = other.ptr_;
|
||||||
|
|
@ -125,14 +125,14 @@ namespace easy2d
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline IntrusivePtr& operator =(Type* p) E2D_NOEXCEPT
|
inline IntrusivePtr& operator =(Type* p) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
if (p != ptr_)
|
if (p != ptr_)
|
||||||
IntrusivePtr(p).Swap(*this);
|
IntrusivePtr(p).Swap(*this);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline IntrusivePtr& operator =(nullptr_t) E2D_NOEXCEPT
|
inline IntrusivePtr& operator =(nullptr_t) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
if (nullptr != ptr_)
|
if (nullptr != ptr_)
|
||||||
IntrusivePtr{}.Swap(*this);
|
IntrusivePtr{}.Swap(*this);
|
||||||
|
|
@ -141,75 +141,75 @@ namespace easy2d
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Ty, class _UTy, class _Manager>
|
template <class _Ty, class _UTy, class _Manager>
|
||||||
inline bool operator==(RealIntrusivePtr<_Ty, _Manager> const& lhs, RealIntrusivePtr<_UTy, _Manager> const& rhs) E2D_NOEXCEPT
|
inline bool operator==(RealIntrusivePtr<_Ty, _Manager> const& lhs, RealIntrusivePtr<_UTy, _Manager> const& rhs) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
return lhs.Get() == rhs.Get();
|
return lhs.Get() == rhs.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ty, class _UTy, class _Manager>
|
template <class _Ty, class _UTy, class _Manager>
|
||||||
inline bool operator!=(RealIntrusivePtr<_Ty, _Manager> const& lhs, RealIntrusivePtr<_UTy, _Manager> const& rhs) E2D_NOEXCEPT
|
inline bool operator!=(RealIntrusivePtr<_Ty, _Manager> const& lhs, RealIntrusivePtr<_UTy, _Manager> const& rhs) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
return lhs.Get() != rhs.Get();
|
return lhs.Get() != rhs.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ty, class _UTy, class _Manager>
|
template <class _Ty, class _UTy, class _Manager>
|
||||||
inline bool operator<(RealIntrusivePtr<_Ty, _Manager> const& lhs, RealIntrusivePtr<_UTy, _Manager> const& rhs) E2D_NOEXCEPT
|
inline bool operator<(RealIntrusivePtr<_Ty, _Manager> const& lhs, RealIntrusivePtr<_UTy, _Manager> const& rhs) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
return lhs.Get() < rhs.Get();
|
return lhs.Get() < rhs.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ty, class _Manager>
|
template <class _Ty, class _Manager>
|
||||||
inline bool operator==(RealIntrusivePtr<_Ty, _Manager> const& lhs, _Ty* rhs) E2D_NOEXCEPT
|
inline bool operator==(RealIntrusivePtr<_Ty, _Manager> const& lhs, _Ty* rhs) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
return lhs.Get() == rhs;
|
return lhs.Get() == rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ty, class _Manager>
|
template <class _Ty, class _Manager>
|
||||||
inline bool operator!=(RealIntrusivePtr<_Ty, _Manager> const& lhs, _Ty* rhs) E2D_NOEXCEPT
|
inline bool operator!=(RealIntrusivePtr<_Ty, _Manager> const& lhs, _Ty* rhs) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
return lhs.Get() != rhs;
|
return lhs.Get() != rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ty, class _Manager>
|
template <class _Ty, class _Manager>
|
||||||
inline bool operator==(_Ty* lhs, RealIntrusivePtr<_Ty, _Manager> const& rhs) E2D_NOEXCEPT
|
inline bool operator==(_Ty* lhs, RealIntrusivePtr<_Ty, _Manager> const& rhs) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
return lhs == rhs.Get();
|
return lhs == rhs.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ty, class _Manager>
|
template <class _Ty, class _Manager>
|
||||||
inline bool operator!=(_Ty* lhs, RealIntrusivePtr<_Ty, _Manager> const& rhs) E2D_NOEXCEPT
|
inline bool operator!=(_Ty* lhs, RealIntrusivePtr<_Ty, _Manager> const& rhs) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
return lhs != rhs.Get();
|
return lhs != rhs.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ty, class _Manager>
|
template <class _Ty, class _Manager>
|
||||||
inline bool operator==(RealIntrusivePtr<_Ty, _Manager> const& lhs, nullptr_t) E2D_NOEXCEPT
|
inline bool operator==(RealIntrusivePtr<_Ty, _Manager> const& lhs, nullptr_t) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
return !static_cast<bool>(lhs);
|
return !static_cast<bool>(lhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ty, class _Manager>
|
template <class _Ty, class _Manager>
|
||||||
inline bool operator!=(RealIntrusivePtr<_Ty, _Manager> const& lhs, nullptr_t) E2D_NOEXCEPT
|
inline bool operator!=(RealIntrusivePtr<_Ty, _Manager> const& lhs, nullptr_t) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
return static_cast<bool>(lhs);
|
return static_cast<bool>(lhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ty, class _Manager>
|
template <class _Ty, class _Manager>
|
||||||
inline bool operator==(nullptr_t, RealIntrusivePtr<_Ty, _Manager> const& rhs) E2D_NOEXCEPT
|
inline bool operator==(nullptr_t, RealIntrusivePtr<_Ty, _Manager> const& rhs) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
return !static_cast<bool>(rhs);
|
return !static_cast<bool>(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ty, class _Manager>
|
template <class _Ty, class _Manager>
|
||||||
inline bool operator!=(nullptr_t, RealIntrusivePtr<_Ty, _Manager> const& rhs) E2D_NOEXCEPT
|
inline bool operator!=(nullptr_t, RealIntrusivePtr<_Ty, _Manager> const& rhs) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
return static_cast<bool>(rhs);
|
return static_cast<bool>(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template class cannot specialize std::swap,
|
// template class cannot specialize std::swap,
|
||||||
// so implement a swap function in easy2d namespace
|
// so implement a swap function in kiwano namespace
|
||||||
template <class _Ty, class _Manager>
|
template <class _Ty, class _Manager>
|
||||||
inline void swap(RealIntrusivePtr<_Ty, _Manager>& lhs, RealIntrusivePtr<_Ty, _Manager>& rhs) E2D_NOEXCEPT
|
inline void swap(RealIntrusivePtr<_Ty, _Manager>& lhs, RealIntrusivePtr<_Ty, _Manager>& rhs) KGE_NOEXCEPT
|
||||||
{
|
{
|
||||||
lhs.Swap(rhs);
|
lhs.Swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -25,12 +25,12 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
template <
|
template <
|
||||||
template <class _Kty, class _Ty, class ..._Args> typename _ObjectTy = easy2d::Map,
|
template <class _Kty, class _Ty, class ..._Args> typename _ObjectTy = kiwano::Map,
|
||||||
template <class _Kty, class ..._Args> typename _ArrayTy = easy2d::Array,
|
template <class _Kty, class ..._Args> typename _ArrayTy = kiwano::Array,
|
||||||
typename _StringTy = easy2d::String,
|
typename _StringTy = kiwano::String,
|
||||||
typename _IntegerTy = std::int32_t,
|
typename _IntegerTy = std::int32_t,
|
||||||
typename _FloatTy = double,
|
typename _FloatTy = double,
|
||||||
typename _BooleanTy = bool,
|
typename _BooleanTy = bool,
|
||||||
|
|
@ -44,7 +44,7 @@ namespace easy2d
|
||||||
// details of basic_json
|
// details of basic_json
|
||||||
//
|
//
|
||||||
|
|
||||||
#define E2D_DECLARE_BASIC_JSON_TEMPLATE\
|
#define KGE_DECLARE_BASIC_JSON_TEMPLATE\
|
||||||
template <\
|
template <\
|
||||||
template <class _Kty, class _Ty, class ..._Args> typename _ObjectTy, \
|
template <class _Kty, class _Ty, class ..._Args> typename _ObjectTy, \
|
||||||
template <class _Kty, class ..._Args> typename _ArrayTy, \
|
template <class _Kty, class ..._Args> typename _ArrayTy, \
|
||||||
|
|
@ -54,7 +54,7 @@ namespace easy2d
|
||||||
typename _BooleanTy, \
|
typename _BooleanTy, \
|
||||||
template <class _Ty> typename _Allocator>
|
template <class _Ty> typename _Allocator>
|
||||||
|
|
||||||
#define E2D_DECLARE_BASIC_JSON_TPL_ARGS \
|
#define KGE_DECLARE_BASIC_JSON_TPL_ARGS \
|
||||||
_ObjectTy, _ArrayTy, _StringTy, _IntegerTy, _FloatTy, _BooleanTy, _Allocator
|
_ObjectTy, _ArrayTy, _StringTy, _IntegerTy, _FloatTy, _BooleanTy, _Allocator
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -84,8 +84,8 @@ namespace easy2d
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
E2D_DECLARE_BASIC_JSON_TEMPLATE
|
KGE_DECLARE_BASIC_JSON_TEMPLATE
|
||||||
struct is_basic_json< basic_json<E2D_DECLARE_BASIC_JSON_TPL_ARGS> >
|
struct is_basic_json< basic_json<KGE_DECLARE_BASIC_JSON_TPL_ARGS> >
|
||||||
: ::std::true_type
|
: ::std::true_type
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
@ -1811,7 +1811,7 @@ namespace easy2d
|
||||||
// basic_json
|
// basic_json
|
||||||
//
|
//
|
||||||
|
|
||||||
E2D_DECLARE_BASIC_JSON_TEMPLATE
|
KGE_DECLARE_BASIC_JSON_TEMPLATE
|
||||||
class basic_json
|
class basic_json
|
||||||
{
|
{
|
||||||
friend struct __json_detail::iterator_impl<basic_json>;
|
friend struct __json_detail::iterator_impl<basic_json>;
|
||||||
|
|
@ -2673,20 +2673,20 @@ namespace easy2d
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
template<>
|
template<>
|
||||||
struct hash<::easy2d::Json>
|
struct hash<::kiwano::Json>
|
||||||
{
|
{
|
||||||
std::size_t operator()(const ::easy2d::Json& json) const
|
std::size_t operator()(const ::kiwano::Json& json) const
|
||||||
{
|
{
|
||||||
return hash<::easy2d::Json::string_type>{}(json.dump());
|
return hash<::kiwano::Json::string_type>{}(json.dump());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline void swap<::easy2d::Json>(::easy2d::Json& lhs, ::easy2d::Json& rhs)
|
inline void swap<::kiwano::Json>(::kiwano::Json& lhs, ::kiwano::Json& rhs)
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef E2D_DECLARE_BASIC_JSON_TEMPLATE
|
#undef KGE_DECLARE_BASIC_JSON_TEMPLATE
|
||||||
#undef E2D_DECLARE_BASIC_JSON_TPL_ARGS
|
#undef KGE_DECLARE_BASIC_JSON_TPL_ARGS
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -23,12 +23,12 @@
|
||||||
// Class that will implement the singleton mode,
|
// Class that will implement the singleton mode,
|
||||||
// must use the macro in its delare file
|
// must use the macro in its delare file
|
||||||
|
|
||||||
#ifndef E2D_DECLARE_SINGLETON
|
#ifndef KGE_DECLARE_SINGLETON
|
||||||
#define E2D_DECLARE_SINGLETON( CLASS ) \
|
#define KGE_DECLARE_SINGLETON( CLASS ) \
|
||||||
friend class ::easy2d::Singleton< CLASS >
|
friend class ::kiwano::Singleton< CLASS >
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
template <typename _Ty>
|
template <typename _Ty>
|
||||||
class Singleton
|
class Singleton
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// String
|
// String
|
||||||
|
|
@ -376,7 +376,7 @@ namespace easy2d
|
||||||
String format_wstring(const wchar_t* const fmt, _Args&&... args);
|
String format_wstring(const wchar_t* const fmt, _Args&&... args);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// details of String
|
// details of String
|
||||||
|
|
@ -1108,20 +1108,20 @@ namespace easy2d
|
||||||
// details of String::parese
|
// details of String::parese
|
||||||
//
|
//
|
||||||
|
|
||||||
inline String String::parse(int val) { return ::easy2d::to_wstring(val); }
|
inline String String::parse(int val) { return ::kiwano::to_wstring(val); }
|
||||||
inline String String::parse(unsigned int val) { return ::easy2d::to_wstring(val); }
|
inline String String::parse(unsigned int val) { return ::kiwano::to_wstring(val); }
|
||||||
inline String String::parse(long val) { return ::easy2d::to_wstring(val); }
|
inline String String::parse(long val) { return ::kiwano::to_wstring(val); }
|
||||||
inline String String::parse(unsigned long val) { return ::easy2d::to_wstring(val); }
|
inline String String::parse(unsigned long val) { return ::kiwano::to_wstring(val); }
|
||||||
inline String String::parse(long long val) { return ::easy2d::to_wstring(val); }
|
inline String String::parse(long long val) { return ::kiwano::to_wstring(val); }
|
||||||
inline String String::parse(unsigned long long val) { return ::easy2d::to_wstring(val); }
|
inline String String::parse(unsigned long long val) { return ::kiwano::to_wstring(val); }
|
||||||
inline String String::parse(float val) { return ::easy2d::to_wstring(val); }
|
inline String String::parse(float val) { return ::kiwano::to_wstring(val); }
|
||||||
inline String String::parse(double val) { return ::easy2d::to_wstring(val); }
|
inline String String::parse(double val) { return ::kiwano::to_wstring(val); }
|
||||||
inline String String::parse(long double val) { return ::easy2d::to_wstring(val); }
|
inline String String::parse(long double val) { return ::kiwano::to_wstring(val); }
|
||||||
|
|
||||||
template<typename ..._Args>
|
template<typename ..._Args>
|
||||||
inline String String::format(const wchar_t* const fmt, _Args&&... args)
|
inline String String::format(const wchar_t* const fmt, _Args&&... args)
|
||||||
{
|
{
|
||||||
return ::easy2d::format_wstring(fmt, std::forward<_Args>(args)...);
|
return ::kiwano::format_wstring(fmt, std::forward<_Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -1368,16 +1368,16 @@ namespace easy2d
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
template<>
|
template<>
|
||||||
struct hash<::easy2d::String>
|
struct hash<::kiwano::String>
|
||||||
{
|
{
|
||||||
inline size_t operator()(const easy2d::String& key) const
|
inline size_t operator()(const kiwano::String& key) const
|
||||||
{
|
{
|
||||||
return key.hash();
|
return key.hash();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline void swap<::easy2d::String>(::easy2d::String& lhs, ::easy2d::String& rhs)
|
inline void swap<::kiwano::String>(::kiwano::String& lhs, ::kiwano::String& rhs)
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Closure is a light weight std::function<>-like class
|
// Closure is a light weight std::function<>-like class
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
using StringStream = std::wstringstream;
|
using StringStream = std::wstringstream;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class Noncopyable
|
class Noncopyable
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Compile-time options for Kiwano
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
//---- Define assertion handler. Defaults to calling assert()
|
||||||
|
//#define KGE_ASSERT(EXPR) MyAssert(EXPR)
|
||||||
|
//#define KGE_ASSERT(EXPR) __noop // Disable asserts
|
||||||
|
|
||||||
|
//---- Define debug-output handler. Defaults to calling kiwano::logs::Messageln()/Warningln()/Errorln()
|
||||||
|
//#define KGE_LOG(FORMAT, ...) wprintf(FORMAT L"\n", __VA_ARGS__)
|
||||||
|
//#define KGE_WARNING_LOG(FORMAT, ...) wprintf(FORMAT L"\n", __VA_ARGS__)
|
||||||
|
//#define KGE_ERROR_LOG(FORMAT, ...) wprintf(FORMAT L"\n", __VA_ARGS__)
|
||||||
|
|
||||||
|
//---- Define attributes of all API symbols declarations for DLL
|
||||||
|
//#define KGE_API __declspec( dllexport )
|
||||||
|
//#define KGE_API __declspec( dllimport )
|
||||||
|
|
||||||
|
//---- Define DirectX version. Defaults to using Direct3D11
|
||||||
|
//#define KGE_USE_DIRECTX10
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -18,9 +18,9 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include "../easy2d-imgui.h"
|
#include "../kiwano-imgui.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
@ -47,13 +47,13 @@ namespace easy2d
|
||||||
if (!ImGui::IsAnyMouseDown() && ::GetCapture() == nullptr)
|
if (!ImGui::IsAnyMouseDown() && ::GetCapture() == nullptr)
|
||||||
::SetCapture(target_window_);
|
::SetCapture(target_window_);
|
||||||
|
|
||||||
E2D_ASSERT(mouse_buttons.find(btn) != mouse_buttons.end());
|
KGE_ASSERT(mouse_buttons.find(btn) != mouse_buttons.end());
|
||||||
ImGui::GetIO().MouseDown[mouse_buttons[btn]] = true;
|
ImGui::GetIO().MouseDown[mouse_buttons[btn]] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGuiLayer::OnMouseButtonUp(int btn, Point const & p)
|
void ImGuiLayer::OnMouseButtonUp(int btn, Point const & p)
|
||||||
{
|
{
|
||||||
E2D_ASSERT(mouse_buttons.find(btn) != mouse_buttons.end());
|
KGE_ASSERT(mouse_buttons.find(btn) != mouse_buttons.end());
|
||||||
ImGui::GetIO().MouseDown[mouse_buttons[btn]] = false;
|
ImGui::GetIO().MouseDown[mouse_buttons[btn]] = false;
|
||||||
|
|
||||||
if (!ImGui::IsAnyMouseDown() && ::GetCapture() == target_window_)
|
if (!ImGui::IsAnyMouseDown() && ::GetCapture() == target_window_)
|
||||||
|
|
@ -67,13 +67,13 @@ namespace easy2d
|
||||||
|
|
||||||
void ImGuiLayer::OnKeyDown(int key)
|
void ImGuiLayer::OnKeyDown(int key)
|
||||||
{
|
{
|
||||||
E2D_ASSERT(key < 256);
|
KGE_ASSERT(key < 256);
|
||||||
ImGui::GetIO().KeysDown[key] = 1;
|
ImGui::GetIO().KeysDown[key] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGuiLayer::OnKeyUp(int key)
|
void ImGuiLayer::OnKeyUp(int key)
|
||||||
{
|
{
|
||||||
E2D_ASSERT(key < 256);
|
KGE_ASSERT(key < 256);
|
||||||
ImGui::GetIO().KeysDown[key] = 0;
|
ImGui::GetIO().KeysDown[key] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2016-2018 Easy2D - Nomango
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class ImGuiView;
|
class ImGuiView;
|
||||||
|
|
||||||
E2D_DECLARE_SMART_PTR(ImGuiLayer);
|
KGE_DECLARE_SMART_PTR(ImGuiLayer);
|
||||||
|
|
||||||
using ImGuiPipeline = Closure<void()>;
|
using ImGuiPipeline = Closure<void()>;
|
||||||
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
// Copyright (C) 2019 Nomango
|
// Copyright (C) 2019 Nomango
|
||||||
|
|
||||||
#include "../easy2d-imgui.h"
|
#include "../kiwano-imgui.h"
|
||||||
#include "imgui_impl_dx11.h"
|
#include "imgui_impl_dx11.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace kiwano
|
||||||
{
|
{
|
||||||
void ImGuiView::SetupComponent(Application* app)
|
void ImGuiView::SetupComponent(Application* app)
|
||||||
{
|
{
|
||||||
|
|
@ -64,7 +64,7 @@ namespace easy2d
|
||||||
ImGui_ImplDX11_NewFrame();
|
ImGui_ImplDX11_NewFrame();
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
E2D_ASSERT(io.Fonts->IsBuilt() && "Font atlas not built!");
|
KGE_ASSERT(io.Fonts->IsBuilt() && "Font atlas not built!");
|
||||||
|
|
||||||
// Setup display size (every frame to accommodate for window resizing)
|
// Setup display size (every frame to accommodate for window resizing)
|
||||||
Size display_size = Renderer::Instance().GetOutputSize();
|
Size display_size = Renderer::Instance().GetOutputSize();
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue