diff --git a/projects/kiwano/kiwano.vcxproj b/projects/kiwano/kiwano.vcxproj
index 2782d80d..4ec7a3d1 100644
--- a/projects/kiwano/kiwano.vcxproj
+++ b/projects/kiwano/kiwano.vcxproj
@@ -11,21 +11,21 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -42,21 +42,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -66,7 +64,10 @@
+
+
+
@@ -89,7 +90,6 @@
-
@@ -114,23 +114,24 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -151,7 +152,6 @@
-
diff --git a/projects/kiwano/kiwano.vcxproj.filters b/projects/kiwano/kiwano.vcxproj.filters
index 9f60577e..2f48b1a4 100644
--- a/projects/kiwano/kiwano.vcxproj.filters
+++ b/projects/kiwano/kiwano.vcxproj.filters
@@ -16,7 +16,7 @@
{896bdedf-6e82-449b-9b6e-0bc69f3699b1}
-
+
{2e18d99a-e906-499a-9e29-4e0783202644}
@@ -25,13 +25,13 @@
{9314f30d-5742-48b6-94e5-e3b4284106f6}
-
+
{86e2d0f2-a9d0-4456-b6a5-d480228bbf82}
{30333461-e9bc-4709-84bd-ce6e0e1a3079}
-
+
{192a47a9-9df6-4f40-a7d3-888eb00c53ac}
@@ -63,26 +63,23 @@
2d
-
- base
+
+ core
-
- base
+
+ core
-
- base
+
+ core
-
- base
+
+ core
-
- base
+
+ core
-
- base
-
-
- base
+
+ core
math
@@ -104,27 +101,24 @@
math
-
- base
-
-
- base
+
+ core
-
- base
+
+ core
-
- base
+
+ core
-
- base
+
+ core
2d
-
- base
+
+ core
2d
@@ -159,32 +153,32 @@
2d
-
- core
+
+ common
-
- core
+
+ common
-
- core
+
+ common
-
- core
+
+ common
-
- core
+
+ common
-
- core
+
+ common
-
- core
+
+ common
-
- core
+
+ common
-
- core
+
+ common
2d
@@ -198,17 +192,14 @@
2d\action
-
- base
-
-
- base
+
+ core
math
-
- base
+
+ core
renderer
@@ -279,29 +270,38 @@
math
-
- base\win32
+
+ core\win32
-
- base\win32
+
+ core\win32
utils
-
- utils
-
-
- core
+
+ common
utils
-
- base
+
+ core
-
- base
+
+ core
+
+
+ platform
+
+
+ core
+
+
+ platform
+
+
+ platform
@@ -326,17 +326,17 @@
2d
-
- base
+
+ core
-
- base
+
+ core
-
- base
+
+ core
-
- base
+
+ core
platform
@@ -344,23 +344,20 @@
platform
-
- base
+
+ core
-
- base
+
+ core
-
- base
-
-
- base
+
+ core
2d
-
- base
+
+ core
2d
@@ -404,14 +401,11 @@
2d\action
-
- base
+
+ core
-
- base
-
-
- base
+
+ core
renderer
@@ -467,23 +461,29 @@
renderer
-
- base
+
+ core
utils
-
- utils
-
utils
-
- base
+
+ core
-
- base
+
+ core
+
+
+ platform
+
+
+ platform
+
+
+ platform
\ No newline at end of file
diff --git a/src/kiwano-audio/AudioEngine.cpp b/src/kiwano-audio/AudioEngine.cpp
index 53f2d05b..194b180d 100644
--- a/src/kiwano-audio/AudioEngine.cpp
+++ b/src/kiwano-audio/AudioEngine.cpp
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#include
+#include
#include
#include
diff --git a/src/kiwano-audio/AudioEngine.h b/src/kiwano-audio/AudioEngine.h
index 4bbd313d..11187a2a 100644
--- a/src/kiwano-audio/AudioEngine.h
+++ b/src/kiwano-audio/AudioEngine.h
@@ -19,9 +19,9 @@
// THE SOFTWARE.
#pragma once
-#include
-#include
-#include
+#include
+#include
+#include
#include
#include
diff --git a/src/kiwano-audio/Sound.cpp b/src/kiwano-audio/Sound.cpp
index d0bda67f..622391fb 100644
--- a/src/kiwano-audio/Sound.cpp
+++ b/src/kiwano-audio/Sound.cpp
@@ -18,8 +18,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#include
-#include
+#include
+#include
#include
#include
diff --git a/src/kiwano-audio/Sound.h b/src/kiwano-audio/Sound.h
index 5cc66646..e94171a4 100644
--- a/src/kiwano-audio/Sound.h
+++ b/src/kiwano-audio/Sound.h
@@ -19,9 +19,9 @@
// THE SOFTWARE.
#pragma once
-#include
-#include
-#include
+#include
+#include
+#include
#include
#include
diff --git a/src/kiwano-audio/SoundPlayer.h b/src/kiwano-audio/SoundPlayer.h
index f3659a5d..913fe04f 100644
--- a/src/kiwano-audio/SoundPlayer.h
+++ b/src/kiwano-audio/SoundPlayer.h
@@ -19,8 +19,8 @@
// THE SOFTWARE.
#pragma once
-#include
-#include
+#include
+#include
#include
namespace kiwano
diff --git a/src/kiwano-audio/Transcoder.cpp b/src/kiwano-audio/Transcoder.cpp
index 23552f8b..256ebe83 100644
--- a/src/kiwano-audio/Transcoder.cpp
+++ b/src/kiwano-audio/Transcoder.cpp
@@ -23,10 +23,10 @@
#endif
#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
#include
#include
#include
diff --git a/src/kiwano-audio/Transcoder.h b/src/kiwano-audio/Transcoder.h
index 7d6d0d78..1ee99cf3 100644
--- a/src/kiwano-audio/Transcoder.h
+++ b/src/kiwano-audio/Transcoder.h
@@ -19,7 +19,7 @@
// THE SOFTWARE.
#pragma once
-#include
+#include
#include
#include
#include
diff --git a/src/kiwano-audio/audio-modules.cpp b/src/kiwano-audio/audio-modules.cpp
index f46335bb..f140f00d 100644
--- a/src/kiwano-audio/audio-modules.cpp
+++ b/src/kiwano-audio/audio-modules.cpp
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#include
+#include
#include
namespace kiwano
diff --git a/src/kiwano-audio/audio-modules.h b/src/kiwano-audio/audio-modules.h
index 97a7e8a9..299beb34 100644
--- a/src/kiwano-audio/audio-modules.h
+++ b/src/kiwano-audio/audio-modules.h
@@ -19,7 +19,7 @@
// THE SOFTWARE.
#pragma once
-#include
+#include
#include
#include
#include
diff --git a/src/kiwano-imgui/ImGuiModule.cpp b/src/kiwano-imgui/ImGuiModule.cpp
index 5ed0034f..f164f2bd 100644
--- a/src/kiwano-imgui/ImGuiModule.cpp
+++ b/src/kiwano-imgui/ImGuiModule.cpp
@@ -1,10 +1,10 @@
// Copyright (C) 2019 Nomango
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
#include
#include
#include
diff --git a/src/kiwano-imgui/ImGuiModule.h b/src/kiwano-imgui/ImGuiModule.h
index a047da68..c9069a40 100644
--- a/src/kiwano-imgui/ImGuiModule.h
+++ b/src/kiwano-imgui/ImGuiModule.h
@@ -19,8 +19,8 @@
// THE SOFTWARE.
#pragma once
-#include
-#include
+#include
+#include
namespace kiwano
{
diff --git a/src/kiwano-imgui/imgui_impl_dx11.cpp b/src/kiwano-imgui/imgui_impl_dx11.cpp
index a8f20a45..a8dc29eb 100644
--- a/src/kiwano-imgui/imgui_impl_dx11.cpp
+++ b/src/kiwano-imgui/imgui_impl_dx11.cpp
@@ -1,6 +1,6 @@
// dear imgui: Renderer for Kiwano (DirectX11)
-#include
+#include
#include
// DirectX
diff --git a/src/kiwano-network/HttpClient.cpp b/src/kiwano-network/HttpClient.cpp
index 4822be25..7e7d97cc 100644
--- a/src/kiwano-network/HttpClient.cpp
+++ b/src/kiwano-network/HttpClient.cpp
@@ -25,7 +25,7 @@
#include
#include
-#include
+#include
#include
#include <3rd-party/curl/curl.h> // CURL
@@ -36,7 +36,7 @@ namespace
uint32_t write_data(void* buffer, uint32_t size, uint32_t nmemb, void* userp)
{
- core::string* recv_buffer = (core::string*)userp;
+ common::string* recv_buffer = (common::string*)userp;
uint32_t total = size * nmemb;
// add data to the end of recv_buffer
@@ -46,10 +46,10 @@ namespace
return total;
}
- core::string convert_to_utf8(core::wstring const& str)
+ common::string convert_to_utf8(common::wstring const& str)
{
std::wstring_convert> utf8_conv;
- core::string result;
+ common::string result;
try
{
@@ -63,10 +63,10 @@ namespace
return result;
}
- core::wstring convert_from_utf8(core::string const& str)
+ common::wstring convert_from_utf8(common::string const& str)
{
kiwano::string_convert> utf8_conv;
- core::wstring result;
+ common::wstring result;
try
{
@@ -104,7 +104,7 @@ namespace
}
}
- bool Init(HttpClient* client, Vector const& headers, core::string const& url, core::string* response_data, core::string* response_header, char* error_buffer)
+ bool Init(HttpClient* client, Vector const& headers, common::string const& url, common::string* response_data, common::string* response_header, char* error_buffer)
{
if (!SetOption(CURLOPT_ERRORBUFFER, error_buffer))
return false;
@@ -170,11 +170,11 @@ namespace
public:
static inline bool GetRequest(
HttpClient* client,
- Vector const& headers,
- core::string const& url,
+ Vector const& headers,
+ common::string const& url,
long* response_code,
- core::string* response_data,
- core::string* response_header,
+ common::string* response_data,
+ common::string* response_header,
char* error_buffer)
{
Curl curl;
@@ -185,12 +185,12 @@ namespace
static inline bool PostRequest(
HttpClient* client,
- Vector const& headers,
- core::string const& url,
- core::string const& request_data,
+ Vector const& headers,
+ common::string const& url,
+ common::string const& request_data,
long* response_code,
- core::string* response_data,
- core::string* response_header,
+ common::string* response_data,
+ common::string* response_header,
char* error_buffer)
{
Curl curl;
@@ -203,12 +203,12 @@ namespace
static inline bool PutRequest(
HttpClient* client,
- Vector const& headers,
- core::string const& url,
- core::string const& request_data,
+ Vector const& headers,
+ common::string const& url,
+ common::string const& request_data,
long* response_code,
- core::string* response_data,
- core::string* response_header,
+ common::string* response_data,
+ common::string* response_header,
char* error_buffer)
{
Curl curl;
@@ -221,11 +221,11 @@ namespace
static inline bool DeleteRequest(
HttpClient* client,
- Vector const& headers,
- core::string const& url,
+ Vector const& headers,
+ common::string const& url,
long* response_code,
- core::string* response_data,
- core::string* response_header,
+ common::string* response_data,
+ common::string* response_header,
char* error_buffer)
{
Curl curl;
@@ -307,13 +307,13 @@ namespace kiwano
bool ok = false;
long response_code = 0;
char error_message[256] = { 0 };
- core::string response_header;
- core::string response_data;
+ common::string response_header;
+ common::string response_data;
- core::string url = convert_to_utf8(request->GetUrl());
- core::string data = convert_to_utf8(request->GetData());
+ common::string url = convert_to_utf8(request->GetUrl());
+ common::string data = convert_to_utf8(request->GetData());
- Vector headers;
+ Vector headers;
headers.reserve(request->GetHeaders().size());
for (const auto& pair : request->GetHeaders())
{
diff --git a/src/kiwano-network/HttpClient.h b/src/kiwano-network/HttpClient.h
index 73b52f7a..31e7bf1f 100644
--- a/src/kiwano-network/HttpClient.h
+++ b/src/kiwano-network/HttpClient.h
@@ -19,9 +19,9 @@
// THE SOFTWARE.
#pragma once
-#include
-#include
-#include
+#include
+#include
+#include
#include
#include
@@ -36,39 +36,19 @@ namespace kiwano
KGE_DECLARE_SINGLETON(HttpClient);
public:
- void Send(
- HttpRequestPtr request
- );
+ void Send(HttpRequestPtr request);
- inline void SetTimeoutForConnect(Duration timeout)
- {
- timeout_for_connect_ = timeout;
- }
+ void SetTimeoutForConnect(Duration timeout);
- inline Duration GetTimeoutForConnect() const
- {
- return timeout_for_connect_;
- }
+ Duration GetTimeoutForConnect() const;
- inline void SetTimeoutForRead(Duration timeout)
- {
- timeout_for_read_ = timeout;
- }
+ void SetTimeoutForRead(Duration timeout);
- inline Duration GetTimeoutForRead() const
- {
- return timeout_for_read_;
- }
+ Duration GetTimeoutForRead() const;
- inline void SetSSLVerification(String const& root_certificate_path)
- {
- ssl_verification_ = root_certificate_path;
- }
+ void SetSSLVerification(String const& root_certificate_path);
- inline String const& GetSSLVerification() const
- {
- return ssl_verification_;
- }
+ String const& GetSSLVerification() const;
public:
virtual void SetupComponent() override;
@@ -101,5 +81,37 @@ namespace kiwano
std::condition_variable_any sleep_condition_;
};
+
+
+ inline void HttpClient::SetTimeoutForConnect(Duration timeout)
+ {
+ timeout_for_connect_ = timeout;
+ }
+
+ inline Duration HttpClient::GetTimeoutForConnect() const
+ {
+ return timeout_for_connect_;
+ }
+
+ inline void HttpClient::SetTimeoutForRead(Duration timeout)
+ {
+ timeout_for_read_ = timeout;
+ }
+
+ inline Duration HttpClient::GetTimeoutForRead() const
+ {
+ return timeout_for_read_;
+ }
+
+ inline void HttpClient::SetSSLVerification(String const& root_certificate_path)
+ {
+ ssl_verification_ = root_certificate_path;
+ }
+
+ inline String const& HttpClient::GetSSLVerification() const
+ {
+ return ssl_verification_;
+ }
+
}
}
diff --git a/src/kiwano-network/HttpRequest.cpp b/src/kiwano-network/HttpRequest.cpp
index 0a52f3b4..610df352 100644
--- a/src/kiwano-network/HttpRequest.cpp
+++ b/src/kiwano-network/HttpRequest.cpp
@@ -30,19 +30,5 @@ namespace kiwano
SetHeader(L"Content-Type", L"application/json;charset=UTF-8");
data_ = json.dump();
}
-
- void HttpRequest::SetHeader(String const& field, String const& content)
- {
- auto iter = headers_.find(field);
- if (iter != headers_.end())
- {
- headers_[field] = content;
- }
- else
- {
- headers_.insert(std::make_pair(field, content));
- }
- }
-
}
}
diff --git a/src/kiwano-network/HttpRequest.h b/src/kiwano-network/HttpRequest.h
index 942376fe..716f8240 100644
--- a/src/kiwano-network/HttpRequest.h
+++ b/src/kiwano-network/HttpRequest.h
@@ -19,10 +19,10 @@
// THE SOFTWARE.
#pragma once
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
namespace kiwano
{
@@ -47,35 +47,32 @@ namespace kiwano
Delete
};
- inline HttpRequest() : type_(Type::Unknown) {}
+ HttpRequest();
- inline HttpRequest(Type type) : type_(type) {}
+ HttpRequest(Type type);
- inline void SetUrl(String const& url) { url_ = url; }
+ // 请求地址
+ void SetUrl(String const& url);
+ String const& GetUrl() const;
- inline String const& GetUrl() const { return url_; }
+ // 请求类型
+ void SetType(Type type);
+ Type GetType() const;
- inline void SetType(Type type) { type_ = type; }
+ // 请求数据
+ void SetData(String const& data);
+ void SetJsonData(Json const& json);
+ String const& GetData() const;
- inline Type GetType() const { return type_; }
+ // 请求头
+ void SetHeaders(Map const& headers);
+ void SetHeader(String const& field, String const& content);
+ Map& GetHeaders();
+ String const& GetHeader(String const& header) const;
- inline void SetData(String const& data) { data_ = data; }
-
- void SetJsonData(Json const& json);
-
- inline String const& GetData() const { return data_; }
-
- inline void SetHeaders(Map const& headers) { headers_ = headers; }
-
- void SetHeader(String const& field, String const& content);
-
- inline Map& GetHeaders() { return headers_; }
-
- inline String const& GetHeader(String const& header) const { return headers_.at(header); }
-
- inline void SetResponseCallback(ResponseCallback const& callback) { response_cb_ = callback; }
-
- inline ResponseCallback const& GetResponseCallback() const { return response_cb_; }
+ // 响应回调
+ void SetResponseCallback(ResponseCallback const& callback);
+ ResponseCallback const& GetResponseCallback() const;
protected:
Type type_;
@@ -84,5 +81,33 @@ namespace kiwano
Map headers_;
ResponseCallback response_cb_;
};
+
+ inline HttpRequest::HttpRequest() : type_(Type::Unknown) {}
+
+ inline HttpRequest::HttpRequest(Type type) : type_(type) {}
+
+ inline void HttpRequest::SetUrl(String const& url) { url_ = url; }
+
+ inline String const& HttpRequest::GetUrl() const { return url_; }
+
+ inline void HttpRequest::SetType(Type type) { type_ = type; }
+
+ inline HttpRequest::Type HttpRequest::GetType() const { return type_; }
+
+ inline void HttpRequest::SetData(String const& data) { data_ = data; }
+
+ inline String const& HttpRequest::GetData() const { return data_; }
+
+ inline void HttpRequest::SetHeaders(Map const& headers) { headers_ = headers; }
+
+ inline void HttpRequest::SetHeader(String const& field, String const& content) { headers_[field] = content; }
+
+ inline Map& HttpRequest::GetHeaders() { return headers_; }
+
+ inline String const& HttpRequest::GetHeader(String const& header) const { return headers_.at(header); }
+
+ inline void HttpRequest::SetResponseCallback(ResponseCallback const& callback) { response_cb_ = callback; }
+
+ inline HttpRequest::ResponseCallback const& HttpRequest::GetResponseCallback() const { return response_cb_; }
}
}
diff --git a/src/kiwano-network/HttpResponse.hpp b/src/kiwano-network/HttpResponse.hpp
index 24874db9..a2d043b0 100644
--- a/src/kiwano-network/HttpResponse.hpp
+++ b/src/kiwano-network/HttpResponse.hpp
@@ -31,29 +31,30 @@ namespace kiwano
: public ObjectBase
{
public:
- inline HttpResponse(HttpRequestPtr request) : request_(request), succeed_(false), response_code_(0) {}
+ HttpResponse(HttpRequestPtr request);
- inline HttpRequestPtr GetRequest() const { return request_; }
+ // 获取请求
+ HttpRequestPtr GetRequest() const;
- inline void SetSucceed(bool succeed) { succeed_ = succeed; }
+ // 响应状态
+ bool IsSucceed() const;
+ void SetSucceed(bool succeed);
- inline bool IsSucceed() const { return succeed_; }
+ // 响应状态码
+ long GetResponseCode() const;
+ void SetResponseCode(long response_code);
- inline void SetResponseCode(long response_code) { response_code_ = response_code; }
+ // 响应头
+ String GetHeader() const;
+ void SetHeader(String const& response_header);
- inline long GetResponseCode() const { return response_code_; }
+ // 响应数据
+ String const& GetData() const;
+ void SetData(String const& response_data);
- inline void SetHeader(String const& response_header) { response_header_ = response_header; }
-
- inline String GetHeader() const { return response_header_; }
-
- inline void SetData(String const& response_data) { response_data_ = response_data; }
-
- inline String const& GetData() const { return response_data_; }
-
- inline void SetError(String const& error_buffer) { error_buffer_ = error_buffer; }
-
- inline String const& GetError() const { return error_buffer_; }
+ // 错误信息
+ String const& GetError() const;
+ void SetError(String const& error_buffer);
protected:
bool succeed_;
@@ -64,5 +65,29 @@ namespace kiwano
String response_data_;
String error_buffer_;
};
+
+ inline HttpResponse::HttpResponse(HttpRequestPtr request) : request_(request), succeed_(false), response_code_(0) {}
+
+ inline HttpRequestPtr HttpResponse::GetRequest() const { return request_; }
+
+ inline void HttpResponse::SetSucceed(bool succeed) { succeed_ = succeed; }
+
+ inline bool HttpResponse::IsSucceed() const { return succeed_; }
+
+ inline void HttpResponse::SetResponseCode(long response_code) { response_code_ = response_code; }
+
+ inline long HttpResponse::GetResponseCode() const { return response_code_; }
+
+ inline void HttpResponse::SetHeader(String const& response_header) { response_header_ = response_header; }
+
+ inline String HttpResponse::GetHeader() const { return response_header_; }
+
+ inline void HttpResponse::SetData(String const& response_data) { response_data_ = response_data; }
+
+ inline String const& HttpResponse::GetData() const { return response_data_; }
+
+ inline void HttpResponse::SetError(String const& error_buffer) { error_buffer_ = error_buffer; }
+
+ inline String const& HttpResponse::GetError() const { return error_buffer_; }
}
}
diff --git a/src/kiwano/2d/Actor.cpp b/src/kiwano/2d/Actor.cpp
index 9319a8d4..3570d728 100644
--- a/src/kiwano/2d/Actor.cpp
+++ b/src/kiwano/2d/Actor.cpp
@@ -20,7 +20,7 @@
#include
#include
-#include
+#include
#include
namespace kiwano
diff --git a/src/kiwano/2d/Actor.h b/src/kiwano/2d/Actor.h
index b1e6cbab..8b0e97fd 100644
--- a/src/kiwano/2d/Actor.h
+++ b/src/kiwano/2d/Actor.h
@@ -22,8 +22,8 @@
#include
#include
#include
-#include
-#include
+#include
+#include
namespace kiwano
{
diff --git a/src/kiwano/2d/Canvas.cpp b/src/kiwano/2d/Canvas.cpp
index c4852768..cbb6b60e 100644
--- a/src/kiwano/2d/Canvas.cpp
+++ b/src/kiwano/2d/Canvas.cpp
@@ -19,7 +19,7 @@
// THE SOFTWARE.
#include
-#include
+#include
#include
namespace kiwano
diff --git a/src/kiwano/2d/DebugActor.cpp b/src/kiwano/2d/DebugActor.cpp
index e6f33be9..5d53e1fa 100644
--- a/src/kiwano/2d/DebugActor.cpp
+++ b/src/kiwano/2d/DebugActor.cpp
@@ -87,7 +87,7 @@ namespace kiwano
KGE_NOT_USED(dt);
frame_time_.push_back(Time::Now());
- while (frame_time_.back() - frame_time_.front() >= time::Sec)
+ while (frame_time_.back() - frame_time_.front() >= Duration::Second)
{
frame_time_.erase(frame_time_.begin());
}
diff --git a/src/kiwano/2d/Frame.h b/src/kiwano/2d/Frame.h
index 881b3c05..f9b1a947 100644
--- a/src/kiwano/2d/Frame.h
+++ b/src/kiwano/2d/Frame.h
@@ -19,7 +19,7 @@
// THE SOFTWARE.
#pragma once
-#include
+#include
#include
namespace kiwano
diff --git a/src/kiwano/2d/FrameSequence.cpp b/src/kiwano/2d/FrameSequence.cpp
index 0bc00b5e..c72e2d01 100644
--- a/src/kiwano/2d/FrameSequence.cpp
+++ b/src/kiwano/2d/FrameSequence.cpp
@@ -20,7 +20,7 @@
#include
#include
-#include
+#include
namespace kiwano
{
diff --git a/src/kiwano/2d/GifSprite.cpp b/src/kiwano/2d/GifSprite.cpp
index 1ff49add..b8dc4e64 100644
--- a/src/kiwano/2d/GifSprite.cpp
+++ b/src/kiwano/2d/GifSprite.cpp
@@ -19,7 +19,7 @@
// THE SOFTWARE.
#include
-#include
+#include
#include
#include
diff --git a/src/kiwano/2d/GifSprite.h b/src/kiwano/2d/GifSprite.h
index bc5c4cb8..10ebb933 100644
--- a/src/kiwano/2d/GifSprite.h
+++ b/src/kiwano/2d/GifSprite.h
@@ -20,7 +20,7 @@
#pragma once
#include
-#include
+#include
#include
#include
diff --git a/src/kiwano/2d/ShapeActor.cpp b/src/kiwano/2d/ShapeActor.cpp
index 759e12e7..f6b9b809 100644
--- a/src/kiwano/2d/ShapeActor.cpp
+++ b/src/kiwano/2d/ShapeActor.cpp
@@ -19,7 +19,7 @@
// THE SOFTWARE.
#include
-#include
+#include
#include
namespace kiwano
diff --git a/src/kiwano/2d/Stage.cpp b/src/kiwano/2d/Stage.cpp
index d3f12fbd..6dcaac31 100644
--- a/src/kiwano/2d/Stage.cpp
+++ b/src/kiwano/2d/Stage.cpp
@@ -19,7 +19,7 @@
// THE SOFTWARE.
#include
-#include
+#include
#include
namespace kiwano
diff --git a/src/kiwano/2d/Text.cpp b/src/kiwano/2d/Text.cpp
index 47d60b9a..5f3fa022 100644
--- a/src/kiwano/2d/Text.cpp
+++ b/src/kiwano/2d/Text.cpp
@@ -19,7 +19,7 @@
// THE SOFTWARE.
#include
-#include
+#include
#include
namespace kiwano
diff --git a/src/kiwano/2d/Transition.cpp b/src/kiwano/2d/Transition.cpp
index 5dc4b8a3..5000a306 100644
--- a/src/kiwano/2d/Transition.cpp
+++ b/src/kiwano/2d/Transition.cpp
@@ -21,8 +21,8 @@
#include
#include
#include
-#include
-#include
+#include
+#include
#include
namespace kiwano
diff --git a/src/kiwano/2d/action/ActionGroup.cpp b/src/kiwano/2d/action/ActionGroup.cpp
index d2e53e52..a913ae20 100644
--- a/src/kiwano/2d/action/ActionGroup.cpp
+++ b/src/kiwano/2d/action/ActionGroup.cpp
@@ -20,7 +20,7 @@
#include
#include
-#include
+#include
namespace kiwano
{
diff --git a/src/kiwano/2d/action/ActionHelper.h b/src/kiwano/2d/action/ActionHelper.h
index 36eef88c..e2ea18e9 100644
--- a/src/kiwano/2d/action/ActionHelper.h
+++ b/src/kiwano/2d/action/ActionHelper.h
@@ -30,71 +30,71 @@ namespace kiwano
struct ActionHelper
{
// 设置循环次数
- inline ActionHelper& SetLoops(int loops) { base->SetLoops(loops); return (*this); }
+ inline ActionHelper& SetLoops(int loops) { core->SetLoops(loops); return (*this); }
// 设置动作延迟
- inline ActionHelper& SetDelay(Duration delay) { base->SetDelay(delay); return (*this); }
+ inline ActionHelper& SetDelay(Duration delay) { core->SetDelay(delay); return (*this); }
// 设置动作结束回调函数
- inline ActionHelper& SetDoneCallback(ActionCallback const& cb) { base->SetDoneCallback(cb); return (*this); }
+ inline ActionHelper& SetDoneCallback(ActionCallback const& cb) { core->SetDoneCallback(cb); return (*this); }
// 设置动作循环结束时的回调函数
- inline ActionHelper& SetLoopDoneCallback(ActionCallback const& cb) { base->SetLoopDoneCallback(cb); return (*this); }
+ inline ActionHelper& SetLoopDoneCallback(ActionCallback const& cb) { core->SetLoopDoneCallback(cb); return (*this); }
// 动作结束时移除目标角色
- inline ActionHelper& RemoveTargetWhenDone() { base->RemoveTargetWhenDone(); return (*this); }
+ inline ActionHelper& RemoveTargetWhenDone() { core->RemoveTargetWhenDone(); return (*this); }
// 设置名称
- inline ActionHelper& SetName(String const& name) { base->SetName(name); return (*this); }
+ inline ActionHelper& SetName(String const& name) { core->SetName(name); return (*this); }
// 获取指针
- inline ActionPtr Get() const { return base; }
+ inline ActionPtr Get() const { return core; }
- inline ActionHelper(ActionPtr base) : base(base) {}
+ inline ActionHelper(ActionPtr core) : core(core) {}
- inline operator ActionPtr() const { return base; }
+ inline operator ActionPtr() const { return core; }
protected:
- ActionPtr base;
+ ActionPtr core;
};
struct TweenHelper
{
// 设置动画持续时长
- inline TweenHelper& SetDuration(Duration dur) { base->SetDuration(dur); return (*this); }
+ inline TweenHelper& SetDuration(Duration dur) { core->SetDuration(dur); return (*this); }
// 设置循环次数
- inline TweenHelper& SetLoops(int loops) { base->SetLoops(loops); return (*this); }
+ inline TweenHelper& SetLoops(int loops) { core->SetLoops(loops); return (*this); }
// 设置缓动函数
- inline TweenHelper& SetEaseFunc(EaseFunc ease) { base->SetEaseFunc(ease); return (*this); }
+ inline TweenHelper& SetEaseFunc(EaseFunc ease) { core->SetEaseFunc(ease); return (*this); }
// 设置动作延迟
- inline TweenHelper& SetDelay(Duration delay) { base->SetDelay(delay); return (*this); }
+ inline TweenHelper& SetDelay(Duration delay) { core->SetDelay(delay); return (*this); }
// 设置动作结束回调函数
- inline TweenHelper& SetDoneCallback(ActionCallback const& cb) { base->SetDoneCallback(cb); return (*this); }
+ inline TweenHelper& SetDoneCallback(ActionCallback const& cb) { core->SetDoneCallback(cb); return (*this); }
// 设置动作循环结束时的回调函数
- inline TweenHelper& SetLoopDoneCallback(ActionCallback const& cb) { base->SetLoopDoneCallback(cb); return (*this); }
+ inline TweenHelper& SetLoopDoneCallback(ActionCallback const& cb) { core->SetLoopDoneCallback(cb); return (*this); }
// 动作结束时移除目标角色
- inline TweenHelper& RemoveTargetWhenDone() { base->RemoveTargetWhenDone(); return (*this); }
+ inline TweenHelper& RemoveTargetWhenDone() { core->RemoveTargetWhenDone(); return (*this); }
// 设置名称
- inline TweenHelper& SetName(String const& name) { base->SetName(name); return (*this); }
+ inline TweenHelper& SetName(String const& name) { core->SetName(name); return (*this); }
// 获取指针
- inline ActionTweenPtr Get() const { return base; }
+ inline ActionTweenPtr Get() const { return core; }
- inline TweenHelper(ActionTweenPtr base) : base(base) {}
+ inline TweenHelper(ActionTweenPtr core) : core(core) {}
- inline operator ActionPtr() const { return base; }
+ inline operator ActionPtr() const { return core; }
- inline operator ActionTweenPtr() const { return base; }
+ inline operator ActionTweenPtr() const { return core; }
protected:
- ActionTweenPtr base;
+ ActionTweenPtr core;
};
// Tween actions helper
diff --git a/src/kiwano/2d/action/ActionManager.cpp b/src/kiwano/2d/action/ActionManager.cpp
index 52b603f1..d4a790c0 100644
--- a/src/kiwano/2d/action/ActionManager.cpp
+++ b/src/kiwano/2d/action/ActionManager.cpp
@@ -20,7 +20,7 @@
#include
#include
-#include
+#include
namespace kiwano
{
diff --git a/src/kiwano/2d/action/ActionTween.h b/src/kiwano/2d/action/ActionTween.h
index 83eef1cc..27a50115 100644
--- a/src/kiwano/2d/action/ActionTween.h
+++ b/src/kiwano/2d/action/ActionTween.h
@@ -20,7 +20,7 @@
#pragma once
#include
-#include
+#include
namespace kiwano
{
diff --git a/src/kiwano/2d/include-forwards.h b/src/kiwano/2d/include-forwards.h
index 00dd6d33..c4ef9e6e 100644
--- a/src/kiwano/2d/include-forwards.h
+++ b/src/kiwano/2d/include-forwards.h
@@ -19,11 +19,11 @@
// THE SOFTWARE.
#pragma once
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
#include
#include
diff --git a/src/kiwano/base/time.cpp b/src/kiwano/base/time.cpp
deleted file mode 100644
index 5010ef5c..00000000
--- a/src/kiwano/base/time.cpp
+++ /dev/null
@@ -1,426 +0,0 @@
-// 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
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#include
-#include
-
-#include
-#include
-
-namespace kiwano
-{
- namespace time
- {
- //-------------------------------------------------------
- // Time
- //-------------------------------------------------------
-
- Time::Time()
- : dur_(0)
- {
- }
-
- Time::Time(long dur)
- : dur_(dur)
- {
- }
-
- const Time Time::operator+(const Duration & dur) const
- {
- return Time{ dur_ + dur.Milliseconds() };
- }
-
- const Time Time::operator-(const Duration & dur) const
- {
- return Time{ dur_ - dur.Milliseconds() };
- }
-
- Time & Time::operator+=(const Duration & other)
- {
- dur_ += other.Milliseconds();
- return (*this);
- }
-
- Time & Time::operator-=(const Duration &other)
- {
- dur_ -= other.Milliseconds();
- return (*this);
- }
-
- const Duration Time::operator-(const Time & other) const
- {
- return Duration(dur_ - other.dur_);
- }
-
- Time Time::Now() noexcept
- {
- static LARGE_INTEGER freq = {};
- if (freq.QuadPart == 0LL)
- {
- // the Function will always succceed on systems that run Windows XP or later
- QueryPerformanceFrequency(&freq);
- }
-
- LARGE_INTEGER count;
- QueryPerformanceCounter(&count);
-
- const long long whole = (count.QuadPart / freq.QuadPart) * 1000LL;
- const long long part = (count.QuadPart % freq.QuadPart) * 1000LL / freq.QuadPart;
- return Time{ static_cast(whole + part) };
- }
-
-
- //-------------------------------------------------------
- // Duration
- //-------------------------------------------------------
-
- const Duration Ms = 1L;
- const Duration Sec = 1000 * Ms;
- const Duration Min = 60 * Sec;
- const Duration Hour = 60 * Min;
-
- namespace
- {
- const auto duration_regex = std::wregex(LR"(^[-+]?([0-9]*(\.[0-9]*)?(h|m|s|ms)+)+$)");
-
- typedef std::unordered_map UnitMap;
- const auto unit_map = UnitMap
- {
- {L"ms", Ms},
- {L"s", Sec},
- {L"m", Min},
- {L"h", Hour}
- };
- }
-
- Duration::Duration()
- : milliseconds_(0)
- {
- }
-
- Duration::Duration(long milliseconds)
- : milliseconds_(milliseconds)
- {
- }
-
- float Duration::Seconds() const
- {
- long sec = milliseconds_ / Sec.milliseconds_;
- long ms = milliseconds_ % Sec.milliseconds_;
- return static_cast(sec) + static_cast(ms) / 1000.f;
- }
-
- float Duration::Minutes() const
- {
- long min = milliseconds_ / Min.milliseconds_;
- long ms = milliseconds_ % Min.milliseconds_;
- return static_cast(min) + static_cast(ms) / (60 * 1000.f);
- }
-
- float Duration::Hours() const
- {
- long hour = milliseconds_ / Hour.milliseconds_;
- long ms = milliseconds_ % Hour.milliseconds_;
- return static_cast(hour) + static_cast(ms) / (60 * 60 * 1000.f);
- }
-
- String kiwano::time::Duration::ToString() const
- {
- if (IsZero())
- {
- return String(L"0s");
- }
-
- String result;
- long total_ms = milliseconds_;
- if (total_ms < 0)
- {
- result.append(L"-");
- total_ms = -total_ms;
- }
-
- long hour = total_ms / Hour.milliseconds_;
- long min = total_ms / Min.milliseconds_ - hour * 60;
- long sec = total_ms / Sec.milliseconds_ - (hour * 60 * 60 + min * 60);
- long ms = total_ms % Sec.milliseconds_;
-
- if (hour)
- {
- result.append(String::parse(hour)).append(L"h");
- result.append(String::parse(min)).append(L"m");
- }
- else if(min)
- {
- result.append(String::parse(min)).append(L"m");
- }
-
- if (ms != 0)
- {
- result.append(String::parse(static_cast(sec) + static_cast(ms) / 1000.f))
- .append(L"s");
- }
- else if (sec != 0)
- {
- result.append(String::parse(sec)).append(L"s");
- }
- return result;
- }
-
- bool Duration::operator==(const Duration & other) const
- {
- return milliseconds_ == other.milliseconds_;
- }
-
- bool Duration::operator!=(const Duration & other) const
- {
- return milliseconds_ != other.milliseconds_;
- }
-
- bool Duration::operator>(const Duration & other) const
- {
- return milliseconds_ > other.milliseconds_;
- }
-
- bool Duration::operator>=(const Duration & other) const
- {
- return milliseconds_ >= other.milliseconds_;
- }
-
- bool Duration::operator<(const Duration & other) const
- {
- return milliseconds_ < other.milliseconds_;
- }
-
- bool Duration::operator<=(const Duration & other) const
- {
- return milliseconds_ <= other.milliseconds_;
- }
-
- float kiwano::time::Duration::operator/(const Duration & other) const
- {
- return static_cast(milliseconds_) / other.milliseconds_;
- }
-
- const Duration Duration::operator+(const Duration & other) const
- {
- return Duration(milliseconds_ + other.milliseconds_);
- }
-
- const Duration Duration::operator-(const Duration & other) const
- {
- return Duration(milliseconds_ - other.milliseconds_);
- }
-
- const Duration Duration::operator-() const
- {
- return Duration(-milliseconds_);
- }
-
- const Duration Duration::operator*(int val) const
- {
- return Duration(milliseconds_ * val);
- }
-
- const Duration kiwano::time::Duration::operator*(unsigned long long val) const
- {
- return Duration(static_cast(milliseconds_ * val));
- }
-
- const Duration Duration::operator*(float val) const
- {
- return Duration(static_cast(milliseconds_ * val));
- }
-
- const Duration Duration::operator*(double val) const
- {
- return Duration(static_cast(milliseconds_ * val));
- }
-
- const Duration Duration::operator*(long double val) const
- {
- return Duration(static_cast(milliseconds_ * val));
- }
-
- const Duration Duration::operator/(int val) const
- {
- return Duration(milliseconds_ / val);
- }
-
- const Duration Duration::operator/(float val) const
- {
- return Duration(static_cast(milliseconds_ / val));
- }
-
- const Duration Duration::operator/(double val) const
- {
- return Duration(static_cast(milliseconds_ / val));
- }
-
- Duration & Duration::operator+=(const Duration &other)
- {
- milliseconds_ += other.milliseconds_;
- return (*this);
- }
-
- Duration & Duration::operator-=(const Duration &other)
- {
- milliseconds_ -= other.milliseconds_;
- return (*this);
- }
-
- Duration & Duration::operator*=(int val)
- {
- milliseconds_ *= val;
- return (*this);
- }
-
- Duration & Duration::operator/=(int val)
- {
- milliseconds_ = static_cast(milliseconds_ / val);
- return (*this);
- }
-
- Duration & Duration::operator*=(float val)
- {
- milliseconds_ = static_cast(milliseconds_ * val);
- return (*this);
- }
-
- Duration & Duration::operator/=(float val)
- {
- milliseconds_ = static_cast(milliseconds_ / val);
- return (*this);
- }
-
- Duration & Duration::operator*=(double val)
- {
- milliseconds_ = static_cast(milliseconds_ * val);
- return (*this);
- }
-
- Duration & Duration::operator/=(double val)
- {
- milliseconds_ = static_cast