Easy2D project renamed to Kiwano

This commit is contained in:
Nomango 2019-04-11 14:40:54 +08:00 committed by Nomango
parent e68e6c41cc
commit b49d583fd5
196 changed files with 6791 additions and 848 deletions

View File

@ -6,7 +6,7 @@ about: 创建一个 Bug 报告,请选择这个模版
### 编译环境
- Easy2D 版本号:
- Kiwano 版本号:
- 操作系统:
- 编译器:

View File

@ -1,6 +1,6 @@
---
name: Confused
about: 使用 Easy2D 时有任何疑问,请选择这个模版
about: 使用 Kiwano 时有任何疑问,请选择这个模版
---
@ -10,4 +10,4 @@ about: 使用 Easy2D 时有任何疑问,请选择这个模版
### 环境
留下你使用的 Easy2D 版本号,以及系统、编译器等信息
留下你使用的 Kiwano 版本号,以及系统、编译器等信息

View File

@ -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

View File

@ -4,7 +4,7 @@ VisualStudioVersion = 16.0.28729.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorld", "samples\HelloWorld\HelloWorld.vcxproj", "{3561A359-F9FD-48AB-A977-34E7E568BC8E}"
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
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Samples", "samples\Samples\Samples.vcxproj", "{45F5738D-CDF2-4024-974D-25B64F9043DE}"
EndProject

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#include "Action.h"
#include "Node.h"
namespace easy2d
namespace kiwano
{
Action::Action()
: running_(true)

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,13 +21,13 @@
#pragma once
#include "include-forwards.h"
namespace easy2d
namespace kiwano
{
using ActionCallback = Closure<void()>;
class ActionManager;
class E2D_API Action
class KGE_API Action
: public virtual Object
, protected IntrusiveListItem<ActionPtr>
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#include "ActionGroup.h"
#include "../base/logs.h"
namespace easy2d
namespace kiwano
{
//-------------------------------------------------------
// ActionGroup

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,10 +21,10 @@
#pragma once
#include "Action.h"
namespace easy2d
namespace kiwano
{
// 动作组
class E2D_API ActionGroup
class KGE_API ActionGroup
: public Action
{
public:
@ -73,14 +73,14 @@ namespace easy2d
// 顺序动作
class E2D_API ActionSequence
class KGE_API ActionSequence
: public ActionGroup
{
public:
E2D_DEPRECATED("ActionSequence is deprecated, use ActionGroup instead")
KGE_DEPRECATED("ActionSequence is deprecated, use ActionGroup instead")
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) {}
virtual ~ActionSequence() {}
@ -88,14 +88,14 @@ namespace easy2d
// 同步动作
class E2D_API ActionSpawn
class KGE_API ActionSpawn
: public ActionGroup
{
public:
E2D_DEPRECATED("ActionSpawn is deprecated, use ActionGroup instead")
KGE_DEPRECATED("ActionSpawn is deprecated, use ActionGroup instead")
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) {}
virtual ~ActionSpawn() {}

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,7 @@
#include "ActionTween.h"
#include "Animation.h"
namespace easy2d
namespace kiwano
{
struct ActionHelper
{
@ -100,13 +100,13 @@ namespace easy2d
static inline TweenHelper
MoveBy(Point const& vector)
{
return TweenHelper(new easy2d::ActionMoveBy(0, vector));
return TweenHelper(new kiwano::ActionMoveBy(0, vector));
}
static inline TweenHelper
MoveTo(Point const& pos)
{
return TweenHelper(new easy2d::ActionMoveTo(0, pos));
return TweenHelper(new kiwano::ActionMoveTo(0, pos));
}
static inline TweenHelper
@ -115,7 +115,7 @@ namespace easy2d
float height, /* 跳跃高度 */
int jumps = 1) /* 跳跃次数 */
{
return TweenHelper(new easy2d::ActionJumpBy(0, pos, height, jumps));
return TweenHelper(new kiwano::ActionJumpBy(0, pos, height, jumps));
}
static inline TweenHelper
@ -124,67 +124,67 @@ namespace easy2d
float height, /* 跳跃高度 */
int jumps = 1) /* 跳跃次数 */
{
return TweenHelper(new easy2d::ActionJumpTo(0, pos, height, jumps));
return TweenHelper(new kiwano::ActionJumpTo(0, pos, height, jumps));
}
static inline TweenHelper
ScaleBy(float scale)
{
return TweenHelper(new easy2d::ActionScaleBy(0, scale));
return TweenHelper(new kiwano::ActionScaleBy(0, scale));
}
static inline TweenHelper
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
ScaleTo(float scale)
{
return TweenHelper(new easy2d::ActionScaleTo(0, scale));
return TweenHelper(new kiwano::ActionScaleTo(0, scale));
}
static inline TweenHelper
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
OpacityBy(float opacity)
{
return TweenHelper(new easy2d::ActionOpacityBy(0, opacity));
return TweenHelper(new kiwano::ActionOpacityBy(0, opacity));
}
static inline TweenHelper
OpacityTo(float opacity)
{
return TweenHelper(new easy2d::ActionOpacityTo(0, opacity));
return TweenHelper(new kiwano::ActionOpacityTo(0, opacity));
}
static inline TweenHelper
FadeIn(Duration dur)
{
return TweenHelper(new easy2d::ActionFadeIn(dur));
return TweenHelper(new kiwano::ActionFadeIn(dur));
}
static inline TweenHelper
FadeOut(Duration dur)
{
return TweenHelper(new easy2d::ActionFadeOut(dur));
return TweenHelper(new kiwano::ActionFadeOut(dur));
}
static inline TweenHelper
RotateBy(float rotation)
{
return TweenHelper(new easy2d::ActionRotateBy(0, rotation));
return TweenHelper(new kiwano::ActionRotateBy(0, rotation));
}
static inline TweenHelper
RotateTo(float rotation)
{
return TweenHelper(new easy2d::ActionRotateTo(0, rotation));
return TweenHelper(new kiwano::ActionRotateTo(0, rotation));
}
static inline TweenHelper
@ -194,39 +194,39 @@ namespace easy2d
float start = 0.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
Animation(FramesPtr const& frames)
{
return TweenHelper(new easy2d::Animation(0, frames));
return TweenHelper(new kiwano::Animation(0, frames));
}
static inline ActionHelper
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
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
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
Spawn(Array<ActionPtr> const& actions)
{
return ActionHelper(new easy2d::ActionGroup(actions, false));
return ActionHelper(new kiwano::ActionGroup(actions, false));
}
};
}

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#include "ActionManager.h"
#include "../base/logs.h"
namespace easy2d
namespace kiwano
{
void ActionManager::UpdateActions(NodePtr const& target, Duration dt)
{
@ -43,7 +43,7 @@ namespace easy2d
ActionPtr ActionManager::AddAction(ActionPtr const& action)
{
E2D_ASSERT(action && "AddAction failed, NULL pointer exception");
KGE_ASSERT(action && "AddAction failed, NULL pointer exception");
if (action)
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,9 +21,9 @@
#pragma once
#include "Action.h"
namespace easy2d
namespace kiwano
{
class E2D_API ActionManager
class KGE_API ActionManager
{
using Actions = IntrusiveList<ActionPtr>;

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@
#include "include-forwards.h"
#include "Node.h"
namespace easy2d
namespace kiwano
{
//-------------------------------------------------------
// Ease Functions

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,7 @@
#include "Geometry.h" // ActionPath
#include "../base/logs.h"
namespace easy2d
namespace kiwano
{
// 缓动函数
using EaseFunc = Closure<float(float)>;
@ -32,37 +32,37 @@ namespace easy2d
// See https://easings.net for more information
struct Ease
{
static E2D_API EaseFunc Linear; // 线性
static E2D_API EaseFunc EaseIn; // 由慢变快
static E2D_API EaseFunc EaseOut; // 由快变慢
static E2D_API EaseFunc EaseInOut; // 由慢变快, 再由快变慢
static E2D_API EaseFunc ExpoIn; // 由慢变极快
static E2D_API EaseFunc ExpoOut; // 由极快变慢
static E2D_API EaseFunc ExpoInOut; // 由慢至极快, 再由极快边慢
static E2D_API EaseFunc ElasticIn; // 自起点赋予弹性
static E2D_API EaseFunc ElasticOut; // 自终点赋予弹性
static E2D_API EaseFunc ElasticInOut; // 再起点和终点赋予弹性
static E2D_API EaseFunc BounceIn; // 自起点赋予反弹力
static E2D_API EaseFunc BounceOut; // 自终点赋予反弹力
static E2D_API EaseFunc BounceInOut; // 在起点和终点赋予反弹力
static E2D_API EaseFunc BackIn;
static E2D_API EaseFunc BackOut;
static E2D_API EaseFunc BackInOut;
static E2D_API EaseFunc QuadIn;
static E2D_API EaseFunc QuadOut;
static E2D_API EaseFunc QuadInOut;
static E2D_API EaseFunc CubicIn;
static E2D_API EaseFunc CubicOut;
static E2D_API EaseFunc CubicInOut;
static E2D_API EaseFunc QuartIn;
static E2D_API EaseFunc QuartOut;
static E2D_API EaseFunc QuartInOut;
static E2D_API EaseFunc QuintIn;
static E2D_API EaseFunc QuintOut;
static E2D_API EaseFunc QuintInOut;
static E2D_API EaseFunc SineIn;
static E2D_API EaseFunc SineOut;
static E2D_API EaseFunc SineInOut;
static KGE_API EaseFunc Linear; // 线性
static KGE_API EaseFunc EaseIn; // 由慢变快
static KGE_API EaseFunc EaseOut; // 由快变慢
static KGE_API EaseFunc EaseInOut; // 由慢变快, 再由快变慢
static KGE_API EaseFunc ExpoIn; // 由慢变极快
static KGE_API EaseFunc ExpoOut; // 由极快变慢
static KGE_API EaseFunc ExpoInOut; // 由慢至极快, 再由极快边慢
static KGE_API EaseFunc ElasticIn; // 自起点赋予弹性
static KGE_API EaseFunc ElasticOut; // 自终点赋予弹性
static KGE_API EaseFunc ElasticInOut; // 再起点和终点赋予弹性
static KGE_API EaseFunc BounceIn; // 自起点赋予反弹力
static KGE_API EaseFunc BounceOut; // 自终点赋予反弹力
static KGE_API EaseFunc BounceInOut; // 在起点和终点赋予反弹力
static KGE_API EaseFunc BackIn;
static KGE_API EaseFunc BackOut;
static KGE_API EaseFunc BackInOut;
static KGE_API EaseFunc QuadIn;
static KGE_API EaseFunc QuadOut;
static KGE_API EaseFunc QuadInOut;
static KGE_API EaseFunc CubicIn;
static KGE_API EaseFunc CubicOut;
static KGE_API EaseFunc CubicInOut;
static KGE_API EaseFunc QuartIn;
static KGE_API EaseFunc QuartOut;
static KGE_API EaseFunc QuartInOut;
static KGE_API EaseFunc QuintIn;
static KGE_API EaseFunc QuintOut;
static KGE_API EaseFunc QuintInOut;
static KGE_API EaseFunc SineIn;
static KGE_API EaseFunc SineOut;
static KGE_API EaseFunc SineInOut;
};
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:
@ -108,7 +108,7 @@ namespace easy2d
// 相对位移动作
class E2D_API ActionMoveBy
class KGE_API ActionMoveBy
: public ActionTween
{
public:
@ -137,7 +137,7 @@ namespace easy2d
// 位移动作
class E2D_API ActionMoveTo
class KGE_API ActionMoveTo
: public ActionMoveBy
{
public:
@ -153,7 +153,7 @@ namespace easy2d
// 获取该动作的倒转
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;
}
@ -166,7 +166,7 @@ namespace easy2d
// 相对跳跃动作
class E2D_API ActionJumpBy
class KGE_API ActionJumpBy
: public ActionTween
{
public:
@ -199,7 +199,7 @@ namespace easy2d
// 跳跃动作
class E2D_API ActionJumpTo
class KGE_API ActionJumpTo
: public ActionJumpBy
{
public:
@ -217,7 +217,7 @@ namespace easy2d
// 获取该动作的倒转
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;
}
@ -230,7 +230,7 @@ namespace easy2d
// 相对缩放动作
class E2D_API ActionScaleBy
class KGE_API ActionScaleBy
: public ActionTween
{
public:
@ -267,7 +267,7 @@ namespace easy2d
// 缩放动作
class E2D_API ActionScaleTo
class KGE_API ActionScaleTo
: public ActionScaleBy
{
public:
@ -290,7 +290,7 @@ namespace easy2d
// 获取该动作的倒转
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;
}
@ -304,7 +304,7 @@ namespace easy2d
// 透明度相对渐变动作
class E2D_API ActionOpacityBy
class KGE_API ActionOpacityBy
: public ActionTween
{
public:
@ -332,7 +332,7 @@ namespace easy2d
// 透明度渐变动作
class E2D_API ActionOpacityTo
class KGE_API ActionOpacityTo
: public ActionOpacityBy
{
public:
@ -348,7 +348,7 @@ namespace easy2d
// 获取该动作的倒转
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;
}
@ -361,7 +361,7 @@ namespace easy2d
// 淡入动作
class E2D_API ActionFadeIn
class KGE_API ActionFadeIn
: public ActionOpacityTo
{
public:
@ -374,7 +374,7 @@ namespace easy2d
// 淡出动作
class E2D_API ActionFadeOut
class KGE_API ActionFadeOut
: public ActionOpacityTo
{
public:
@ -387,7 +387,7 @@ namespace easy2d
// 相对旋转动作
class E2D_API ActionRotateBy
class KGE_API ActionRotateBy
: public ActionTween
{
public:
@ -415,7 +415,7 @@ namespace easy2d
// 旋转动作
class E2D_API ActionRotateTo
class KGE_API ActionRotateTo
: public ActionRotateBy
{
public:
@ -431,7 +431,7 @@ namespace easy2d
// 获取该动作的倒转
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;
}
@ -444,7 +444,7 @@ namespace easy2d
// 路径动作
class E2D_API ActionPath
class KGE_API ActionPath
: public ActionTween
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,7 @@
#include "Image.h"
#include "Sprite.h"
namespace easy2d
namespace kiwano
{
Animation::Animation()
: frames_(nullptr)
@ -70,7 +70,7 @@ namespace easy2d
{
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();
int size = frames.size();

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,10 +21,10 @@
#pragma once
#include "ActionTween.h"
namespace easy2d
namespace kiwano
{
// 帧动画
class E2D_API Animation
class KGE_API Animation
: public ActionTween
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -24,7 +24,7 @@
#include "../base/logs.h"
#include "../renderer/render.h"
namespace easy2d
namespace kiwano
{
Canvas::Canvas()
: cache_expired_(false)
@ -489,7 +489,7 @@ namespace easy2d
return image;
}
ComPtr<ID2D1Bitmap> const& easy2d::Canvas::GetBitmap() const
ComPtr<ID2D1Bitmap> const& kiwano::Canvas::GetBitmap() const
{
if (cache_expired_)
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -26,10 +26,10 @@
#undef DrawText
namespace easy2d
namespace kiwano
{
// »­²¼
class E2D_API Canvas
class KGE_API Canvas
: public VisualNode
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -20,7 +20,7 @@
#include "Color.h"
namespace easy2d
namespace kiwano
{
namespace
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#pragma once
#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);
// 使用一个 unsigned int 类型的值表示 RGB: Color black(0x000000);
//
class E2D_API Color
class KGE_API Color
{
public:
Color();

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -26,7 +26,7 @@
#pragma comment(lib, "psapi.lib")
namespace easy2d
namespace kiwano
{
DebugNode::DebugNode()
{
@ -61,7 +61,7 @@ namespace easy2d
void DebugNode::OnUpdate(Duration dt)
{
E2D_NOT_USED(dt);
KGE_NOT_USED(dt);
frame_time_.push_back(Time::Now());
while (frame_time_.back() - frame_time_.front() >= time::Sec)
@ -72,7 +72,7 @@ namespace easy2d
std::wstringstream ss;
ss << "Fps: " << frame_time_.size() << std::endl;
#ifdef E2D_DEBUG
#ifdef KGE_DEBUG
ss << "Objects: " << Object::__GetTracingObjects().size() << std::endl;
#endif

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,9 +21,9 @@
#pragma once
#include "Node.h"
namespace easy2d
namespace kiwano
{
class E2D_API DebugNode
class KGE_API DebugNode
: public Node
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#pragma once
#include <string>
namespace easy2d
namespace kiwano
{
// ×ÖÌå´Öϸֵ
enum FontWeight : unsigned int

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@
#include "Image.h"
#include "../base/logs.h"
namespace easy2d
namespace kiwano
{
Frames::Frames()
{
@ -39,7 +39,7 @@ namespace easy2d
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)
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,10 +21,10 @@
#pragma once
#include "include-forwards.h"
namespace easy2d
namespace kiwano
{
// ÐòÁÐÖ¡
class E2D_API Frames
class KGE_API Frames
: public virtual Object
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@
#include "../renderer/render.h"
#include "../base/logs.h"
namespace easy2d
namespace kiwano
{
//-------------------------------------------------------
// Geometry

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,10 +22,10 @@
#include "include-forwards.h"
#include <d2d1.h>
namespace easy2d
namespace kiwano
{
// 섯부녜蹶
class E2D_API Geometry
class KGE_API Geometry
: public virtual Object
{
friend class Canvas;
@ -63,7 +63,7 @@ namespace easy2d
// 殮窟
class E2D_API LineGeometry
class KGE_API LineGeometry
: public Geometry
{
public:
@ -100,7 +100,7 @@ namespace easy2d
// 섯부앤近
class E2D_API RectangleGeometry
class KGE_API RectangleGeometry
: public Geometry
{
public:
@ -127,7 +127,7 @@ namespace easy2d
// 섯부途近
class E2D_API CircleGeometry
class KGE_API CircleGeometry
: public Geometry
{
public:
@ -164,7 +164,7 @@ namespace easy2d
// 섯부哭途
class E2D_API EllipseGeometry
class KGE_API EllipseGeometry
: public Geometry
{
public:
@ -207,7 +207,7 @@ namespace easy2d
// 섯부쨌쓺
class E2D_API PathGeometry
class KGE_API PathGeometry
: public Geometry
{
public:
@ -261,7 +261,7 @@ namespace easy2d
// 섯부途실앤近
class E2D_API RoundedRectGeometry
class KGE_API RoundedRectGeometry
: public Geometry
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#include "GeometryNode.h"
#include "../renderer/render.h"
namespace easy2d
namespace kiwano
{
GeometryNode::GeometryNode()
: fill_color_(Color::White)

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,10 +22,10 @@
#include "Geometry.h"
#include "Node.h"
namespace easy2d
namespace kiwano
{
// 섯부暠近
class E2D_API GeometryNode
class KGE_API GeometryNode
: public VisualNode
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,7 @@
#include "../renderer/render.h"
#include "../platform/modules.h"
namespace easy2d
namespace kiwano
{
Image::Image()
: bitmap_(nullptr)
@ -63,7 +63,7 @@ namespace easy2d
{
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;
}
hr = Renderer::Instance().GetDeviceResources()->CreateBitmapFromFile(bitmap, res.GetFileName());
@ -75,7 +75,7 @@ namespace easy2d
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;
}

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -23,10 +23,10 @@
#include "../base/Resource.h"
#include <d2d1.h>
namespace easy2d
namespace kiwano
{
// ͼƬ
class E2D_API Image
class KGE_API Image
: public virtual Object
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@
#include "Layer.h"
#include "../renderer/render.h"
namespace easy2d
namespace kiwano
{
Layer::Layer()
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,9 +21,9 @@
#pragma once
#include "Node.h"
namespace easy2d
namespace kiwano
{
class E2D_API Layer
class KGE_API Layer
: public Node
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -24,7 +24,7 @@
#include "../base/logs.h"
#include "../renderer/render.h"
namespace easy2d
namespace kiwano
{
namespace
{
@ -453,20 +453,20 @@ namespace easy2d
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)
{
#ifdef E2D_DEBUG
#ifdef KGE_DEBUG
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_)
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);
child->parent_ = this;
@ -544,7 +544,7 @@ namespace easy2d
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())
return;

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -25,12 +25,12 @@
#include "../base/TimerManager.h"
#include "../base/EventDispatcher.h"
namespace easy2d
namespace kiwano
{
class Application;
// 节点
class E2D_API Node
class KGE_API Node
: public virtual Object
, public TimerManager
, public ActionManager
@ -48,7 +48,7 @@ namespace easy2d
Node();
// 更新节点
virtual void OnUpdate(Duration dt) { E2D_NOT_USED(dt); }
virtual void OnUpdate(Duration dt) { KGE_NOT_USED(dt); }
// 渲染节点
virtual void OnRender() {}
@ -431,7 +431,7 @@ namespace easy2d
// 可视化节点
class E2D_API VisualNode
class KGE_API VisualNode
: public Node
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@
#include "../base/logs.h"
#include "../renderer/render.h"
namespace easy2d
namespace kiwano
{
Scene::Scene()
: mouse_cursor_(MouseCursor::Arrow)
@ -39,12 +39,12 @@ namespace easy2d
void Scene::OnEnter()
{
E2D_LOG(L"Scene entered");
KGE_LOG(L"Scene entered");
}
void Scene::OnExit()
{
E2D_LOG(L"Scene exited");
KGE_LOG(L"Scene exited");
}
void Scene::Update(Duration dt)

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,10 +21,10 @@
#pragma once
#include "Node.h"
namespace easy2d
namespace kiwano
{
// ³¡¾°
class E2D_API Scene
class KGE_API Scene
: public Node
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#include "Sprite.h"
#include "../renderer/render.h"
namespace easy2d
namespace kiwano
{
Sprite::Sprite()
: image_(nullptr)

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,10 +22,10 @@
#include "Node.h"
#include "Image.h"
namespace easy2d
namespace kiwano
{
// ¾«Áé
class E2D_API Sprite
class KGE_API Sprite
: public VisualNode
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@
#include "../base/logs.h"
#include "../renderer/render.h"
namespace easy2d
namespace kiwano
{
namespace
{
@ -30,12 +30,12 @@ namespace easy2d
TextStyle text_default_style;
}
void easy2d::Text::SetDefaultFont(Font const & font)
void kiwano::Text::SetDefaultFont(Font const & font)
{
text_default_font = font;
}
void easy2d::Text::SetDefaultStyle(TextStyle const & style)
void kiwano::Text::SetDefaultStyle(TextStyle const & style)
{
text_default_style = style;
}

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -24,10 +24,10 @@
#include "TextStyle.hpp"
#include <dwrite.h>
namespace easy2d
namespace kiwano
{
// Îı¾
class E2D_API Text
class KGE_API Text
: public VisualNode
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#pragma once
#include "include-forwards.h"
namespace easy2d
namespace kiwano
{
// 文本对齐方式
enum class TextAlign
@ -32,7 +32,7 @@ namespace easy2d
};
// 文本样式
class E2D_API TextStyle
class KGE_API TextStyle
{
public:
Color color; // 颜色

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#pragma once
#include "../math/Matrix.hpp"
namespace easy2d
namespace kiwano
{
class Transform
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -25,7 +25,7 @@
#include "../base/logs.h"
#include "../renderer/render.h"
namespace easy2d
namespace kiwano
{
//-------------------------------------------------------
// Transition

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,12 +22,12 @@
#include "include-forwards.h"
#include <d2d1.h>
namespace easy2d
namespace kiwano
{
class Scene;
// 场景过渡
class E2D_API Transition
class KGE_API Transition
: public virtual Object
{
friend class Application;

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -31,58 +31,58 @@
#include "../base/Object.h"
#include "../math/helper.h"
namespace easy2d
namespace kiwano
{
E2D_DECLARE_SMART_PTR(Image);
E2D_DECLARE_SMART_PTR(Frames);
KGE_DECLARE_SMART_PTR(Image);
KGE_DECLARE_SMART_PTR(Frames);
E2D_DECLARE_SMART_PTR(Geometry);
E2D_DECLARE_SMART_PTR(LineGeometry);
E2D_DECLARE_SMART_PTR(RectangleGeometry);
E2D_DECLARE_SMART_PTR(RoundedRectGeometry);
E2D_DECLARE_SMART_PTR(CircleGeometry);
E2D_DECLARE_SMART_PTR(EllipseGeometry);
E2D_DECLARE_SMART_PTR(PathGeometry);
KGE_DECLARE_SMART_PTR(Geometry);
KGE_DECLARE_SMART_PTR(LineGeometry);
KGE_DECLARE_SMART_PTR(RectangleGeometry);
KGE_DECLARE_SMART_PTR(RoundedRectGeometry);
KGE_DECLARE_SMART_PTR(CircleGeometry);
KGE_DECLARE_SMART_PTR(EllipseGeometry);
KGE_DECLARE_SMART_PTR(PathGeometry);
E2D_DECLARE_SMART_PTR(Node);
E2D_DECLARE_SMART_PTR(Scene);
E2D_DECLARE_SMART_PTR(Layer);
E2D_DECLARE_SMART_PTR(Sprite);
E2D_DECLARE_SMART_PTR(Text);
E2D_DECLARE_SMART_PTR(Canvas);
E2D_DECLARE_SMART_PTR(GeometryNode);
KGE_DECLARE_SMART_PTR(Node);
KGE_DECLARE_SMART_PTR(Scene);
KGE_DECLARE_SMART_PTR(Layer);
KGE_DECLARE_SMART_PTR(Sprite);
KGE_DECLARE_SMART_PTR(Text);
KGE_DECLARE_SMART_PTR(Canvas);
KGE_DECLARE_SMART_PTR(GeometryNode);
E2D_DECLARE_SMART_PTR(Action);
E2D_DECLARE_SMART_PTR(ActionTween);
E2D_DECLARE_SMART_PTR(ActionMoveBy);
E2D_DECLARE_SMART_PTR(ActionMoveTo);
E2D_DECLARE_SMART_PTR(ActionJumpBy);
E2D_DECLARE_SMART_PTR(ActionJumpTo);
E2D_DECLARE_SMART_PTR(ActionScaleBy);
E2D_DECLARE_SMART_PTR(ActionScaleTo);
E2D_DECLARE_SMART_PTR(ActionOpacityBy);
E2D_DECLARE_SMART_PTR(ActionOpacityTo);
E2D_DECLARE_SMART_PTR(ActionFadeIn);
E2D_DECLARE_SMART_PTR(ActionFadeOut);
E2D_DECLARE_SMART_PTR(ActionRotateBy);
E2D_DECLARE_SMART_PTR(ActionRotateTo);
E2D_DECLARE_SMART_PTR(ActionPath);
E2D_DECLARE_SMART_PTR(Animation);
E2D_DECLARE_SMART_PTR(ActionGroup);
E2D_DECLARE_SMART_PTR(ActionSpawn);
KGE_DECLARE_SMART_PTR(Action);
KGE_DECLARE_SMART_PTR(ActionTween);
KGE_DECLARE_SMART_PTR(ActionMoveBy);
KGE_DECLARE_SMART_PTR(ActionMoveTo);
KGE_DECLARE_SMART_PTR(ActionJumpBy);
KGE_DECLARE_SMART_PTR(ActionJumpTo);
KGE_DECLARE_SMART_PTR(ActionScaleBy);
KGE_DECLARE_SMART_PTR(ActionScaleTo);
KGE_DECLARE_SMART_PTR(ActionOpacityBy);
KGE_DECLARE_SMART_PTR(ActionOpacityTo);
KGE_DECLARE_SMART_PTR(ActionFadeIn);
KGE_DECLARE_SMART_PTR(ActionFadeOut);
KGE_DECLARE_SMART_PTR(ActionRotateBy);
KGE_DECLARE_SMART_PTR(ActionRotateTo);
KGE_DECLARE_SMART_PTR(ActionPath);
KGE_DECLARE_SMART_PTR(Animation);
KGE_DECLARE_SMART_PTR(ActionGroup);
KGE_DECLARE_SMART_PTR(ActionSpawn);
E2D_DECLARE_SMART_PTR(Transition);
E2D_DECLARE_SMART_PTR(FadeTransition);
E2D_DECLARE_SMART_PTR(EmergeTransition);
E2D_DECLARE_SMART_PTR(BoxTransition);
E2D_DECLARE_SMART_PTR(MoveTransition);
E2D_DECLARE_SMART_PTR(RotationTransition);
KGE_DECLARE_SMART_PTR(Transition);
KGE_DECLARE_SMART_PTR(FadeTransition);
KGE_DECLARE_SMART_PTR(EmergeTransition);
KGE_DECLARE_SMART_PTR(BoxTransition);
KGE_DECLARE_SMART_PTR(MoveTransition);
KGE_DECLARE_SMART_PTR(RotationTransition);
E2D_DECLARE_SMART_PTR(Button);
E2D_DECLARE_SMART_PTR(Menu);
KGE_DECLARE_SMART_PTR(Button);
KGE_DECLARE_SMART_PTR(Menu);
}
namespace easy2d
namespace kiwano
{
// »­±ÊÑùʽ
enum class StrokeStyle : int

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="easy2d.h" />
<ClInclude Include="kiwano.h" />
<ClInclude Include="config.h" />
<ClInclude Include="macros.h" />
<ClInclude Include="easy2d-audio.h" />
<ClInclude Include="easy2d-imgui.h" />
<ClInclude Include="easy2d-network.h" />
<ClInclude Include="kiwano-audio.h" />
<ClInclude Include="kiwano-imgui.h" />
<ClInclude Include="kiwano-network.h" />
<ClInclude Include="audio\audio-modules.h" />
<ClInclude Include="audio\audio.h" />
<ClInclude Include="audio\Music.h" />
@ -177,7 +177,7 @@
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}</ProjectGuid>
<RootNamespace>Easy2D</RootNamespace>
<RootNamespace>Kiwano</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

View File

@ -245,7 +245,7 @@
<ClInclude Include="base\Object.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="easy2d.h" />
<ClInclude Include="kiwano.h" />
<ClInclude Include="utils\DataUtil.h">
<Filter>utils</Filter>
</ClInclude>
@ -300,9 +300,9 @@
<ClInclude Include="imgui\ImGuiView.h">
<Filter>imgui</Filter>
</ClInclude>
<ClInclude Include="easy2d-audio.h" />
<ClInclude Include="easy2d-imgui.h" />
<ClInclude Include="easy2d-network.h" />
<ClInclude Include="kiwano-audio.h" />
<ClInclude Include="kiwano-imgui.h" />
<ClInclude Include="kiwano-network.h" />
<ClInclude Include="third-party\ImGui\imconfig.h">
<Filter>third-party\ImGui</Filter>
</ClInclude>

View File

@ -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
// 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
// THE SOFTWARE.
#include "../easy2d-audio.h"
#include "../kiwano-audio.h"
#include "Music.h"
#include "Transcoder.h"
namespace easy2d
namespace kiwano
{
Music::Music()
: opened_(false)
@ -58,7 +58,7 @@ namespace easy2d
{
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;
}
hr = transcoder.LoadMediaFile(res.GetFileName(), &wave_data_, &size_);
@ -70,7 +70,7 @@ namespace easy2d
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;
}
@ -82,7 +82,7 @@ namespace easy2d
delete[] wave_data_;
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;
}
@ -94,7 +94,7 @@ namespace easy2d
{
if (!opened_)
{
E2D_ERROR_LOG(L"Music must be opened first!");
KGE_ERROR_LOG(L"Music must be opened first!");
return false;
}
@ -111,7 +111,7 @@ namespace easy2d
HRESULT hr = voice_.Play(wave_data_, size_, static_cast<UINT32>(loop_count));
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);

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,12 +21,12 @@
#pragma once
#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:

View File

@ -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
// 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
// THE SOFTWARE.
#include "../easy2d-audio.h"
#include "../kiwano-audio.h"
#include "Player.h"
namespace easy2d
namespace kiwano
{
Player::Player()
: volume_(1.f)

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -20,12 +20,12 @@
#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
{
using MusicMap = Map<size_t, MusicPtr>;

View File

@ -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
// 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
#endif
#include "../easy2d-audio.h"
#include "../kiwano-audio.h"
#include "Transcoder.h"
#include "audio-modules.h"
namespace easy2d
namespace kiwano
{
Transcoder::Transcoder()
: wave_format_(nullptr)
@ -86,7 +86,7 @@ namespace easy2d
if (stream == nullptr)
{
E2D_ERROR_LOG(L"SHCreateMemStream failed");
KGE_ERROR_LOG(L"SHCreateMemStream failed");
return E_OUTOFMEMORY;
}
@ -203,7 +203,7 @@ namespace easy2d
if (data == nullptr)
{
E2D_ERROR_LOG(L"Low memory");
KGE_ERROR_LOG(L"Low memory");
hr = E_OUTOFMEMORY;
}
else

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -23,9 +23,9 @@
#include <mfidl.h>
#include <mfreadwrite.h>
namespace easy2d
namespace kiwano
{
class E2D_API Transcoder
class KGE_API Transcoder
{
WAVEFORMATEX* wave_format_;

View File

@ -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
// 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
// THE SOFTWARE.
#include "../easy2d-audio.h"
#include "../kiwano-audio.h"
#include "Voice.h"
namespace easy2d
namespace kiwano
{
Voice::Voice()
: source_voice_(nullptr)

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,9 +21,9 @@
#pragma once
#include <xaudio2.h>
namespace easy2d
namespace kiwano
{
class E2D_API Voice
class KGE_API Voice
: protected Noncopyable
{
public:

View File

@ -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
// 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
// THE SOFTWARE.
#include "../easy2d-audio.h"
#include "../kiwano-audio.h"
#include "audio-modules.h"
namespace easy2d
namespace kiwano
{
namespace modules
{
@ -47,7 +47,7 @@ namespace easy2d
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");
}
}
@ -74,7 +74,7 @@ namespace easy2d
}
else
{
E2D_LOG(L"Load Mfplat.dll failed");
KGE_LOG(L"Load Mfplat.dll failed");
throw std::runtime_error("Load Mfplat.dll failed");
}
@ -89,7 +89,7 @@ namespace easy2d
}
else
{
E2D_LOG(L"Load Mfreadwrite.dll failed");
KGE_LOG(L"Load Mfreadwrite.dll failed");
throw std::runtime_error("Load Mfreadwrite.dll failed");
}
}

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -24,11 +24,11 @@
#include <mfidl.h>
#include <mfreadwrite.h>
namespace easy2d
namespace kiwano
{
namespace modules
{
class E2D_API XAudio2
class KGE_API XAudio2
{
XAudio2();
@ -48,7 +48,7 @@ namespace easy2d
};
class E2D_API MediaFoundation
class KGE_API MediaFoundation
{
MediaFoundation();

View File

@ -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
// 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
// THE SOFTWARE.
#include "../easy2d-audio.h"
#include "../kiwano-audio.h"
#include "audio.h"
#include "audio-modules.h"
namespace easy2d
namespace kiwano
{
Audio::Audio()
: x_audio2_(nullptr)
@ -36,7 +36,7 @@ namespace easy2d
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);
@ -55,7 +55,7 @@ namespace easy2d
void Audio::DestroyComponent()
{
E2D_LOG(L"Destroying audio resources");
KGE_LOG(L"Destroying audio resources");
ClearVoiceCache();

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,13 +21,13 @@
#pragma once
#include "Voice.h"
namespace easy2d
namespace kiwano
{
class E2D_API Audio
class KGE_API Audio
: public Singleton<Audio>
, public Component
{
E2D_DECLARE_SINGLETON(Audio);
KGE_DECLARE_SINGLETON(Audio);
using VoiceMap = UnorderedSet<Voice*>;

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,7 @@
#include "../platform/Application.h"
#include <thread>
namespace easy2d
namespace kiwano
{
//
// AsyncTask

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -26,9 +26,9 @@
#include <functional>
#include <mutex>
namespace easy2d
namespace kiwano
{
E2D_DECLARE_SMART_PTR(AsyncTask);
KGE_DECLARE_SMART_PTR(AsyncTask);
typedef Closure<void()> AsyncTaskFunc;
typedef Closure<void()> AsyncTaskCallback;
@ -68,7 +68,7 @@ namespace easy2d
: public Singleton<AsyncTaskThread>
, public Component
{
E2D_DECLARE_SINGLETON(AsyncTaskThread);
KGE_DECLARE_SINGLETON(AsyncTaskThread);
public:
virtual void SetupComponent(Application*);

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -20,7 +20,7 @@
#pragma once
namespace easy2d
namespace kiwano
{
class Application;

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#pragma once
#include "keys.hpp"
namespace easy2d
namespace kiwano
{
// 鼠标事件
@ -108,7 +108,7 @@ namespace easy2d
class Node;
// 事件
struct E2D_API Event
struct KGE_API Event
{
enum Type : UINT
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#include "EventDispatcher.h"
#include "../base/logs.h"
namespace easy2d
namespace kiwano
{
void EventDispatcher::Dispatch(Event& evt)
{
@ -42,7 +42,7 @@ namespace easy2d
EventListenerPtr EventDispatcher::AddListener(EventListenerPtr const & listener)
{
E2D_ASSERT(listener && "AddListener failed, NULL pointer exception");
KGE_ASSERT(listener && "AddListener failed, NULL pointer exception");
if (listener)
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,9 +21,9 @@
#pragma once
#include "EventListener.h"
namespace easy2d
namespace kiwano
{
class E2D_API EventDispatcher
class KGE_API EventDispatcher
{
using Listeners = IntrusiveList<EventListenerPtr>;

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#pragma once
#include "EventListener.h"
namespace easy2d
namespace kiwano
{
EventListener::EventListener(UINT type, EventCallback const & callback, String const & name)
: type_(type)

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -27,16 +27,16 @@
#include "Event.hpp"
#include <functional>
namespace easy2d
namespace kiwano
{
typedef Closure<void(Event const&)> EventCallback;
class EventDispatcher;
E2D_DECLARE_SMART_PTR(EventListener);
KGE_DECLARE_SMART_PTR(EventListener);
// ʼþ¼àÌýÆ÷
class E2D_API EventListener
class KGE_API EventListener
: public virtual Object
, protected IntrusiveListItem<EventListenerPtr>
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@
#include "logs.h"
#include <cstring>
namespace easy2d
namespace kiwano
{
Input::Input()
: want_update_(false)
@ -69,19 +69,19 @@ namespace easy2d
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];
}
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];
}
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];
}

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -25,13 +25,13 @@
#include "keys.hpp"
#include "Component.h"
namespace easy2d
namespace kiwano
{
class E2D_API Input
class KGE_API Input
: public Singleton<Input>
, public Component
{
E2D_DECLARE_SINGLETON(Input);
KGE_DECLARE_SINGLETON(Input);
public:
// 检测键盘或鼠标按键是否正被按下

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@
#include "logs.h"
#include <typeinfo>
namespace easy2d
namespace kiwano
{
namespace
{
@ -38,7 +38,7 @@ namespace easy2d
, name_(nullptr)
, id_(++last_object_id)
{
#ifdef E2D_DEBUG
#ifdef KGE_DEBUG
Object::__AddObjectToTracingList(this);
@ -50,7 +50,7 @@ namespace easy2d
if (name_)
delete name_;
#ifdef E2D_DEBUG
#ifdef KGE_DEBUG
Object::__RemoveObjectFromTracingList(this);
@ -107,22 +107,22 @@ namespace easy2d
void Object::DumpTracingObjects()
{
E2D_LOG(L"-------------------------- All Objects --------------------------");
KGE_LOG(L"-------------------------- All 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;
}
void Object::__AddObjectToTracingList(Object * obj)
{
#ifdef E2D_DEBUG
#ifdef KGE_DEBUG
if (tracing_leaks && !obj->tracing_leak_)
{
@ -135,7 +135,7 @@ namespace easy2d
void Object::__RemoveObjectFromTracingList(Object * obj)
{
#ifdef E2D_DEBUG
#ifdef KGE_DEBUG
if (tracing_leaks && obj->tracing_leak_)
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -24,11 +24,11 @@
#include "RefCounter.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:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,9 +22,9 @@
#include "../macros.h"
#include "../common/noncopyable.hpp"
namespace easy2d
namespace kiwano
{
class E2D_API RefCounter
class KGE_API RefCounter
: protected Noncopyable
{
public:

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#include "Resource.h"
#include "../base/logs.h"
namespace easy2d
namespace kiwano
{
Resource::Resource(LPCWSTR file_name)
: type_(Type::File)
@ -95,7 +95,7 @@ namespace easy2d
{
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;
}
@ -105,28 +105,28 @@ namespace easy2d
res_info = FindResourceW(nullptr, bin_name_, bin_type_);
if (res_info == nullptr)
{
E2D_ERROR_LOG(L"FindResource failed");
KGE_ERROR_LOG(L"FindResource failed");
return false;
}
res_data = LoadResource(nullptr, res_info);
if (res_data == nullptr)
{
E2D_ERROR_LOG(L"LoadResource failed");
KGE_ERROR_LOG(L"LoadResource failed");
return false;
}
buffer_size = SizeofResource(nullptr, res_info);
if (buffer_size == 0)
{
E2D_ERROR_LOG(L"SizeofResource failed");
KGE_ERROR_LOG(L"SizeofResource failed");
return false;
}
buffer = LockResource(res_data);
if (buffer == nullptr)
{
E2D_ERROR_LOG(L"LockResource failed");
KGE_ERROR_LOG(L"LockResource failed");
return false;
}
return true;

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@
#include "../macros.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
//
class E2D_API Resource
class KGE_API Resource
{
enum class Type { File, Binary };

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@
#include "../base/RefCounter.hpp"
#include "../common/IntrusivePtr.hpp"
namespace easy2d
namespace kiwano
{
struct DefaultIntrusivePtrManager
{
@ -42,8 +42,8 @@ namespace easy2d
}
#ifndef E2D_DECLARE_SMART_PTR
#define E2D_DECLARE_SMART_PTR(CLASS)\
#ifndef KGE_DECLARE_SMART_PTR
#define KGE_DECLARE_SMART_PTR(CLASS)\
class CLASS;\
using CLASS##Ptr = ::easy2d::SmartPtr< CLASS >
using CLASS##Ptr = ::kiwano::SmartPtr< CLASS >
#endif

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -20,7 +20,7 @@
#include "Timer.h"
namespace easy2d
namespace kiwano
{
Timer::Timer(Callback const& func, String const& name)
: Timer(func, Duration{}, -1, name)

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -26,14 +26,14 @@
#include "time.h"
#include <functional>
namespace easy2d
namespace kiwano
{
class TimerManager;
E2D_DECLARE_SMART_PTR(Timer);
KGE_DECLARE_SMART_PTR(Timer);
// 定时任务
class E2D_API Timer
class KGE_API Timer
: public virtual Object
, protected IntrusiveListItem<TimerPtr>
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#include "TimerManager.h"
#include "../base/logs.h"
namespace easy2d
namespace kiwano
{
void TimerManager::UpdateTimers(Duration dt)
{
@ -43,7 +43,7 @@ namespace easy2d
void TimerManager::AddTimer(TimerPtr const& timer)
{
E2D_ASSERT(timer && "AddTimer failed, NULL pointer exception");
KGE_ASSERT(timer && "AddTimer failed, NULL pointer exception");
if (timer)
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,9 +21,9 @@
#pragma once
#include "Timer.h"
namespace easy2d
namespace kiwano
{
class E2D_API TimerManager
class KGE_API TimerManager
{
using Timers = IntrusiveList<TimerPtr>;

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#pragma once
#include "../macros.h"
namespace easy2d
namespace kiwano
{
// 報炎梓囚
struct MouseButton

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#include "logs.h"
#include <iostream>
namespace easy2d
namespace kiwano
{
namespace __console_colors
{
@ -197,7 +197,7 @@ namespace easy2d
std::time_t unix = std::time(nullptr);
std::tm tmbuf;
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;
}

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -25,28 +25,28 @@
#include <iomanip>
#include <sstream>
#ifndef E2D_LOG
# ifdef E2D_DEBUG
# define E2D_LOG(FORMAT, ...) easy2d::Logger::Instance().Messagef((FORMAT ## "\n"), __VA_ARGS__)
#ifndef KGE_LOG
# ifdef KGE_DEBUG
# define KGE_LOG(FORMAT, ...) kiwano::Logger::Instance().Messagef((FORMAT ## "\n"), __VA_ARGS__)
# else
# define E2D_LOG __noop
# define KGE_LOG __noop
# endif
#endif
#ifndef E2D_WARNING_LOG
# define E2D_WARNING_LOG(FORMAT, ...) easy2d::Logger::Instance().Warningf((FORMAT ## "\n"), __VA_ARGS__)
#ifndef KGE_WARNING_LOG
# define KGE_WARNING_LOG(FORMAT, ...) kiwano::Logger::Instance().Warningf((FORMAT ## "\n"), __VA_ARGS__)
#endif
#ifndef E2D_ERROR_LOG
# define E2D_ERROR_LOG(FORMAT, ...) easy2d::Logger::Instance().Errorf((FORMAT ## "\n"), __VA_ARGS__)
#ifndef KGE_ERROR_LOG
# define KGE_ERROR_LOG(FORMAT, ...) kiwano::Logger::Instance().Errorf((FORMAT ## "\n"), __VA_ARGS__)
#endif
namespace easy2d
namespace kiwano
{
class E2D_API Logger
class KGE_API Logger
: public Singleton<Logger>
{
E2D_DECLARE_SINGLETON(Logger);
KGE_DECLARE_SINGLETON(Logger);
public:
void Enable();
@ -273,13 +273,13 @@ namespace easy2d
}
}
namespace easy2d
namespace kiwano
{
inline void ThrowIfFailed(HRESULT 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];
sprintf_s(buffer, "Fatal error with HRESULT of %08X", hr);

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,7 @@
#include <regex>
#include <unordered_map>
namespace easy2d
namespace kiwano
{
namespace time
{
@ -67,7 +67,7 @@ namespace easy2d
return Duration(dur_ - other.dur_);
}
Time Time::Now() E2D_NOEXCEPT
Time Time::Now() KGE_NOEXCEPT
{
static LARGE_INTEGER freq = {};
if (freq.QuadPart == 0LL)
@ -139,7 +139,7 @@ namespace easy2d
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())
{
@ -161,12 +161,12 @@ namespace easy2d
if (hour)
{
result.append(easy2d::to_wstring(hour)).append(L"h");
result.append(easy2d::to_wstring(min)).append(L"m");
result.append(kiwano::to_wstring(hour)).append(L"h");
result.append(kiwano::to_wstring(min)).append(L"m");
}
else if(min)
{
result.append(easy2d::to_wstring(min)).append(L"m");
result.append(kiwano::to_wstring(min)).append(L"m");
}
if (ms != 0)
@ -183,7 +183,7 @@ namespace easy2d
}
else if (sec != 0)
{
result.append(easy2d::to_wstring(sec)).append(L"s");
result.append(kiwano::to_wstring(sec)).append(L"s");
}
return result;
}
@ -218,7 +218,7 @@ namespace easy2d
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_;
}
@ -243,7 +243,7 @@ namespace easy2d
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));
}
@ -326,37 +326,37 @@ namespace easy2d
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;
}
const Duration easy2d::time::operator/(int val, const Duration & dur)
const Duration kiwano::time::operator/(int val, const Duration & dur)
{
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;
}
const Duration easy2d::time::operator/(float val, const Duration & dur)
const Duration kiwano::time::operator/(float val, const Duration & dur)
{
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;
}
const Duration easy2d::time::operator/(double val, const Duration & dur)
const Duration kiwano::time::operator/(double val, const Duration & dur)
{
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;
}
@ -370,7 +370,7 @@ namespace easy2d
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();
}
@ -401,7 +401,7 @@ namespace easy2d
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();
}
@ -420,7 +420,7 @@ namespace easy2d
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();
}

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -24,7 +24,7 @@
#include <ostream>
#include <istream>
namespace easy2d
namespace kiwano
{
namespace time
{
@ -39,7 +39,7 @@ namespace easy2d
// 1.5 小时: 1.5_h
// 3 小时 45 分 15 秒: 3_h + 45_m + 15_s
//
struct E2D_API Duration
struct KGE_API Duration
{
Duration();
@ -135,10 +135,10 @@ namespace easy2d
};
/* 预定义的时间段 */
E2D_API extern const Duration Ms; // ºÁÃë
E2D_API extern const Duration Sec; // Ãë
E2D_API extern const Duration Min; // ·ÖÖÓ
E2D_API extern const Duration Hour; // Сʱ
KGE_API extern const Duration Ms; // ºÁÃë
KGE_API extern const Duration Sec; // Ãë
KGE_API extern const Duration Min; // ·ÖÖÓ
KGE_API extern const Duration Hour; // Сʱ
// 时间
@ -148,7 +148,7 @@ namespace easy2d
// Time t1, t2;
// int ms = (t2 - t1).Milliseconds(); // 获取两时间相差的毫秒数
//
struct E2D_API Time
struct KGE_API Time
{
Time();
@ -169,7 +169,7 @@ namespace easy2d
// 获取当前时间
// 由于该时间点基于系统启动时间开始计算, 所以无法格式化该时间,
// 也无法获得该时间的 Unix 时间戳
static Time Now() E2D_NOEXCEPT;
static Time Now() KGE_NOEXCEPT;
private:
long dur_;
@ -177,61 +177,61 @@ namespace easy2d
}
}
namespace easy2d
namespace kiwano
{
using namespace time;
}
#if VS_VER >= VS_2015
namespace easy2d
namespace kiwano
{
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
{
using namespace easy2d::literals;
using namespace kiwano::literals;
}
}

View File

@ -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
// 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_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
{
@ -70,7 +70,7 @@ namespace easy2d
HINSTANCE hinst = GetModuleHandleW(nullptr);
WNDCLASSEX wcex = { 0 };
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.lpfnWndProc = proc;
wcex.hIcon = nullptr;
@ -140,7 +140,7 @@ namespace easy2d
handle_ = ::CreateWindowExW(
is_fullscreen_ ? WS_EX_TOPMOST : 0,
E2D_WND_CLASS_NAME,
KGE_WND_CLASS_NAME,
title.c_str(),
GetWindowStyle(),
left,
@ -155,7 +155,7 @@ namespace easy2d
if (handle_ == nullptr)
{
::UnregisterClass(E2D_WND_CLASS_NAME, hinst);
::UnregisterClass(KGE_WND_CLASS_NAME, hinst);
return HRESULT_FROM_WIN32(GetLastError());
}
@ -382,7 +382,7 @@ namespace easy2d
mode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
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)

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -23,9 +23,9 @@
#include "../common/helper.h"
#include "../math/helper.h"
namespace easy2d
namespace kiwano
{
class E2D_API Window
class KGE_API Window
{
public:
// »ñÈ¡±êÌâ

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,7 @@
#include <type_traits>
#include <exception>
namespace easy2d
namespace kiwano
{
//
// Array

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,7 @@
#include <Unknwnbase.h>
#include <type_traits>
namespace easy2d
namespace kiwano
{
struct ComPtrManager
{

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -22,13 +22,13 @@
#include "../macros.h"
#include <functional>
#ifdef E2D_DEBUG
# define E2D_DEBUG_CHECK_LIST(list_ptr) list_ptr->Check()
#ifdef KGE_DEBUG
# define KGE_DEBUG_CHECK_LIST(list_ptr) list_ptr->Check()
#else
# define E2D_DEBUG_CHECK_LIST __noop
# define KGE_DEBUG_CHECK_LIST __noop
#endif
namespace easy2d
namespace kiwano
{
template <typename T> class IntrusiveList;
@ -100,7 +100,7 @@ namespace easy2d
last_ = child;
E2D_DEBUG_CHECK_LIST(this);
KGE_DEBUG_CHECK_LIST(this);
}
void PushFront(T const& child)
@ -124,7 +124,7 @@ namespace easy2d
first_ = child;
E2D_DEBUG_CHECK_LIST(this);
KGE_DEBUG_CHECK_LIST(this);
}
void InsertBefore(T const& child, T const& before)
@ -143,7 +143,7 @@ namespace easy2d
child->next_ = before;
before->prev_ = child;
E2D_DEBUG_CHECK_LIST(this);
KGE_DEBUG_CHECK_LIST(this);
}
void InsertAfter(T const& child, T const& after)
@ -162,16 +162,16 @@ namespace easy2d
child->prev_ = after;
after->next_ = child;
E2D_DEBUG_CHECK_LIST(this);
KGE_DEBUG_CHECK_LIST(this);
}
void Remove(T const& child)
{
#ifdef E2D_DEBUG
#ifdef KGE_DEBUG
T tmp = first_;
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_;
}
#endif
@ -197,7 +197,7 @@ namespace easy2d
child->prev_ = nullptr;
child->next_ = nullptr;
E2D_DEBUG_CHECK_LIST(this);
KGE_DEBUG_CHECK_LIST(this);
}
void Clear()
@ -217,7 +217,7 @@ namespace easy2d
last_ = nullptr;
}
#ifdef E2D_DEBUG
#ifdef KGE_DEBUG
private:
void Check()
@ -236,11 +236,11 @@ namespace easy2d
if (p)
{
E2D_ASSERT(p->prev_ == tmp && "Check list failed");
KGE_ASSERT(p->prev_ == tmp && "Check list failed");
}
else
{
E2D_ASSERT(tmp == last_ && "Check list failed");
KGE_ASSERT(tmp == last_ && "Check list failed");
}
} while (p);
}
@ -249,4 +249,4 @@ namespace easy2d
};
}
#undef E2D_DEBUG_CHECK_LIST
#undef KGE_DEBUG_CHECK_LIST

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,7 @@
#include <utility>
#include <type_traits>
namespace easy2d
namespace kiwano
{
template <typename _Ty, typename _Manager, bool _Enable>
class IntrusivePtr;
@ -43,81 +43,81 @@ namespace easy2d
public:
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_);
}
IntrusivePtr(const IntrusivePtr& other) E2D_NOEXCEPT
IntrusivePtr(const IntrusivePtr& other) KGE_NOEXCEPT
: ptr_(other.ptr_)
{
typename _Manager::AddRef(ptr_);
}
template <typename _UTy>
IntrusivePtr(const RealIntrusivePtr<_UTy, _Manager>& other) E2D_NOEXCEPT
IntrusivePtr(const RealIntrusivePtr<_UTy, _Manager>& other) KGE_NOEXCEPT
: ptr_(other.Get())
{
typename _Manager::AddRef(ptr_);
}
IntrusivePtr(IntrusivePtr&& other) E2D_NOEXCEPT
IntrusivePtr(IntrusivePtr&& other) KGE_NOEXCEPT
{
ptr_ = other.ptr_;
other.ptr_ = nullptr;
}
~IntrusivePtr() E2D_NOEXCEPT
~IntrusivePtr() KGE_NOEXCEPT
{
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);
}
inline void Swap(IntrusivePtr& other) E2D_NOEXCEPT
inline void Swap(IntrusivePtr& other) KGE_NOEXCEPT
{
std::swap(ptr_, other.ptr_);
}
inline Type* operator ->() const
{
E2D_ASSERT(ptr_ != nullptr && "Invalid pointer");
KGE_ASSERT(ptr_ != nullptr && "Invalid pointer");
return ptr_;
}
inline Type& operator *() const
{
E2D_ASSERT(ptr_ != nullptr && "Invalid pointer");
KGE_ASSERT(ptr_ != nullptr && "Invalid pointer");
return *ptr_;
}
inline Type** operator &()
{
E2D_ASSERT(ptr_ == nullptr && "Memory leak");
KGE_ASSERT(ptr_ == nullptr && "Memory leak");
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_)
IntrusivePtr(other).Swap(*this);
return *this;
}
inline IntrusivePtr& operator =(IntrusivePtr&& other) E2D_NOEXCEPT
inline IntrusivePtr& operator =(IntrusivePtr&& other) KGE_NOEXCEPT
{
typename _Manager::Release(ptr_);
ptr_ = other.ptr_;
@ -125,14 +125,14 @@ namespace easy2d
return *this;
}
inline IntrusivePtr& operator =(Type* p) E2D_NOEXCEPT
inline IntrusivePtr& operator =(Type* p) KGE_NOEXCEPT
{
if (p != ptr_)
IntrusivePtr(p).Swap(*this);
return *this;
}
inline IntrusivePtr& operator =(nullptr_t) E2D_NOEXCEPT
inline IntrusivePtr& operator =(nullptr_t) KGE_NOEXCEPT
{
if (nullptr != ptr_)
IntrusivePtr{}.Swap(*this);
@ -141,75 +141,75 @@ namespace easy2d
};
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();
}
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();
}
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();
}
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;
}
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;
}
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();
}
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();
}
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);
}
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);
}
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);
}
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);
}
// 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>
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);
}

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -25,12 +25,12 @@
#include <array>
#include <iosfwd>
namespace easy2d
namespace kiwano
{
template <
template <class _Kty, class _Ty, class ..._Args> typename _ObjectTy = easy2d::Map,
template <class _Kty, class ..._Args> typename _ArrayTy = easy2d::Array,
typename _StringTy = easy2d::String,
template <class _Kty, class _Ty, class ..._Args> typename _ObjectTy = kiwano::Map,
template <class _Kty, class ..._Args> typename _ArrayTy = kiwano::Array,
typename _StringTy = kiwano::String,
typename _IntegerTy = std::int32_t,
typename _FloatTy = double,
typename _BooleanTy = bool,
@ -44,7 +44,7 @@ namespace easy2d
// details of basic_json
//
#define E2D_DECLARE_BASIC_JSON_TEMPLATE\
#define KGE_DECLARE_BASIC_JSON_TEMPLATE\
template <\
template <class _Kty, class _Ty, class ..._Args> typename _ObjectTy, \
template <class _Kty, class ..._Args> typename _ArrayTy, \
@ -54,7 +54,7 @@ namespace easy2d
typename _BooleanTy, \
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
@ -84,8 +84,8 @@ namespace easy2d
{
};
E2D_DECLARE_BASIC_JSON_TEMPLATE
struct is_basic_json< basic_json<E2D_DECLARE_BASIC_JSON_TPL_ARGS> >
KGE_DECLARE_BASIC_JSON_TEMPLATE
struct is_basic_json< basic_json<KGE_DECLARE_BASIC_JSON_TPL_ARGS> >
: ::std::true_type
{
};
@ -1811,7 +1811,7 @@ namespace easy2d
// basic_json
//
E2D_DECLARE_BASIC_JSON_TEMPLATE
KGE_DECLARE_BASIC_JSON_TEMPLATE
class basic_json
{
friend struct __json_detail::iterator_impl<basic_json>;
@ -2673,20 +2673,20 @@ namespace easy2d
namespace std
{
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<>
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);
}
}
#undef E2D_DECLARE_BASIC_JSON_TEMPLATE
#undef E2D_DECLARE_BASIC_JSON_TPL_ARGS
#undef KGE_DECLARE_BASIC_JSON_TEMPLATE
#undef KGE_DECLARE_BASIC_JSON_TPL_ARGS

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -23,12 +23,12 @@
// Class that will implement the singleton mode,
// must use the macro in its delare file
#ifndef E2D_DECLARE_SINGLETON
#define E2D_DECLARE_SINGLETON( CLASS ) \
friend class ::easy2d::Singleton< CLASS >
#ifndef KGE_DECLARE_SINGLETON
#define KGE_DECLARE_SINGLETON( CLASS ) \
friend class ::kiwano::Singleton< CLASS >
#endif
namespace easy2d
namespace kiwano
{
template <typename _Ty>
class Singleton

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -27,7 +27,7 @@
#include <cstring>
#include <cstdio>
namespace easy2d
namespace kiwano
{
//
// String
@ -376,7 +376,7 @@ namespace easy2d
String format_wstring(const wchar_t* const fmt, _Args&&... args);
}
namespace easy2d
namespace kiwano
{
//
// details of String
@ -1108,20 +1108,20 @@ namespace easy2d
// details of String::parese
//
inline String String::parse(int val) { return ::easy2d::to_wstring(val); }
inline String String::parse(unsigned int val) { return ::easy2d::to_wstring(val); }
inline String String::parse(long val) { return ::easy2d::to_wstring(val); }
inline String String::parse(unsigned long val) { return ::easy2d::to_wstring(val); }
inline String String::parse(long long val) { return ::easy2d::to_wstring(val); }
inline String String::parse(unsigned long long val) { return ::easy2d::to_wstring(val); }
inline String String::parse(float val) { return ::easy2d::to_wstring(val); }
inline String String::parse(double val) { return ::easy2d::to_wstring(val); }
inline String String::parse(long double 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 ::kiwano::to_wstring(val); }
inline String String::parse(long val) { return ::kiwano::to_wstring(val); }
inline String String::parse(unsigned long val) { return ::kiwano::to_wstring(val); }
inline String String::parse(long long val) { return ::kiwano::to_wstring(val); }
inline String String::parse(unsigned long long val) { return ::kiwano::to_wstring(val); }
inline String String::parse(float val) { return ::kiwano::to_wstring(val); }
inline String String::parse(double val) { return ::kiwano::to_wstring(val); }
inline String String::parse(long double val) { return ::kiwano::to_wstring(val); }
template<typename ..._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
{
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();
}
};
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);
}

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
#pragma once
#include <stdexcept>
namespace easy2d
namespace kiwano
{
//
// Closure is a light weight std::function<>-like class

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -28,7 +28,7 @@
#include <unordered_set>
#include <unordered_map>
namespace easy2d
namespace kiwano
{
using StringStream = std::wstringstream;

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -20,7 +20,7 @@
#pragma once
namespace easy2d
namespace kiwano
{
class Noncopyable
{

21
Kiwano/config.h Normal file
View File

@ -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

View File

@ -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
// 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
// THE SOFTWARE.
#include "../easy2d-imgui.h"
#include "../kiwano-imgui.h"
namespace easy2d
namespace kiwano
{
namespace
{
@ -47,13 +47,13 @@ namespace easy2d
if (!ImGui::IsAnyMouseDown() && ::GetCapture() == nullptr)
::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;
}
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;
if (!ImGui::IsAnyMouseDown() && ::GetCapture() == target_window_)
@ -67,13 +67,13 @@ namespace easy2d
void ImGuiLayer::OnKeyDown(int key)
{
E2D_ASSERT(key < 256);
KGE_ASSERT(key < 256);
ImGui::GetIO().KeysDown[key] = 1;
}
void ImGuiLayer::OnKeyUp(int key)
{
E2D_ASSERT(key < 256);
KGE_ASSERT(key < 256);
ImGui::GetIO().KeysDown[key] = 0;
}

View File

@ -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
// of this software and associated documentation files (the "Software"), to deal
@ -20,11 +20,11 @@
#pragma once
namespace easy2d
namespace kiwano
{
class ImGuiView;
E2D_DECLARE_SMART_PTR(ImGuiLayer);
KGE_DECLARE_SMART_PTR(ImGuiLayer);
using ImGuiPipeline = Closure<void()>;

View File

@ -1,9 +1,9 @@
// Copyright (C) 2019 Nomango
#include "../easy2d-imgui.h"
#include "../kiwano-imgui.h"
#include "imgui_impl_dx11.h"
namespace easy2d
namespace kiwano
{
void ImGuiView::SetupComponent(Application* app)
{
@ -64,7 +64,7 @@ namespace easy2d
ImGui_ImplDX11_NewFrame();
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)
Size display_size = Renderer::Instance().GetOutputSize();

Some files were not shown because too many files have changed in this diff Show More