[deploy] Tidy

This commit is contained in:
Nomango 2020-02-19 12:09:50 +08:00
parent fcc55bac81
commit 9fbe396e3b
108 changed files with 728 additions and 728 deletions

View File

@ -27,7 +27,7 @@ namespace kiwano
{ {
namespace audio namespace audio
{ {
SoundPtr Sound::Create(String const& file_path) SoundPtr Sound::Create(const String& file_path)
{ {
SoundPtr ptr = new (std::nothrow) Sound; SoundPtr ptr = new (std::nothrow) Sound;
if (ptr) if (ptr)
@ -38,7 +38,7 @@ SoundPtr Sound::Create(String const& file_path)
return ptr; return ptr;
} }
SoundPtr Sound::Create(Resource const& res) SoundPtr Sound::Create(const Resource& res)
{ {
SoundPtr ptr = new (std::nothrow) Sound; SoundPtr ptr = new (std::nothrow) Sound;
if (ptr) if (ptr)
@ -61,7 +61,7 @@ Sound::~Sound()
Close(); Close();
} }
bool Sound::Load(String const& file_path) bool Sound::Load(const String& file_path)
{ {
if (!FileSystem::GetInstance().IsFileExists(file_path)) if (!FileSystem::GetInstance().IsFileExists(file_path))
{ {
@ -93,7 +93,7 @@ bool Sound::Load(String const& file_path)
return true; return true;
} }
bool Sound::Load(Resource const& res) bool Sound::Load(const Resource& res)
{ {
if (opened_) if (opened_)
{ {

View File

@ -50,12 +50,12 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建音频对象 /// @brief 创建音频对象
/// @param res 本地音频文件路径 /// @param res 本地音频文件路径
static SoundPtr Create(String const& file_path); static SoundPtr Create(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 创建音频对象 /// @brief 创建音频对象
/// @param res 音频资源 /// @param res 音频资源
static SoundPtr Create(Resource const& res); static SoundPtr Create(const Resource& res);
Sound(); Sound();
@ -64,12 +64,12 @@ public:
/// \~chinese /// \~chinese
/// @brief 打开本地音频文件 /// @brief 打开本地音频文件
/// @param res 本地音频文件路径 /// @param res 本地音频文件路径
bool Load(String const& file_path); bool Load(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 打开音频资源 /// @brief 打开音频资源
/// @param res 音频资源 /// @param res 音频资源
bool Load(Resource const& res); bool Load(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 是否有效 /// @brief 是否有效

View File

@ -41,7 +41,7 @@ SoundPlayer::~SoundPlayer()
ClearCache(); ClearCache();
} }
size_t SoundPlayer::Load(String const& file_path) size_t SoundPlayer::Load(const String& file_path)
{ {
size_t hash = std::hash<String>()(file_path); size_t hash = std::hash<String>()(file_path);
if (sound_cache_.end() != sound_cache_.find(hash)) if (sound_cache_.end() != sound_cache_.find(hash))
@ -61,7 +61,7 @@ size_t SoundPlayer::Load(String const& file_path)
return 0; return 0;
} }
size_t SoundPlayer::Load(Resource const& res) size_t SoundPlayer::Load(const Resource& res)
{ {
size_t hash_code = static_cast<size_t>(res.GetId()); size_t hash_code = static_cast<size_t>(res.GetId());
if (sound_cache_.end() != sound_cache_.find(hash_code)) if (sound_cache_.end() != sound_cache_.find(hash_code))

View File

@ -52,13 +52,13 @@ public:
/// @brief 加载本地音频文件 /// @brief 加载本地音频文件
/// @param file_path 本地音频文件路径 /// @param file_path 本地音频文件路径
/// @return 音频标识符 /// @return 音频标识符
size_t Load(String const& file_path); size_t Load(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 加载音频资源 /// @brief 加载音频资源
/// @param res 音频资源 /// @param res 音频资源
/// @return 音频标识符 /// @return 音频标识符
size_t Load(Resource const& res); size_t Load(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 播放音频 /// @brief 播放音频

View File

@ -70,7 +70,7 @@ void Transcoder::ClearBuffer()
wave_size_ = 0; wave_size_ = 0;
} }
HRESULT Transcoder::LoadMediaFile(String const& file_path) HRESULT Transcoder::LoadMediaFile(const String& file_path)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
@ -86,7 +86,7 @@ HRESULT Transcoder::LoadMediaFile(String const& file_path)
return hr; return hr;
} }
HRESULT Transcoder::LoadMediaResource(Resource const& res) HRESULT Transcoder::LoadMediaResource(const Resource& res)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;

View File

@ -70,11 +70,11 @@ public:
private: private:
/// \~chinese /// \~chinese
/// @brief 解码本地音频文件 /// @brief 解码本地音频文件
HRESULT LoadMediaFile(String const& file_path); HRESULT LoadMediaFile(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 解码音频资源 /// @brief 解码音频资源
HRESULT LoadMediaResource(Resource const& res); HRESULT LoadMediaResource(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 读取音频源数据 /// @brief 读取音频源数据

View File

@ -31,7 +31,7 @@ ImGuiLayerPtr ImGuiLayer::Create()
return ptr; return ptr;
} }
ImGuiLayerPtr ImGuiLayer::Create(String const& name, ImGuiPipeline const& item) ImGuiLayerPtr ImGuiLayer::Create(const String& name, const ImGuiPipeline& item)
{ {
ImGuiLayerPtr ptr = new (std::nothrow) ImGuiLayer; ImGuiLayerPtr ptr = new (std::nothrow) ImGuiLayer;
if (ptr) if (ptr)
@ -61,12 +61,12 @@ bool ImGuiLayer::CheckVisibility(RenderContext& ctx) const
return true; return true;
} }
void ImGuiLayer::AddItem(String const& name, ImGuiPipeline const& item) void ImGuiLayer::AddItem(const String& name, const ImGuiPipeline& item)
{ {
pipelines_.insert(std::make_pair(name, item)); pipelines_.insert(std::make_pair(name, item));
} }
void ImGuiLayer::RemoveItem(String const& name) void ImGuiLayer::RemoveItem(const String& name)
{ {
auto iter = pipelines_.find(name); auto iter = pipelines_.find(name);
if (iter != pipelines_.end()) if (iter != pipelines_.end())

View File

@ -46,7 +46,7 @@ public:
/// @brief 创建ImGui图层 /// @brief 创建ImGui图层
/// @param name 元素名称 /// @param name 元素名称
/// @param item 管道 /// @param item 管道
static ImGuiLayerPtr Create(String const& name, ImGuiPipeline const& item); static ImGuiLayerPtr Create(const String& name, const ImGuiPipeline& item);
ImGuiLayer(); ImGuiLayer();
@ -56,12 +56,12 @@ public:
/// @brief 添加 ImGui 元素 /// @brief 添加 ImGui 元素
/// @param name 元素名称 /// @param name 元素名称
/// @param item 管道 /// @param item 管道
void AddItem(String const& name, ImGuiPipeline const& item); void AddItem(const String& name, const ImGuiPipeline& item);
/// \~chinese /// \~chinese
/// @brief 移除 ImGui 元素 /// @brief 移除 ImGui 元素
/// @param name 元素名称 /// @param name 元素名称
void RemoveItem(String const& name); void RemoveItem(const String& name);
// 移除所有元素 // 移除所有元素
/// \~chinese /// \~chinese

View File

@ -67,7 +67,7 @@ public:
} }
} }
bool Init(HttpModule* client, Vector<String> const& headers, String const& url, String* response_data, bool Init(HttpModule* client, const Vector<String>& headers, const String& url, String* response_data,
String* response_header, char* error_buffer) String* response_header, char* error_buffer)
{ {
if (!SetOption(CURLOPT_ERRORBUFFER, error_buffer)) if (!SetOption(CURLOPT_ERRORBUFFER, error_buffer))
@ -132,7 +132,7 @@ public:
} }
public: public:
static inline bool GetRequest(HttpModule* client, Vector<String> const& headers, String const& url, static inline bool GetRequest(HttpModule* client, const Vector<String>& headers, const String& url,
long* response_code, String* response_data, String* response_header, long* response_code, String* response_data, String* response_header,
char* error_buffer) char* error_buffer)
{ {
@ -141,8 +141,8 @@ public:
&& curl.SetOption(CURLOPT_FOLLOWLOCATION, true) && curl.Perform(response_code); && curl.SetOption(CURLOPT_FOLLOWLOCATION, true) && curl.Perform(response_code);
} }
static inline bool PostRequest(HttpModule* client, Vector<String> const& headers, String const& url, static inline bool PostRequest(HttpModule* client, const Vector<String>& headers, const String& url,
String const& request_data, long* response_code, String* response_data, const String& request_data, long* response_code, String* response_data,
String* response_header, char* error_buffer) String* response_header, char* error_buffer)
{ {
Curl curl; Curl curl;
@ -151,8 +151,8 @@ public:
&& curl.SetOption(CURLOPT_POSTFIELDSIZE, request_data.size()) && curl.Perform(response_code); && curl.SetOption(CURLOPT_POSTFIELDSIZE, request_data.size()) && curl.Perform(response_code);
} }
static inline bool PutRequest(HttpModule* client, Vector<String> const& headers, String const& url, static inline bool PutRequest(HttpModule* client, const Vector<String>& headers, const String& url,
String const& request_data, long* response_code, String* response_data, const String& request_data, long* response_code, String* response_data,
String* response_header, char* error_buffer) String* response_header, char* error_buffer)
{ {
Curl curl; Curl curl;
@ -162,7 +162,7 @@ public:
&& curl.SetOption(CURLOPT_POSTFIELDSIZE, request_data.size()) && curl.Perform(response_code); && curl.SetOption(CURLOPT_POSTFIELDSIZE, request_data.size()) && curl.Perform(response_code);
} }
static inline bool DeleteRequest(HttpModule* client, Vector<String> const& headers, String const& url, static inline bool DeleteRequest(HttpModule* client, const Vector<String>& headers, const String& url,
long* response_code, String* response_data, String* response_header, long* response_code, String* response_data, String* response_header,
char* error_buffer) char* error_buffer)
{ {

View File

@ -73,11 +73,11 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置SSL证书地址 /// @brief 设置SSL证书地址
void SetSSLVerification(String const& root_certificate_path); void SetSSLVerification(const String& root_certificate_path);
/// \~chinese /// \~chinese
/// @brief 获取SSL证书地址 /// @brief 获取SSL证书地址
String const& GetSSLVerification() const; const String& GetSSLVerification() const;
public: public:
virtual void SetupModule() override; virtual void SetupModule() override;
@ -130,12 +130,12 @@ inline Duration HttpModule::GetTimeoutForRead() const
return timeout_for_read_; return timeout_for_read_;
} }
inline void HttpModule::SetSSLVerification(String const& root_certificate_path) inline void HttpModule::SetSSLVerification(const String& root_certificate_path)
{ {
ssl_verification_ = root_certificate_path; ssl_verification_ = root_certificate_path;
} }
inline String const& HttpModule::GetSSLVerification() const inline const String& HttpModule::GetSSLVerification() const
{ {
return ssl_verification_; return ssl_verification_;
} }

View File

@ -26,7 +26,7 @@ namespace kiwano
namespace network namespace network
{ {
HttpRequestPtr HttpRequest::Create(String const& url, HttpType type, ResponseCallback const& callback) HttpRequestPtr HttpRequest::Create(const String& url, HttpType type, const ResponseCallback& callback)
{ {
HttpRequestPtr ptr = new (std::nothrow) HttpRequest; HttpRequestPtr ptr = new (std::nothrow) HttpRequest;
if (ptr) if (ptr)
@ -38,7 +38,7 @@ HttpRequestPtr HttpRequest::Create(String const& url, HttpType type, ResponseCal
return ptr; return ptr;
} }
HttpRequestPtr HttpRequest::Create(String const& url, HttpType type, String const& data, ResponseCallback const& callback) HttpRequestPtr HttpRequest::Create(const String& url, HttpType type, const String& data, const ResponseCallback& callback)
{ {
HttpRequestPtr ptr = new (std::nothrow) HttpRequest; HttpRequestPtr ptr = new (std::nothrow) HttpRequest;
if (ptr) if (ptr)
@ -51,7 +51,7 @@ HttpRequestPtr HttpRequest::Create(String const& url, HttpType type, String cons
return ptr; return ptr;
} }
HttpRequestPtr HttpRequest::Create(String const& url, HttpType type, Json const& json, ResponseCallback const& callback) HttpRequestPtr HttpRequest::Create(const String& url, HttpType type, const Json& json, const ResponseCallback& callback)
{ {
HttpRequestPtr ptr = new (std::nothrow) HttpRequest; HttpRequestPtr ptr = new (std::nothrow) HttpRequest;
if (ptr) if (ptr)
@ -64,7 +64,7 @@ HttpRequestPtr HttpRequest::Create(String const& url, HttpType type, Json const&
return ptr; return ptr;
} }
void HttpRequest::SetJsonData(Json const& json) void HttpRequest::SetJsonData(const Json& json)
{ {
SetHeader("Content-Type", "application/json;charset=UTF-8"); SetHeader("Content-Type", "application/json;charset=UTF-8");
data_ = json.dump(); data_ = json.dump();

View File

@ -63,7 +63,7 @@ public:
/// @param url 请求地址 /// @param url 请求地址
/// @param type 请求类型 /// @param type 请求类型
/// @param callback 响应回调函数 /// @param callback 响应回调函数
static HttpRequestPtr Create(String const& url, HttpType type, ResponseCallback const& callback); static HttpRequestPtr Create(const String& url, HttpType type, const ResponseCallback& callback);
/// \~chinese /// \~chinese
/// @brief 创建HTTP请求 /// @brief 创建HTTP请求
@ -71,7 +71,7 @@ public:
/// @param type 请求类型 /// @param type 请求类型
/// @param data 请求数据 /// @param data 请求数据
/// @param callback 响应回调函数 /// @param callback 响应回调函数
static HttpRequestPtr Create(String const& url, HttpType type, String const& data, ResponseCallback const& callback); static HttpRequestPtr Create(const String& url, HttpType type, const String& data, const ResponseCallback& callback);
/// \~chinese /// \~chinese
/// @brief 创建HTTP请求 /// @brief 创建HTTP请求
@ -79,7 +79,7 @@ public:
/// @param type 请求类型 /// @param type 请求类型
/// @param json 请求的JSON数据 /// @param json 请求的JSON数据
/// @param callback 响应回调函数 /// @param callback 响应回调函数
static HttpRequestPtr Create(String const& url, HttpType type, Json const& json, ResponseCallback const& callback); static HttpRequestPtr Create(const String& url, HttpType type, const Json& json, const ResponseCallback& callback);
HttpRequest(); HttpRequest();
@ -87,7 +87,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置请求地址 /// @brief 设置请求地址
void SetUrl(String const& url); void SetUrl(const String& url);
/// \~chinese /// \~chinese
/// @brief 设置请求类型 /// @brief 设置请求类型
@ -95,27 +95,27 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置请求数据 /// @brief 设置请求数据
void SetData(String const& data); void SetData(const String& data);
/// \~chinese /// \~chinese
/// @brief 设置请求的JSON数据 /// @brief 设置请求的JSON数据
void SetJsonData(Json const& json); void SetJsonData(const Json& json);
/// \~chinese /// \~chinese
/// @brief 设置HTTP头 /// @brief 设置HTTP头
void SetHeaders(Map<String, String> const& headers); void SetHeaders(const Map<String, String>& headers);
/// \~chinese /// \~chinese
/// @brief 设置HTTP头 /// @brief 设置HTTP头
void SetHeader(String const& field, String const& content); void SetHeader(const String& field, const String& content);
/// \~chinese /// \~chinese
/// @brief 设置响应回调函数 /// @brief 设置响应回调函数
void SetResponseCallback(ResponseCallback const& callback); void SetResponseCallback(const ResponseCallback& callback);
/// \~chinese /// \~chinese
/// @brief 获取请求地址 /// @brief 获取请求地址
String const& GetUrl() const; const String& GetUrl() const;
/// \~chinese /// \~chinese
/// @brief 获取请求类型 /// @brief 获取请求类型
@ -123,7 +123,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取请求数据 /// @brief 获取请求数据
String const& GetData() const; const String& GetData() const;
/// \~chinese /// \~chinese
/// @brief 获取HTTP头 /// @brief 获取HTTP头
@ -131,11 +131,11 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取HTTP头 /// @brief 获取HTTP头
String const& GetHeader(String const& header) const; const String& GetHeader(const String& header) const;
/// \~chinese /// \~chinese
/// @brief 获取响应回调函数 /// @brief 获取响应回调函数
ResponseCallback const& GetResponseCallback() const; const ResponseCallback& GetResponseCallback() const;
private: private:
HttpType type_; HttpType type_;
@ -157,12 +157,12 @@ inline HttpRequest::HttpRequest(HttpType type)
{ {
} }
inline void HttpRequest::SetUrl(String const& url) inline void HttpRequest::SetUrl(const String& url)
{ {
url_ = url; url_ = url;
} }
inline String const& HttpRequest::GetUrl() const inline const String& HttpRequest::GetUrl() const
{ {
return url_; return url_;
} }
@ -177,22 +177,22 @@ inline HttpType HttpRequest::GetType() const
return type_; return type_;
} }
inline void HttpRequest::SetData(String const& data) inline void HttpRequest::SetData(const String& data)
{ {
data_ = data; data_ = data;
} }
inline String const& HttpRequest::GetData() const inline const String& HttpRequest::GetData() const
{ {
return data_; return data_;
} }
inline void HttpRequest::SetHeaders(Map<String, String> const& headers) inline void HttpRequest::SetHeaders(const Map<String, String>& headers)
{ {
headers_ = headers; headers_ = headers;
} }
inline void HttpRequest::SetHeader(String const& field, String const& content) inline void HttpRequest::SetHeader(const String& field, const String& content)
{ {
headers_[field] = content; headers_[field] = content;
} }
@ -202,17 +202,17 @@ inline Map<String, String>& HttpRequest::GetHeaders()
return headers_; return headers_;
} }
inline String const& HttpRequest::GetHeader(String const& header) const inline const String& HttpRequest::GetHeader(const String& header) const
{ {
return headers_.at(header); return headers_.at(header);
} }
inline void HttpRequest::SetResponseCallback(ResponseCallback const& callback) inline void HttpRequest::SetResponseCallback(const ResponseCallback& callback)
{ {
response_cb_ = callback; response_cb_ = callback;
} }
inline HttpRequest::ResponseCallback const& HttpRequest::GetResponseCallback() const inline const HttpRequest::ResponseCallback& HttpRequest::GetResponseCallback() const
{ {
return response_cb_; return response_cb_;
} }

View File

@ -59,11 +59,11 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取响应数据 /// @brief 获取响应数据
String const& GetData() const; const String& GetData() const;
/// \~chinese /// \~chinese
/// @brief 获取错误信息 /// @brief 获取错误信息
String const& GetError() const; const String& GetError() const;
/// \~chinese /// \~chinese
/// @brief 设置响应状态 /// @brief 设置响应状态
@ -75,15 +75,15 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置响应头 /// @brief 设置响应头
void SetHeader(String const& response_header); void SetHeader(const String& response_header);
/// \~chinese /// \~chinese
/// @brief 设置响应数据 /// @brief 设置响应数据
void SetData(String const& response_data); void SetData(const String& response_data);
/// \~chinese /// \~chinese
/// @brief 设置错误信息 /// @brief 设置错误信息
void SetError(String const& error_buffer); void SetError(const String& error_buffer);
private: private:
bool succeed_; bool succeed_;
@ -129,7 +129,7 @@ inline long HttpResponse::GetResponseCode() const
return response_code_; return response_code_;
} }
inline void HttpResponse::SetHeader(String const& response_header) inline void HttpResponse::SetHeader(const String& response_header)
{ {
response_header_ = response_header; response_header_ = response_header;
} }
@ -139,22 +139,22 @@ inline String HttpResponse::GetHeader() const
return response_header_; return response_header_;
} }
inline void HttpResponse::SetData(String const& response_data) inline void HttpResponse::SetData(const String& response_data)
{ {
response_data_ = response_data; response_data_ = response_data;
} }
inline String const& HttpResponse::GetData() const inline const String& HttpResponse::GetData() const
{ {
return response_data_; return response_data_;
} }
inline void HttpResponse::SetError(String const& error_buffer) inline void HttpResponse::SetError(const String& error_buffer)
{ {
error_buffer_ = error_buffer; error_buffer_ = error_buffer;
} }
inline String const& HttpResponse::GetError() const inline const String& HttpResponse::GetError() const
{ {
return error_buffer_; return error_buffer_;
} }

View File

@ -29,7 +29,7 @@ ContactBeginEvent::ContactBeginEvent()
{ {
} }
ContactBeginEvent::ContactBeginEvent(Contact const& contact) ContactBeginEvent::ContactBeginEvent(const Contact& contact)
: ContactBeginEvent() : ContactBeginEvent()
{ {
this->contact = contact; this->contact = contact;
@ -40,7 +40,7 @@ ContactEndEvent::ContactEndEvent()
{ {
} }
ContactEndEvent::ContactEndEvent(Contact const& contact) ContactEndEvent::ContactEndEvent(const Contact& contact)
: ContactEndEvent() : ContactEndEvent()
{ {
this->contact = contact; this->contact = contact;

View File

@ -43,7 +43,7 @@ public:
ContactBeginEvent(); ContactBeginEvent();
ContactBeginEvent(Contact const& contact); ContactBeginEvent(const Contact& contact);
}; };
/// \~chinese /// \~chinese
@ -55,7 +55,7 @@ public:
ContactEndEvent(); ContactEndEvent();
ContactEndEvent(Contact const& contact); ContactEndEvent(const Contact& contact);
}; };
/** @} */ /** @} */

View File

@ -27,7 +27,7 @@ namespace kiwano
namespace physics namespace physics
{ {
FixturePtr Fixture::CreateCircle(Param const& param, float radius, Point const& offset) FixturePtr Fixture::CreateCircle(const Param& param, float radius, const Point& offset)
{ {
FixturePtr ptr = new (std::nothrow) Fixture; FixturePtr ptr = new (std::nothrow) Fixture;
if (ptr) if (ptr)
@ -42,7 +42,7 @@ FixturePtr Fixture::CreateCircle(Param const& param, float radius, Point const&
return ptr; return ptr;
} }
FixturePtr Fixture::CreateRect(Param const& param, Size const& size, Point const& offset, float rotation) FixturePtr Fixture::CreateRect(const Param& param, const Size& size, const Point& offset, float rotation)
{ {
FixturePtr ptr = new (std::nothrow) Fixture; FixturePtr ptr = new (std::nothrow) Fixture;
if (ptr) if (ptr)
@ -59,7 +59,7 @@ FixturePtr Fixture::CreateRect(Param const& param, Size const& size, Point const
return ptr; return ptr;
} }
FixturePtr Fixture::CreatePolygon(Param const& param, Vector<Point> const& vertexs) FixturePtr Fixture::CreatePolygon(const Param& param, const Vector<Point>& vertexs)
{ {
FixturePtr ptr = new (std::nothrow) Fixture; FixturePtr ptr = new (std::nothrow) Fixture;
if (ptr) if (ptr)
@ -80,7 +80,7 @@ FixturePtr Fixture::CreatePolygon(Param const& param, Vector<Point> const& verte
return ptr; return ptr;
} }
FixturePtr Fixture::CreateEdge(Param const& param, Point const& p1, Point const& p2) FixturePtr Fixture::CreateEdge(const Param& param, const Point& p1, const Point& p2)
{ {
FixturePtr ptr = new (std::nothrow) Fixture; FixturePtr ptr = new (std::nothrow) Fixture;
if (ptr) if (ptr)
@ -97,7 +97,7 @@ FixturePtr Fixture::CreateEdge(Param const& param, Point const& p1, Point const&
return ptr; return ptr;
} }
FixturePtr Fixture::CreateChain(Param const& param, Vector<Point> const& vertexs, bool loop) FixturePtr Fixture::CreateChain(const Param& param, const Vector<Point>& vertexs, bool loop)
{ {
FixturePtr ptr = new (std::nothrow) Fixture; FixturePtr ptr = new (std::nothrow) Fixture;
if (ptr) if (ptr)

View File

@ -64,7 +64,7 @@ public:
/// @param param 夹具参数 /// @param param 夹具参数
/// @param radius 圆形半径 /// @param radius 圆形半径
/// @param offset 偏移量 /// @param offset 偏移量
static FixturePtr CreateCircle(Param const& param, float radius, Point const& offset = Point()); static FixturePtr CreateCircle(const Param& param, float radius, const Point& offset = Point());
/// \~chinese /// \~chinese
/// @brief 创建矩形夹具 /// @brief 创建矩形夹具
@ -72,28 +72,28 @@ public:
/// @param size 矩形大小 /// @param size 矩形大小
/// @param offset 偏移量 /// @param offset 偏移量
/// @param rotation 旋转角度 /// @param rotation 旋转角度
static FixturePtr CreateRect(Param const& param, Size const& size, Point const& offset = Point(), static FixturePtr CreateRect(const Param& param, const Size& size, const Point& offset = Point(),
float rotation = 0.f); float rotation = 0.f);
/// \~chinese /// \~chinese
/// @brief 创建多边形夹具 /// @brief 创建多边形夹具
/// @param param 夹具参数 /// @param param 夹具参数
/// @param vertexs 多边形顶点 /// @param vertexs 多边形顶点
static FixturePtr CreatePolygon(Param const& param, Vector<Point> const& vertexs); static FixturePtr CreatePolygon(const Param& param, const Vector<Point>& vertexs);
/// \~chinese /// \~chinese
/// @brief 创建边夹具 /// @brief 创建边夹具
/// @param param 夹具参数 /// @param param 夹具参数
/// @param p1 边的起点 /// @param p1 边的起点
/// @param p2 边的终点 /// @param p2 边的终点
static FixturePtr CreateEdge(Param const& param, Point const& p1, Point const& p2); static FixturePtr CreateEdge(const Param& param, const Point& p1, const Point& p2);
/// \~chinese /// \~chinese
/// @brief 创建链条夹具 /// @brief 创建链条夹具
/// @param param 夹具参数 /// @param param 夹具参数
/// @param vertexs 链条顶点 /// @param vertexs 链条顶点
/// @param loop 是否连接链条的起点和终点 /// @param loop 是否连接链条的起点和终点
static FixturePtr CreateChain(Param const& param, Vector<Point> const& vertexs, bool loop = false); static FixturePtr CreateChain(const Param& param, const Vector<Point>& vertexs, bool loop = false);
Fixture(); Fixture();

View File

@ -109,7 +109,7 @@ void Joint::Destroy()
// DistanceJoint // DistanceJoint
// //
DistanceJointPtr DistanceJoint::Create(Param const& param) DistanceJointPtr DistanceJoint::Create(const Param& param)
{ {
DistanceJointPtr ptr = new (std::nothrow) DistanceJoint; DistanceJointPtr ptr = new (std::nothrow) DistanceJoint;
if (ptr) if (ptr)
@ -155,7 +155,7 @@ float DistanceJoint::GetLength() const
// FrictionJoint // FrictionJoint
// //
FrictionJointPtr FrictionJoint::Create(Param const& param) FrictionJointPtr FrictionJoint::Create(const Param& param)
{ {
FrictionJointPtr ptr = new (std::nothrow) FrictionJoint; FrictionJointPtr ptr = new (std::nothrow) FrictionJoint;
if (ptr) if (ptr)
@ -212,7 +212,7 @@ float FrictionJoint::GetMaxTorque() const
// GearJoint // GearJoint
// //
GearJointPtr GearJoint::Create(Param const& param) GearJointPtr GearJoint::Create(const Param& param)
{ {
GearJointPtr ptr = new (std::nothrow) GearJoint; GearJointPtr ptr = new (std::nothrow) GearJoint;
if (ptr) if (ptr)
@ -257,7 +257,7 @@ float GearJoint::GetRatio() const
// MotorJoint // MotorJoint
// //
MotorJointPtr MotorJoint::Create(Param const& param) MotorJointPtr MotorJoint::Create(const Param& param)
{ {
MotorJointPtr ptr = new (std::nothrow) MotorJoint; MotorJointPtr ptr = new (std::nothrow) MotorJoint;
if (ptr) if (ptr)
@ -315,7 +315,7 @@ float MotorJoint::GetMaxTorque() const
// PrismaticJoint // PrismaticJoint
// //
PrismaticJointPtr PrismaticJoint::Create(Param const& param) PrismaticJointPtr PrismaticJoint::Create(const Param& param)
{ {
PrismaticJointPtr ptr = new (std::nothrow) PrismaticJoint; PrismaticJointPtr ptr = new (std::nothrow) PrismaticJoint;
if (ptr) if (ptr)
@ -383,7 +383,7 @@ void PrismaticJoint::SetLimits(float lower, float upper)
// PulleyJoint // PulleyJoint
// //
PulleyJointPtr PulleyJoint::Create(Param const& param) PulleyJointPtr PulleyJoint::Create(const Param& param)
{ {
PulleyJointPtr ptr = new (std::nothrow) PulleyJoint; PulleyJointPtr ptr = new (std::nothrow) PulleyJoint;
if (ptr) if (ptr)
@ -458,7 +458,7 @@ float PulleyJoint::GetCurrentLengthB() const
// RevoluteJoint // RevoluteJoint
// //
RevoluteJointPtr RevoluteJoint::Create(Param const& param) RevoluteJointPtr RevoluteJoint::Create(const Param& param)
{ {
RevoluteJointPtr ptr = new (std::nothrow) RevoluteJoint; RevoluteJointPtr ptr = new (std::nothrow) RevoluteJoint;
if (ptr) if (ptr)
@ -537,7 +537,7 @@ float RevoluteJoint::GetMaxMotorTorque() const
// RopeJoint // RopeJoint
// //
RopeJointPtr RopeJoint::Create(Param const& param) RopeJointPtr RopeJoint::Create(const Param& param)
{ {
RopeJointPtr ptr = new (std::nothrow) RopeJoint; RopeJointPtr ptr = new (std::nothrow) RopeJoint;
if (ptr) if (ptr)
@ -584,7 +584,7 @@ float RopeJoint::GetMaxLength() const
// WeldJoint // WeldJoint
// //
WeldJointPtr WeldJoint::Create(Param const& param) WeldJointPtr WeldJoint::Create(const Param& param)
{ {
WeldJointPtr ptr = new (std::nothrow) WeldJoint; WeldJointPtr ptr = new (std::nothrow) WeldJoint;
if (ptr) if (ptr)
@ -617,7 +617,7 @@ bool WeldJoint::Init(PhysicWorld* world)
// WheelJoint // WheelJoint
// //
WheelJointPtr WheelJoint::Create(Param const& param) WheelJointPtr WheelJoint::Create(const Param& param)
{ {
WheelJointPtr ptr = new (std::nothrow) WheelJoint; WheelJointPtr ptr = new (std::nothrow) WheelJoint;
if (ptr) if (ptr)
@ -678,7 +678,7 @@ float WheelJoint::GetMaxMotorTorque() const
// MouseJoint // MouseJoint
// //
MouseJointPtr MouseJoint::Create(Param const& param) MouseJointPtr MouseJoint::Create(const Param& param)
{ {
MouseJointPtr ptr = new (std::nothrow) MouseJoint; MouseJointPtr ptr = new (std::nothrow) MouseJoint;
if (ptr) if (ptr)

View File

@ -147,7 +147,7 @@ public:
{ {
} }
Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, Point const& anchor_a, Point const& anchor_b) Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, const Point& anchor_a, const Point& anchor_b)
: ParamBase(body_a, body_b) : ParamBase(body_a, body_b)
, anchor_a(anchor_a) , anchor_a(anchor_a)
, anchor_b(anchor_b) , anchor_b(anchor_b)
@ -160,7 +160,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建固定距离关节 /// @brief 创建固定距离关节
/// @param param 关节参数 /// @param param 关节参数
static DistanceJointPtr Create(Param const& param); static DistanceJointPtr Create(const Param& param);
DistanceJoint(); DistanceJoint();
@ -213,7 +213,7 @@ public:
{ {
} }
Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, Point const& anchor, float max_force = 0.f, float max_torque = 0.f) Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, const Point& anchor, float max_force = 0.f, float max_torque = 0.f)
: ParamBase(body_a, body_b) : ParamBase(body_a, body_b)
, anchor(anchor) , anchor(anchor)
, max_force(max_force) , max_force(max_force)
@ -225,7 +225,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建摩擦关节 /// @brief 创建摩擦关节
/// @param param 关节参数 /// @param param 关节参数
static FrictionJointPtr Create(Param const& param); static FrictionJointPtr Create(const Param& param);
FrictionJoint(); FrictionJoint();
@ -284,7 +284,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建齿轮关节 /// @brief 创建齿轮关节
/// @param param 关节参数 /// @param param 关节参数
static GearJointPtr Create(Param const& param); static GearJointPtr Create(const Param& param);
GearJoint(); GearJoint();
@ -335,7 +335,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建马达关节 /// @brief 创建马达关节
/// @param param 关节参数 /// @param param 关节参数
static MotorJointPtr Create(Param const& param); static MotorJointPtr Create(const Param& param);
MotorJoint(); MotorJoint();
@ -387,7 +387,7 @@ public:
{ {
} }
Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, Point const& anchor, Vec2 const& axis) Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, const Point& anchor, const Vec2& axis)
: ParamBase(body_a, body_b) : ParamBase(body_a, body_b)
, anchor(anchor) , anchor(anchor)
, axis(axis) , axis(axis)
@ -404,7 +404,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建平移关节 /// @brief 创建平移关节
/// @param param 关节参数 /// @param param 关节参数
static PrismaticJointPtr Create(Param const& param); static PrismaticJointPtr Create(const Param& param);
PrismaticJoint(); PrismaticJoint();
@ -493,8 +493,8 @@ public:
{ {
} }
Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, Point const& anchor_a, Point const& anchor_b, Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, const Point& anchor_a, const Point& anchor_b,
Point const& ground_anchor_a, Point const& ground_anchor_b, float ratio = 1.0f) const Point& ground_anchor_a, const Point& ground_anchor_b, float ratio = 1.0f)
: ParamBase(body_a, body_b) : ParamBase(body_a, body_b)
, anchor_a(anchor_a) , anchor_a(anchor_a)
, anchor_b(anchor_b) , anchor_b(anchor_b)
@ -508,7 +508,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建滑轮关节 /// @brief 创建滑轮关节
/// @param param 关节参数 /// @param param 关节参数
static PulleyJointPtr Create(Param const& param); static PulleyJointPtr Create(const Param& param);
PulleyJoint(); PulleyJoint();
@ -571,7 +571,7 @@ public:
{ {
} }
Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, Point const& anchor) Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, const Point& anchor)
: ParamBase(body_a, body_b) : ParamBase(body_a, body_b)
, anchor(anchor) , anchor(anchor)
, enable_limit(false) , enable_limit(false)
@ -587,7 +587,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建旋转关节 /// @brief 创建旋转关节
/// @param param 关节参数 /// @param param 关节参数
static RevoluteJointPtr Create(Param const& param); static RevoluteJointPtr Create(const Param& param);
RevoluteJoint(); RevoluteJoint();
@ -674,7 +674,7 @@ public:
{ {
} }
Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, Point const& local_anchor_a, Point const& local_anchor_b) Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, const Point& local_anchor_a, const Point& local_anchor_b)
: ParamBase(body_a, body_b) : ParamBase(body_a, body_b)
, local_anchor_a(local_anchor_a) , local_anchor_a(local_anchor_a)
, local_anchor_b(local_anchor_b) , local_anchor_b(local_anchor_b)
@ -686,7 +686,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建绳关节 /// @brief 创建绳关节
/// @param param 关节参数 /// @param param 关节参数
static RopeJointPtr Create(Param const& param); static RopeJointPtr Create(const Param& param);
RopeJoint(); RopeJoint();
@ -725,7 +725,7 @@ public:
{ {
} }
Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, Point const& anchor) Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, const Point& anchor)
: ParamBase(body_a, body_b) : ParamBase(body_a, body_b)
, anchor(anchor) , anchor(anchor)
, frequency_hz(0.0f) , frequency_hz(0.0f)
@ -737,7 +737,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建焊接关节 /// @brief 创建焊接关节
/// @param param 关节参数 /// @param param 关节参数
static WeldJointPtr Create(Param const& param); static WeldJointPtr Create(const Param& param);
WeldJoint(); WeldJoint();
@ -792,7 +792,7 @@ public:
{ {
} }
Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, Point const& anchor, Vec2 const& axis) Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, const Point& anchor, const Vec2& axis)
: ParamBase(body_a, body_b) : ParamBase(body_a, body_b)
, anchor(anchor) , anchor(anchor)
, axis(axis) , axis(axis)
@ -808,7 +808,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建轮关节 /// @brief 创建轮关节
/// @param param 关节参数 /// @param param 关节参数
static WheelJointPtr Create(Param const& param); static WheelJointPtr Create(const Param& param);
WheelJoint(); WheelJoint();
@ -897,7 +897,7 @@ public:
{ {
} }
Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, Point const& target) Param(PhysicBodyPtr body_a, PhysicBodyPtr body_b, const Point& target)
: ParamBase(body_a, body_b) : ParamBase(body_a, body_b)
, target(target) , target(target)
, max_force(0.0f) , max_force(0.0f)
@ -910,7 +910,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建鼠标关节 /// @brief 创建鼠标关节
/// @param param 关节参数 /// @param param 关节参数
static MouseJointPtr Create(Param const& param); static MouseJointPtr Create(const Param& param);
MouseJoint(); MouseJoint();

View File

@ -129,28 +129,28 @@ Fixture* PhysicBody::AddCircleShape(float radius, float density, float friction)
return fixture.Get(); return fixture.Get();
} }
Fixture* PhysicBody::AddRectShape(Vec2 const& size, float density, float friction) Fixture* PhysicBody::AddRectShape(const Vec2& size, float density, float friction)
{ {
FixturePtr fixture = Fixture::CreateRect(Fixture::Param(density, friction), size); FixturePtr fixture = Fixture::CreateRect(Fixture::Param(density, friction), size);
AddFixture(fixture); AddFixture(fixture);
return fixture.Get(); return fixture.Get();
} }
Fixture* PhysicBody::AddPolygonShape(Vector<Point> const& vertexs, float density, float friction) Fixture* PhysicBody::AddPolygonShape(const Vector<Point>& vertexs, float density, float friction)
{ {
FixturePtr fixture = Fixture::CreatePolygon(Fixture::Param(density, friction), vertexs); FixturePtr fixture = Fixture::CreatePolygon(Fixture::Param(density, friction), vertexs);
AddFixture(fixture); AddFixture(fixture);
return fixture.Get(); return fixture.Get();
} }
Fixture* PhysicBody::AddEdgeShape(Point const& p1, Point const& p2, float density, float friction) Fixture* PhysicBody::AddEdgeShape(const Point& p1, const Point& p2, float density, float friction)
{ {
FixturePtr fixture = Fixture::CreateEdge(Fixture::Param(density, friction), p1, p2); FixturePtr fixture = Fixture::CreateEdge(Fixture::Param(density, friction), p1, p2);
AddFixture(fixture); AddFixture(fixture);
return fixture.Get(); return fixture.Get();
} }
Fixture* PhysicBody::AddChainShape(Vector<Point> const& vertexs, bool loop, float density, float friction) Fixture* PhysicBody::AddChainShape(const Vector<Point>& vertexs, bool loop, float density, float friction)
{ {
FixturePtr fixture = Fixture::CreateChain(Fixture::Param(density, friction), vertexs, loop); FixturePtr fixture = Fixture::CreateChain(Fixture::Param(density, friction), vertexs, loop);
AddFixture(fixture); AddFixture(fixture);
@ -245,7 +245,7 @@ void PhysicBody::GetMassData(float* mass, Point* center, float* inertia) const
*inertia = data.I; *inertia = data.I;
} }
void PhysicBody::SetMassData(float mass, Point const& center, float inertia) void PhysicBody::SetMassData(float mass, const Point& center, float inertia)
{ {
KGE_ASSERT(body_); KGE_ASSERT(body_);
@ -268,19 +268,19 @@ Point PhysicBody::GetPosition() const
return global::ToPixels(body_->GetPosition()); return global::ToPixels(body_->GetPosition());
} }
void PhysicBody::SetTransform(Point const& pos, float angle) void PhysicBody::SetTransform(const Point& pos, float angle)
{ {
KGE_ASSERT(body_); KGE_ASSERT(body_);
body_->SetTransform(global::ToMeters(pos), math::Degree2Radian(angle)); body_->SetTransform(global::ToMeters(pos), math::Degree2Radian(angle));
} }
Point PhysicBody::GetLocalPoint(Point const& world) const Point PhysicBody::GetLocalPoint(const Point& world) const
{ {
KGE_ASSERT(body_); KGE_ASSERT(body_);
return global::ToPixels(body_->GetLocalPoint(global::ToMeters(world))); return global::ToPixels(body_->GetLocalPoint(global::ToMeters(world)));
} }
Point PhysicBody::GetWorldPoint(Point const& local) const Point PhysicBody::GetWorldPoint(const Point& local) const
{ {
KGE_ASSERT(body_); KGE_ASSERT(body_);
return global::ToPixels(body_->GetWorldPoint(global::ToMeters(local))); return global::ToPixels(body_->GetWorldPoint(global::ToMeters(local)));
@ -298,13 +298,13 @@ Point PhysicBody::GetWorldCenter() const
return global::ToPixels(body_->GetWorldCenter()); return global::ToPixels(body_->GetWorldCenter());
} }
void PhysicBody::ApplyForce(Vec2 const& force, Point const& point, bool wake) void PhysicBody::ApplyForce(const Vec2& force, const Point& point, bool wake)
{ {
KGE_ASSERT(body_); KGE_ASSERT(body_);
body_->ApplyForce(b2Vec2(force.x, force.y), global::ToMeters(point), wake); body_->ApplyForce(b2Vec2(force.x, force.y), global::ToMeters(point), wake);
} }
void PhysicBody::ApplyForceToCenter(Vec2 const& force, bool wake) void PhysicBody::ApplyForceToCenter(const Vec2& force, bool wake)
{ {
KGE_ASSERT(body_); KGE_ASSERT(body_);
body_->ApplyForceToCenter(b2Vec2(force.x, force.y), wake); body_->ApplyForceToCenter(b2Vec2(force.x, force.y), wake);

View File

@ -87,27 +87,27 @@ public:
/// @brief 添加矩形夹具 /// @brief 添加矩形夹具
/// @param size 矩形大小 /// @param size 矩形大小
/// @param density 物体密度 /// @param density 物体密度
Fixture* AddRectShape(Vec2 const& size, float density, float friction = 0.2f); Fixture* AddRectShape(const Vec2& size, float density, float friction = 0.2f);
/// \~chinese /// \~chinese
/// @brief 添加多边形夹具 /// @brief 添加多边形夹具
/// @param vertexs 多边形端点 /// @param vertexs 多边形端点
/// @param density 物体密度 /// @param density 物体密度
Fixture* AddPolygonShape(Vector<Point> const& vertexs, float density, float friction = 0.2f); Fixture* AddPolygonShape(const Vector<Point>& vertexs, float density, float friction = 0.2f);
/// \~chinese /// \~chinese
/// @brief 添加线段形夹具 /// @brief 添加线段形夹具
/// @param p1 线段起点 /// @param p1 线段起点
/// @param p2 线段终点 /// @param p2 线段终点
/// @param density 物体密度 /// @param density 物体密度
Fixture* AddEdgeShape(Point const& p1, Point const& p2, float density, float friction = 0.2f); Fixture* AddEdgeShape(const Point& p1, const Point& p2, float density, float friction = 0.2f);
/// \~chinese /// \~chinese
/// @brief 添加链条形夹具 /// @brief 添加链条形夹具
/// @param vertexs 链条端点 /// @param vertexs 链条端点
/// @param loop 是否闭合 /// @param loop 是否闭合
/// @param density 物体密度 /// @param density 物体密度
Fixture* AddChainShape(Vector<Point> const& vertexs, bool loop, float density, float friction = 0.2f); Fixture* AddChainShape(const Vector<Point>& vertexs, bool loop, float density, float friction = 0.2f);
/// \~chinese /// \~chinese
/// @brief 移除夹具 /// @brief 移除夹具
@ -163,11 +163,11 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置物体位置 /// @brief 设置物体位置
void SetPosition(Point const& pos); void SetPosition(const Point& pos);
/// \~chinese /// \~chinese
/// @brief 位置和旋转变换 /// @brief 位置和旋转变换
void SetTransform(Point const& pos, float angle); void SetTransform(const Point& pos, float angle);
/// \~chinese /// \~chinese
/// @brief 获取质量 [kg] /// @brief 获取质量 [kg]
@ -189,7 +189,7 @@ public:
/// @param mass 物体质量 [kg] /// @param mass 物体质量 [kg]
/// @param center 质心位置 /// @param center 质心位置
/// @param inertia 惯性 /// @param inertia 惯性
void SetMassData(float mass, Point const& center, float inertia); void SetMassData(float mass, const Point& center, float inertia);
/// \~chinese /// \~chinese
/// @brief 重置质量数据 /// @brief 重置质量数据
@ -197,11 +197,11 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取世界坐标系上的点在物体上的位置 /// @brief 获取世界坐标系上的点在物体上的位置
Point GetLocalPoint(Point const& world) const; Point GetLocalPoint(const Point& world) const;
/// \~chinese /// \~chinese
/// @brief 获取物体上的点在世界坐标系的位置 /// @brief 获取物体上的点在世界坐标系的位置
Point GetWorldPoint(Point const& local) const; Point GetWorldPoint(const Point& local) const;
/// \~chinese /// \~chinese
/// @brief 获取物体质心相对于物体的位置 /// @brief 获取物体质心相对于物体的位置
@ -232,13 +232,13 @@ public:
/// @param force 力的大小和方向 /// @param force 力的大小和方向
/// @param point 施力点 /// @param point 施力点
/// @param wake 是否唤醒物体 /// @param wake 是否唤醒物体
void ApplyForce(Vec2 const& force, Point const& point, bool wake = true); void ApplyForce(const Vec2& force, const Point& point, bool wake = true);
/// \~chinese /// \~chinese
/// @brief 给物体中心施力 /// @brief 给物体中心施力
/// @param force 力的大小和方向 /// @param force 力的大小和方向
/// @param wake 是否唤醒物体 /// @param wake 是否唤醒物体
void ApplyForceToCenter(Vec2 const& force, bool wake = true); void ApplyForceToCenter(const Vec2& force, bool wake = true);
/// \~chinese /// \~chinese
/// @brief 施加扭矩 /// @brief 施加扭矩
@ -383,7 +383,7 @@ inline void PhysicBody::SetRotation(float angle)
SetTransform(GetPosition(), angle); SetTransform(GetPosition(), angle);
} }
inline void PhysicBody::SetPosition(Point const& pos) inline void PhysicBody::SetPosition(const Point& pos)
{ {
SetTransform(pos, GetRotation()); SetTransform(pos, GetRotation());
} }

View File

@ -434,7 +434,7 @@ void Actor::SetCascadeOpacityEnabled(bool enabled)
UpdateOpacity(); UpdateOpacity();
} }
void Actor::SetAnchor(Vec2 const& anchor) void Actor::SetAnchor(const Vec2& anchor)
{ {
if (anchor_ == anchor) if (anchor_ == anchor)
return; return;
@ -443,7 +443,7 @@ void Actor::SetAnchor(Vec2 const& anchor)
dirty_transform_ = true; dirty_transform_ = true;
} }
void Actor::SetSize(Size const& size) void Actor::SetSize(const Size& size)
{ {
if (size_ == size) if (size_ == size)
return; return;
@ -452,7 +452,7 @@ void Actor::SetSize(Size const& size)
dirty_transform_ = true; dirty_transform_ = true;
} }
void Actor::SetTransform(Transform const& transform) void Actor::SetTransform(const Transform& transform)
{ {
transform_ = transform; transform_ = transform;
dirty_transform_ = true; dirty_transform_ = true;
@ -464,7 +464,7 @@ void Actor::SetVisible(bool val)
visible_ = val; visible_ = val;
} }
void Actor::SetName(String const& name) void Actor::SetName(const String& name)
{ {
if (!IsName(name)) if (!IsName(name))
{ {
@ -482,7 +482,7 @@ void Actor::SetPosition(const Point& pos)
dirty_transform_ = true; dirty_transform_ = true;
} }
void Actor::SetScale(Vec2 const& scale) void Actor::SetScale(const Vec2& scale)
{ {
if (transform_.scale == scale) if (transform_.scale == scale)
return; return;
@ -492,7 +492,7 @@ void Actor::SetScale(Vec2 const& scale)
is_fast_transform_ = false; is_fast_transform_ = false;
} }
void Actor::SetSkew(Vec2 const& skew) void Actor::SetSkew(const Vec2& skew)
{ {
if (transform_.skew == skew) if (transform_.skew == skew)
return; return;
@ -544,7 +544,7 @@ void Actor::AddChild(ActorPtr child, int zorder)
} }
} }
void Actor::AddChildren(Vector<ActorPtr> const& children) void Actor::AddChildren(const Vector<ActorPtr>& children)
{ {
for (const auto& actor : children) for (const auto& actor : children)
{ {
@ -562,7 +562,7 @@ Rect Actor::GetBoundingBox() const
return GetTransformMatrix().Transform(GetBounds()); return GetTransformMatrix().Transform(GetBounds());
} }
Vector<ActorPtr> Actor::GetChildren(String const& name) const Vector<ActorPtr> Actor::GetChildren(const String& name) const
{ {
Vector<ActorPtr> children; Vector<ActorPtr> children;
size_t hash_code = std::hash<String>{}(name); size_t hash_code = std::hash<String>{}(name);
@ -577,7 +577,7 @@ Vector<ActorPtr> Actor::GetChildren(String const& name) const
return children; return children;
} }
ActorPtr Actor::GetChild(String const& name) const ActorPtr Actor::GetChild(const String& name) const
{ {
size_t hash_code = std::hash<String>{}(name); size_t hash_code = std::hash<String>{}(name);
@ -596,7 +596,7 @@ ActorList& Actor::GetAllChildren()
return children_; return children_;
} }
ActorList const& Actor::GetAllChildren() const const ActorList& Actor::GetAllChildren() const
{ {
return children_; return children_;
} }
@ -641,7 +641,7 @@ void Actor::RemoveComponent(ComponentPtr component)
} }
} }
void Actor::RemoveComponents(String const& name) void Actor::RemoveComponents(const String& name)
{ {
if (!components_.IsEmpty()) if (!components_.IsEmpty())
{ {
@ -691,7 +691,7 @@ void Actor::RemoveChild(ActorPtr child)
} }
} }
void Actor::RemoveChildren(String const& child_name) void Actor::RemoveChildren(const String& child_name)
{ {
if (children_.IsEmpty()) if (children_.IsEmpty())
{ {

View File

@ -231,11 +231,11 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置名称 /// @brief 设置名称
void SetName(String const& name); void SetName(const String& name);
/// \~chinese /// \~chinese
/// @brief 设置坐标 /// @brief 设置坐标
virtual void SetPosition(Point const& point); virtual void SetPosition(const Point& point);
/// \~chinese /// \~chinese
/// @brief 设置坐标 /// @brief 设置坐标
@ -251,7 +251,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 移动坐标 /// @brief 移动坐标
void Move(Vec2 const& v); void Move(const Vec2& v);
/// \~chinese /// \~chinese
/// @brief 移动坐标 /// @brief 移动坐标
@ -259,7 +259,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置缩放比例,默认为 (1.0, 1.0) /// @brief 设置缩放比例,默认为 (1.0, 1.0)
virtual void SetScale(Vec2 const& scale); virtual void SetScale(const Vec2& scale);
/// \~chinese /// \~chinese
/// @brief 设置缩放比例,默认为 (1.0, 1.0) /// @brief 设置缩放比例,默认为 (1.0, 1.0)
@ -267,7 +267,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置错切角度,默认为 (0, 0) /// @brief 设置错切角度,默认为 (0, 0)
virtual void SetSkew(Vec2 const& skew); virtual void SetSkew(const Vec2& skew);
/// \~chinese /// \~chinese
/// @brief 设置错切角度,默认为 (0, 0) /// @brief 设置错切角度,默认为 (0, 0)
@ -279,7 +279,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置锚点位置,默认为 (0, 0), 范围 [0, 1] /// @brief 设置锚点位置,默认为 (0, 0), 范围 [0, 1]
virtual void SetAnchor(Vec2 const& anchor); virtual void SetAnchor(const Vec2& anchor);
/// \~chinese /// \~chinese
/// @brief 设置锚点位置,默认为 (0, 0), 范围 [0, 1] /// @brief 设置锚点位置,默认为 (0, 0), 范围 [0, 1]
@ -287,7 +287,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 修改大小 /// @brief 修改大小
virtual void SetSize(Size const& size); virtual void SetSize(const Size& size);
/// \~chinese /// \~chinese
/// @brief 修改大小 /// @brief 修改大小
@ -311,7 +311,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置二维仿射变换 /// @brief 设置二维仿射变换
void SetTransform(Transform const& transform); void SetTransform(const Transform& transform);
/// \~chinese /// \~chinese
/// @brief 设置 Z 轴顺序,默认为 0 /// @brief 设置 Z 轴顺序,默认为 0
@ -328,15 +328,15 @@ public:
/// \~chinese /// \~chinese
/// @brief 添加多个子角色 /// @brief 添加多个子角色
void AddChildren(Vector<ActorPtr> const& children); void AddChildren(const Vector<ActorPtr>& children);
/// \~chinese /// \~chinese
/// @brief 获取名称相同的子角色 /// @brief 获取名称相同的子角色
ActorPtr GetChild(String const& name) const; ActorPtr GetChild(const String& name) const;
/// \~chinese /// \~chinese
/// @brief 获取所有名称相同的子角色 /// @brief 获取所有名称相同的子角色
Vector<ActorPtr> GetChildren(String const& name) const; Vector<ActorPtr> GetChildren(const String& name) const;
/// \~chinese /// \~chinese
/// @brief 获取全部子角色 /// @brief 获取全部子角色
@ -344,7 +344,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取全部子角色 /// @brief 获取全部子角色
ActorList const& GetAllChildren() const; const ActorList& GetAllChildren() const;
/// \~chinese /// \~chinese
/// @brief 移除子角色 /// @brief 移除子角色
@ -352,7 +352,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 移除所有名称相同的子角色 /// @brief 移除所有名称相同的子角色
void RemoveChildren(String const& child_name); void RemoveChildren(const String& child_name);
/// \~chinese /// \~chinese
/// @brief 移除所有角色 /// @brief 移除所有角色
@ -382,7 +382,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 移除组件 /// @brief 移除组件
/// @param name 组件名称 /// @param name 组件名称
void RemoveComponents(String const& name); void RemoveComponents(const String& name);
/// \~chinese /// \~chinese
/// @brief 移除所有组件 /// @brief 移除所有组件
@ -402,7 +402,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置更新时的回调函数 /// @brief 设置更新时的回调函数
void SetCallbackOnUpdate(UpdateCallback const& cb); void SetCallbackOnUpdate(const UpdateCallback& cb);
/// \~chinese /// \~chinese
/// @brief 获取更新时的回调函数 /// @brief 获取更新时的回调函数
@ -673,7 +673,7 @@ inline bool Actor::IsUpdatePausing() const
return update_pausing_; return update_pausing_;
} }
inline void Actor::SetCallbackOnUpdate(UpdateCallback const& cb) inline void Actor::SetCallbackOnUpdate(const UpdateCallback& cb)
{ {
cb_update_ = cb; cb_update_ = cb;
} }
@ -703,7 +703,7 @@ inline void Actor::SetPositionY(float y)
this->SetPosition(Point(transform_.position.x, y)); this->SetPosition(Point(transform_.position.x, y));
} }
inline void Actor::Move(Vec2 const& v) inline void Actor::Move(const Vec2& v)
{ {
this->SetPosition(transform_.position.x + v.x, transform_.position.y + v.y); this->SetPosition(transform_.position.x + v.x, transform_.position.y + v.y);
} }

View File

@ -25,13 +25,13 @@
namespace kiwano namespace kiwano
{ {
ButtonPtr Button::Create(Callback const& click) ButtonPtr Button::Create(const Callback& click)
{ {
return Button::Create(click, nullptr, nullptr, nullptr); return Button::Create(click, nullptr, nullptr, nullptr);
} }
ButtonPtr Button::Create(Callback const& click, Callback const& pressed, Callback const& mouse_over, ButtonPtr Button::Create(const Callback& click, const Callback& pressed, const Callback& mouse_over,
Callback const& mouse_out) const Callback& mouse_out)
{ {
ButtonPtr ptr = new (std::nothrow) Button; ButtonPtr ptr = new (std::nothrow) Button;
if (ptr) if (ptr)

View File

@ -40,7 +40,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建按钮 /// @brief 创建按钮
/// @param click 按钮点击回调函数 /// @param click 按钮点击回调函数
static ButtonPtr Create(Callback const& click); static ButtonPtr Create(const Callback& click);
/// \~chinese /// \~chinese
/// @brief 创建按钮 /// @brief 创建按钮
@ -48,8 +48,8 @@ public:
/// @param pressed 按钮按下回调函数 /// @param pressed 按钮按下回调函数
/// @param mouse_over 按钮移入回调函数 /// @param mouse_over 按钮移入回调函数
/// @param mouse_out 按钮移出回调函数 /// @param mouse_out 按钮移出回调函数
static ButtonPtr Create(Callback const& click, Callback const& pressed, Callback const& mouse_over, static ButtonPtr Create(const Callback& click, const Callback& pressed, const Callback& mouse_over,
Callback const& mouse_out); const Callback& mouse_out);
Button(); Button();

View File

@ -25,7 +25,7 @@
namespace kiwano namespace kiwano
{ {
CanvasPtr Canvas::Create(Size const& size) CanvasPtr Canvas::Create(const Size& size)
{ {
CanvasPtr ptr = new (std::nothrow) Canvas; CanvasPtr ptr = new (std::nothrow) Canvas;
if (ptr) if (ptr)
@ -81,13 +81,13 @@ void Canvas::SetBrush(BrushPtr brush)
ctx_->SetCurrentBrush(brush); ctx_->SetCurrentBrush(brush);
} }
void Canvas::SetBrushTransform(Transform const& transform) void Canvas::SetBrushTransform(const Transform& transform)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
ctx_->SetTransform(transform.ToMatrix()); ctx_->SetTransform(transform.ToMatrix());
} }
void Canvas::SetBrushTransform(Matrix3x2 const& transform) void Canvas::SetBrushTransform(const Matrix3x2& transform)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
ctx_->SetTransform(transform); ctx_->SetTransform(transform);
@ -108,7 +108,7 @@ void Canvas::PopLayer()
ctx_->PopLayer(); ctx_->PopLayer();
} }
void Canvas::PushClipRect(Rect const& clip_rect) void Canvas::PushClipRect(const Rect& clip_rect)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
ctx_->PushClipRect(clip_rect); ctx_->PushClipRect(clip_rect);
@ -132,7 +132,7 @@ void Canvas::DrawShape(ShapePtr shape)
} }
} }
void Canvas::DrawLine(Point const& begin, Point const& end) void Canvas::DrawLine(const Point& begin, const Point& end)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
ctx_->SetCurrentBrush(stroke_brush_); ctx_->SetCurrentBrush(stroke_brush_);
@ -141,7 +141,7 @@ void Canvas::DrawLine(Point const& begin, Point const& end)
cache_expired_ = true; cache_expired_ = true;
} }
void Canvas::DrawCircle(Point const& center, float radius) void Canvas::DrawCircle(const Point& center, float radius)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
ctx_->SetCurrentBrush(stroke_brush_); ctx_->SetCurrentBrush(stroke_brush_);
@ -150,7 +150,7 @@ void Canvas::DrawCircle(Point const& center, float radius)
cache_expired_ = true; cache_expired_ = true;
} }
void Canvas::DrawEllipse(Point const& center, Vec2 const& radius) void Canvas::DrawEllipse(const Point& center, const Vec2& radius)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
ctx_->SetCurrentBrush(stroke_brush_); ctx_->SetCurrentBrush(stroke_brush_);
@ -159,7 +159,7 @@ void Canvas::DrawEllipse(Point const& center, Vec2 const& radius)
cache_expired_ = true; cache_expired_ = true;
} }
void Canvas::DrawRect(Rect const& rect) void Canvas::DrawRect(const Rect& rect)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
ctx_->SetCurrentBrush(stroke_brush_); ctx_->SetCurrentBrush(stroke_brush_);
@ -168,7 +168,7 @@ void Canvas::DrawRect(Rect const& rect)
cache_expired_ = true; cache_expired_ = true;
} }
void Canvas::DrawRoundedRect(Rect const& rect, Vec2 const& radius) void Canvas::DrawRoundedRect(const Rect& rect, const Vec2& radius)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
ctx_->SetCurrentBrush(stroke_brush_); ctx_->SetCurrentBrush(stroke_brush_);
@ -188,7 +188,7 @@ void Canvas::FillShape(ShapePtr shape)
} }
} }
void Canvas::FillCircle(Point const& center, float radius) void Canvas::FillCircle(const Point& center, float radius)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
ctx_->SetCurrentBrush(fill_brush_); ctx_->SetCurrentBrush(fill_brush_);
@ -196,7 +196,7 @@ void Canvas::FillCircle(Point const& center, float radius)
cache_expired_ = true; cache_expired_ = true;
} }
void Canvas::FillEllipse(Point const& center, Vec2 const& radius) void Canvas::FillEllipse(const Point& center, const Vec2& radius)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
ctx_->SetCurrentBrush(fill_brush_); ctx_->SetCurrentBrush(fill_brush_);
@ -204,7 +204,7 @@ void Canvas::FillEllipse(Point const& center, Vec2 const& radius)
cache_expired_ = true; cache_expired_ = true;
} }
void Canvas::FillRect(Rect const& rect) void Canvas::FillRect(const Rect& rect)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
ctx_->SetCurrentBrush(fill_brush_); ctx_->SetCurrentBrush(fill_brush_);
@ -212,7 +212,7 @@ void Canvas::FillRect(Rect const& rect)
cache_expired_ = true; cache_expired_ = true;
} }
void Canvas::FillRoundedRect(Rect const& rect, Vec2 const& radius) void Canvas::FillRoundedRect(const Rect& rect, const Vec2& radius)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
ctx_->SetCurrentBrush(fill_brush_); ctx_->SetCurrentBrush(fill_brush_);
@ -230,7 +230,7 @@ void Canvas::DrawTexture(TexturePtr texture, const Rect* src_rect, const Rect* d
} }
} }
void Canvas::DrawTextLayout(String const& text, TextStyle const& style, Point const& point) void Canvas::DrawTextLayout(const String& text, const TextStyle& style, const Point& point)
{ {
if (text.empty()) if (text.empty())
return; return;
@ -238,7 +238,7 @@ void Canvas::DrawTextLayout(String const& text, TextStyle const& style, Point co
DrawTextLayout(TextLayout::Create(text, style), point); DrawTextLayout(TextLayout::Create(text, style), point);
} }
void Canvas::DrawTextLayout(TextLayoutPtr layout, Point const& point) void Canvas::DrawTextLayout(TextLayoutPtr layout, const Point& point)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
if (layout) if (layout)
@ -248,7 +248,7 @@ void Canvas::DrawTextLayout(TextLayoutPtr layout, Point const& point)
} }
} }
void Canvas::BeginPath(Point const& begin_pos) void Canvas::BeginPath(const Point& begin_pos)
{ {
shape_maker_.BeginPath(begin_pos); shape_maker_.BeginPath(begin_pos);
} }
@ -258,22 +258,22 @@ void Canvas::EndPath(bool closed)
shape_maker_.EndPath(closed); shape_maker_.EndPath(closed);
} }
void Canvas::AddLine(Point const& point) void Canvas::AddLine(const Point& point)
{ {
shape_maker_.AddLine(point); shape_maker_.AddLine(point);
} }
void Canvas::AddLines(Vector<Point> const& points) void Canvas::AddLines(const Vector<Point>& points)
{ {
shape_maker_.AddLines(points); shape_maker_.AddLines(points);
} }
void Canvas::AddBezier(Point const& point1, Point const& point2, Point const& point3) void Canvas::AddBezier(const Point& point1, const Point& point2, const Point& point3)
{ {
shape_maker_.AddBezier(point1, point2, point3); shape_maker_.AddBezier(point1, point2, point3);
} }
void Canvas::AddArc(Point const& point, Size const& radius, float rotation, bool clockwise, bool is_small) void Canvas::AddArc(const Point& point, const Size& radius, float rotation, bool clockwise, bool is_small)
{ {
shape_maker_.AddArc(point, radius, rotation, clockwise, is_small); shape_maker_.AddArc(point, radius, rotation, clockwise, is_small);
} }
@ -302,7 +302,7 @@ void Canvas::Clear()
cache_expired_ = true; cache_expired_ = true;
} }
void Canvas::Clear(Color const& clear_color) void Canvas::Clear(const Color& clear_color)
{ {
KGE_ASSERT(ctx_); KGE_ASSERT(ctx_);
ctx_->Clear(clear_color); ctx_->Clear(clear_color);

View File

@ -44,7 +44,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建画布 /// @brief 创建画布
/// @param size 画布大小 /// @param size 画布大小
static CanvasPtr Create(Size const& size); static CanvasPtr Create(const Size& size);
/// \~chinese /// \~chinese
/// @brief 开始绘图 /// @brief 开始绘图
@ -63,30 +63,30 @@ public:
/// @brief 画线段 /// @brief 画线段
/// @param begin 线段起点 /// @param begin 线段起点
/// @param end 线段终点 /// @param end 线段终点
void DrawLine(Point const& begin, Point const& end); void DrawLine(const Point& begin, const Point& end);
/// \~chinese /// \~chinese
/// @brief 画圆形边框 /// @brief 画圆形边框
/// @param center 圆形原点 /// @param center 圆形原点
/// @param radius 圆形半径 /// @param radius 圆形半径
void DrawCircle(Point const& center, float radius); void DrawCircle(const Point& center, float radius);
/// \~chinese /// \~chinese
/// @brief 画椭圆形边框 /// @brief 画椭圆形边框
/// @param center 椭圆原点 /// @param center 椭圆原点
/// @param radius 椭圆半径 /// @param radius 椭圆半径
void DrawEllipse(Point const& center, Vec2 const& radius); void DrawEllipse(const Point& center, const Vec2& radius);
/// \~chinese /// \~chinese
/// @brief 画矩形边框 /// @brief 画矩形边框
/// @param rect 矩形 /// @param rect 矩形
void DrawRect(Rect const& rect); void DrawRect(const Rect& rect);
/// \~chinese /// \~chinese
/// @brief 画圆角矩形边框 /// @brief 画圆角矩形边框
/// @param rect 矩形 /// @param rect 矩形
/// @param radius 矩形圆角半径 /// @param radius 矩形圆角半径
void DrawRoundedRect(Rect const& rect, Vec2 const& radius); void DrawRoundedRect(const Rect& rect, const Vec2& radius);
/// \~chinese /// \~chinese
/// @brief 填充形状 /// @brief 填充形状
@ -97,24 +97,24 @@ public:
/// @brief 填充圆形 /// @brief 填充圆形
/// @param center 圆形原点 /// @param center 圆形原点
/// @param radius 圆形半径 /// @param radius 圆形半径
void FillCircle(Point const& center, float radius); void FillCircle(const Point& center, float radius);
/// \~chinese /// \~chinese
/// @brief 填充椭圆形 /// @brief 填充椭圆形
/// @param center 椭圆原点 /// @param center 椭圆原点
/// @param radius 椭圆半径 /// @param radius 椭圆半径
void FillEllipse(Point const& center, Vec2 const& radius); void FillEllipse(const Point& center, const Vec2& radius);
/// \~chinese /// \~chinese
/// @brief 填充矩形 /// @brief 填充矩形
/// @param rect 矩形 /// @param rect 矩形
void FillRect(Rect const& rect); void FillRect(const Rect& rect);
/// \~chinese /// \~chinese
/// @brief 填充圆角矩形 /// @brief 填充圆角矩形
/// @param rect 矩形 /// @param rect 矩形
/// @param radius 矩形圆角半径 /// @param radius 矩形圆角半径
void FillRoundedRect(Rect const& rect, Vec2 const& radius); void FillRoundedRect(const Rect& rect, const Vec2& radius);
/// \~chinese /// \~chinese
/// @brief 绘制纹理 /// @brief 绘制纹理
@ -128,18 +128,18 @@ public:
/// @param text 文字 /// @param text 文字
/// @param style 文字样式 /// @param style 文字样式
/// @param point 绘制文字的位置 /// @param point 绘制文字的位置
void DrawTextLayout(String const& text, TextStyle const& style, Point const& point); void DrawTextLayout(const String& text, const TextStyle& style, const Point& point);
/// \~chinese /// \~chinese
/// @brief 绘制文字布局 /// @brief 绘制文字布局
/// @param layout 文字布局 /// @param layout 文字布局
/// @param point 绘制布局的位置 /// @param point 绘制布局的位置
void DrawTextLayout(TextLayoutPtr layout, Point const& point); void DrawTextLayout(TextLayoutPtr layout, const Point& point);
/// \~chinese /// \~chinese
/// @brief 开始绘制路径 /// @brief 开始绘制路径
/// @param begin_pos 路径起始点 /// @param begin_pos 路径起始点
void BeginPath(Point const& begin_pos); void BeginPath(const Point& begin_pos);
/// \~chinese /// \~chinese
/// @brief 结束路径 /// @brief 结束路径
@ -149,19 +149,19 @@ public:
/// \~chinese /// \~chinese
/// @brief 添加一条线段 /// @brief 添加一条线段
/// @param point 端点 /// @param point 端点
void AddLine(Point const& point); void AddLine(const Point& point);
/// \~chinese /// \~chinese
/// @brief 添加多条线段 /// @brief 添加多条线段
/// @param points 端点集合 /// @param points 端点集合
void AddLines(Vector<Point> const& points); void AddLines(const Vector<Point>& points);
/// \~chinese /// \~chinese
/// @brief 添加一条三次方贝塞尔曲线 /// @brief 添加一条三次方贝塞尔曲线
/// @param point1 贝塞尔曲线的第一个控制点 /// @param point1 贝塞尔曲线的第一个控制点
/// @param point2 贝塞尔曲线的第二个控制点 /// @param point2 贝塞尔曲线的第二个控制点
/// @param point3 贝塞尔曲线的终点 /// @param point3 贝塞尔曲线的终点
void AddBezier(Point const& point1, Point const& point2, Point const& point3); void AddBezier(const Point& point1, const Point& point2, const Point& point3);
/// \~chinese /// \~chinese
/// @brief 添加弧线 /// @brief 添加弧线
@ -170,7 +170,7 @@ public:
/// @param rotation 椭圆旋转角度 /// @param rotation 椭圆旋转角度
/// @param clockwise 顺时针 or 逆时针 /// @param clockwise 顺时针 or 逆时针
/// @param is_small 是否取小于 180° 的弧 /// @param is_small 是否取小于 180° 的弧
void AddArc(Point const& point, Size const& radius, float rotation, bool clockwise = true, bool is_small = true); void AddArc(const Point& point, const Size& radius, float rotation, bool clockwise = true, bool is_small = true);
/// \~chinese /// \~chinese
/// @brief 以描边的方式绘制路径 /// @brief 以描边的方式绘制路径
@ -187,12 +187,12 @@ public:
/// \~chinese /// \~chinese
/// @brief 清空画布 /// @brief 清空画布
/// @param clear_color 清空颜色 /// @param clear_color 清空颜色
void Clear(Color const& clear_color); void Clear(const Color& clear_color);
/// \~chinese /// \~chinese
/// @brief 设置填充颜色 /// @brief 设置填充颜色
/// @param color 填充颜色 /// @param color 填充颜色
void SetFillColor(Color const& color); void SetFillColor(const Color& color);
/// \~chinese /// \~chinese
/// @brief 设置填充画刷 /// @brief 设置填充画刷
@ -202,7 +202,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置轮廓颜色 /// @brief 设置轮廓颜色
/// @param color 轮廓颜色 /// @param color 轮廓颜色
void SetStrokeColor(Color const& color); void SetStrokeColor(const Color& color);
/// \~chinese /// \~chinese
/// @brief 设置轮廓画刷 /// @brief 设置轮廓画刷
@ -222,12 +222,12 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置画刷二维变换 /// @brief 设置画刷二维变换
/// @param transform 二维变换 /// @param transform 二维变换
void SetBrushTransform(Transform const& transform); void SetBrushTransform(const Transform& transform);
/// \~chinese /// \~chinese
/// @brief 设置画刷二维变换矩阵 /// @brief 设置画刷二维变换矩阵
/// @param transform 二维变换矩阵 /// @param transform 二维变换矩阵
void SetBrushTransform(Matrix3x2 const& transform); void SetBrushTransform(const Matrix3x2& transform);
/// \~chinese /// \~chinese
/// @brief 添加一个图层 /// @brief 添加一个图层
@ -241,7 +241,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 添加一个裁剪区域 /// @brief 添加一个裁剪区域
/// @param clip_rect 裁剪矩形 /// @param clip_rect 裁剪矩形
void PushClipRect(Rect const& clip_rect); void PushClipRect(const Rect& clip_rect);
/// \~chinese /// \~chinese
/// @brief 删除最近添加的裁剪区域 /// @brief 删除最近添加的裁剪区域
@ -288,7 +288,7 @@ inline void Canvas::SetStrokeStyle(StrokeStylePtr stroke_style)
stroke_style_ = stroke_style; stroke_style_ = stroke_style;
} }
inline void Canvas::SetStrokeColor(Color const& color) inline void Canvas::SetStrokeColor(const Color& color)
{ {
if (!stroke_brush_) if (!stroke_brush_)
{ {
@ -297,7 +297,7 @@ inline void Canvas::SetStrokeColor(Color const& color)
stroke_brush_->SetColor(color); stroke_brush_->SetColor(color);
} }
inline void Canvas::SetFillColor(Color const& color) inline void Canvas::SetFillColor(const Color& color)
{ {
if (!fill_brush_) if (!fill_brush_)
{ {

View File

@ -24,7 +24,7 @@
namespace kiwano namespace kiwano
{ {
FramePtr Frame::Create(String const& file_path) FramePtr Frame::Create(const String& file_path)
{ {
FramePtr ptr = new (std::nothrow) Frame; FramePtr ptr = new (std::nothrow) Frame;
if (ptr) if (ptr)
@ -35,7 +35,7 @@ FramePtr Frame::Create(String const& file_path)
return ptr; return ptr;
} }
FramePtr Frame::Create(Resource const& res) FramePtr Frame::Create(const Resource& res)
{ {
FramePtr ptr = new (std::nothrow) Frame; FramePtr ptr = new (std::nothrow) Frame;
if (ptr) if (ptr)
@ -58,7 +58,7 @@ FramePtr Frame::Create(TexturePtr texture)
Frame::Frame() {} Frame::Frame() {}
bool Frame::Load(String const& file_path) bool Frame::Load(const String& file_path)
{ {
TexturePtr texture = TextureCache::GetInstance().AddOrGetTexture(file_path); TexturePtr texture = TextureCache::GetInstance().AddOrGetTexture(file_path);
if (texture->IsValid()) if (texture->IsValid())
@ -69,7 +69,7 @@ bool Frame::Load(String const& file_path)
return false; return false;
} }
bool Frame::Load(Resource const& res) bool Frame::Load(const Resource& res)
{ {
TexturePtr texture = TextureCache::GetInstance().AddOrGetTexture(res); TexturePtr texture = TextureCache::GetInstance().AddOrGetTexture(res);
if (texture->IsValid()) if (texture->IsValid())
@ -80,7 +80,7 @@ bool Frame::Load(Resource const& res)
return false; return false;
} }
void Frame::SetCropRect(Rect const& crop_rect) void Frame::SetCropRect(const Rect& crop_rect)
{ {
if (texture_->IsValid()) if (texture_->IsValid())
{ {

View File

@ -36,12 +36,12 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建图像帧 /// @brief 创建图像帧
/// @param file_path 图像路径 /// @param file_path 图像路径
static FramePtr Create(String const& file_path); static FramePtr Create(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 创建图像帧 /// @brief 创建图像帧
/// @param res 图像资源 /// @param res 图像资源
static FramePtr Create(Resource const& res); static FramePtr Create(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 创建图像帧 /// @brief 创建图像帧
@ -55,17 +55,17 @@ public:
/// \~chinese /// \~chinese
/// @brief 加载图像 /// @brief 加载图像
/// @param file_path 图像路径 /// @param file_path 图像路径
bool Load(String const& file_path); bool Load(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 加载图像 /// @brief 加载图像
/// @param res 图像资源 /// @param res 图像资源
bool Load(Resource const& res); bool Load(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 裁剪图像帧为矩形 /// @brief 裁剪图像帧为矩形
/// @param crop_rect 裁剪矩形定义 /// @param crop_rect 裁剪矩形定义
void SetCropRect(Rect const& crop_rect); void SetCropRect(const Rect& crop_rect);
/// \~chinese /// \~chinese
/// @brief 设置纹理 /// @brief 设置纹理
@ -94,7 +94,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取裁剪矩形 /// @brief 获取裁剪矩形
Rect const& GetCropRect() const; const Rect& GetCropRect() const;
/// \~chinese /// \~chinese
/// @brief 获取图像原宽度 /// @brief 获取图像原宽度
@ -142,7 +142,7 @@ inline Point Frame::GetCropPoint() const
return crop_rect_.GetLeftTop(); return crop_rect_.GetLeftTop();
} }
inline Rect const& Frame::GetCropRect() const inline const Rect& Frame::GetCropRect() const
{ {
return crop_rect_; return crop_rect_;
} }

View File

@ -30,7 +30,7 @@ FrameSequencePtr FrameSequence::Create()
return ptr; return ptr;
} }
FrameSequencePtr FrameSequence::Create(Vector<FramePtr> const& frames) FrameSequencePtr FrameSequence::Create(const Vector<FramePtr>& frames)
{ {
FrameSequencePtr ptr = new (std::nothrow) FrameSequence; FrameSequencePtr ptr = new (std::nothrow) FrameSequence;
if (ptr) if (ptr)
@ -65,7 +65,7 @@ void FrameSequence::AddFrame(FramePtr frame)
} }
} }
void FrameSequence::AddFrames(Vector<FramePtr> const& frames) void FrameSequence::AddFrames(const Vector<FramePtr>& frames)
{ {
if (frames_.empty()) if (frames_.empty())
frames_ = frames; frames_ = frames;
@ -128,7 +128,7 @@ FramePtr FrameSequence::GetFrame(size_t index) const
return frames_[index]; return frames_[index];
} }
Vector<FramePtr> const& FrameSequence::GetFrames() const const Vector<FramePtr>& FrameSequence::GetFrames() const
{ {
return frames_; return frames_;
} }

View File

@ -41,7 +41,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建序列帧 /// @brief 创建序列帧
/// @param frames 图像帧集合 /// @param frames 图像帧集合
static FrameSequencePtr Create(Vector<FramePtr> const& frames); static FrameSequencePtr Create(const Vector<FramePtr>& frames);
/// \~chinese /// \~chinese
/// @brief 按行列分割图像并创建序列帧 /// @brief 按行列分割图像并创建序列帧
@ -68,7 +68,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 添加多个关键帧 /// @brief 添加多个关键帧
/// @param frames 图像帧集合 /// @param frames 图像帧集合
void AddFrames(Vector<FramePtr> const& frames); void AddFrames(const Vector<FramePtr>& frames);
/// \~chinese /// \~chinese
/// @brief 按行列分割图像并添加序列帧 /// @brief 按行列分割图像并添加序列帧
@ -87,7 +87,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取所有关键帧 /// @brief 获取所有关键帧
Vector<FramePtr> const& GetFrames() const; const Vector<FramePtr>& GetFrames() const;
/// \~chinese /// \~chinese
/// @brief 获取关键帧数量 /// @brief 获取关键帧数量

View File

@ -25,7 +25,7 @@
namespace kiwano namespace kiwano
{ {
GifSpritePtr GifSprite::Create(String const& file_path) GifSpritePtr GifSprite::Create(const String& file_path)
{ {
GifSpritePtr ptr = new (std::nothrow) GifSprite; GifSpritePtr ptr = new (std::nothrow) GifSprite;
if (ptr) if (ptr)
@ -36,7 +36,7 @@ GifSpritePtr GifSprite::Create(String const& file_path)
return ptr; return ptr;
} }
GifSpritePtr GifSprite::Create(Resource const& res) GifSpritePtr GifSprite::Create(const Resource& res)
{ {
GifSpritePtr ptr = new (std::nothrow) GifSprite; GifSpritePtr ptr = new (std::nothrow) GifSprite;
if (ptr) if (ptr)
@ -65,13 +65,13 @@ GifSprite::GifSprite()
{ {
} }
bool GifSprite::Load(String const& file_path) bool GifSprite::Load(const String& file_path)
{ {
GifImagePtr image = TextureCache::GetInstance().AddOrGetGifImage(file_path); GifImagePtr image = TextureCache::GetInstance().AddOrGetGifImage(file_path);
return Load(image); return Load(image);
} }
bool GifSprite::Load(Resource const& res) bool GifSprite::Load(const Resource& res)
{ {
GifImagePtr image = TextureCache::GetInstance().AddOrGetGifImage(res); GifImagePtr image = TextureCache::GetInstance().AddOrGetGifImage(res);
return Load(image); return Load(image);

View File

@ -51,12 +51,12 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建GIF精灵 /// @brief 创建GIF精灵
/// @param file_path GIF图片路径 /// @param file_path GIF图片路径
static GifSpritePtr Create(String const& file_path); static GifSpritePtr Create(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 创建GIF精灵 /// @brief 创建GIF精灵
/// @param res GIF图片资源 /// @param res GIF图片资源
static GifSpritePtr Create(Resource const& res); static GifSpritePtr Create(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 创建GIF精灵 /// @brief 创建GIF精灵
@ -68,12 +68,12 @@ public:
/// \~chinese /// \~chinese
/// @brief 加载GIF图片 /// @brief 加载GIF图片
/// @param file_path GIF图片路径 /// @param file_path GIF图片路径
bool Load(String const& file_path); bool Load(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 加载GIF图片 /// @brief 加载GIF图片
/// @param res GIF图片资源 /// @param res GIF图片资源
bool Load(Resource const& res); bool Load(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 加载GIF图片 /// @brief 加载GIF图片
@ -86,11 +86,11 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置 GIF 动画每次循环结束回调函数 /// @brief 设置 GIF 动画每次循环结束回调函数
void SetLoopDoneCallback(LoopDoneCallback const& cb); void SetLoopDoneCallback(const LoopDoneCallback& cb);
/// \~chinese /// \~chinese
/// @brief 设置 GIF 动画结束回调函数 /// @brief 设置 GIF 动画结束回调函数
void SetDoneCallback(DoneCallback const& cb); void SetDoneCallback(const DoneCallback& cb);
/// \~chinese /// \~chinese
/// @brief 设置 GIF 图像 /// @brief 设置 GIF 图像
@ -171,12 +171,12 @@ inline void GifSprite::SetLoopCount(int loops)
total_loop_count_ = loops; total_loop_count_ = loops;
} }
inline void GifSprite::SetLoopDoneCallback(LoopDoneCallback const& cb) inline void GifSprite::SetLoopDoneCallback(const LoopDoneCallback& cb)
{ {
loop_cb_ = cb; loop_cb_ = cb;
} }
inline void GifSprite::SetDoneCallback(DoneCallback const& cb) inline void GifSprite::SetDoneCallback(const DoneCallback& cb)
{ {
done_cb_ = cb; done_cb_ = cb;
} }

View File

@ -127,7 +127,7 @@ bool ShapeActor::CheckVisibility(RenderContext& ctx) const
// LineActor // LineActor
//------------------------------------------------------- //-------------------------------------------------------
LineActorPtr LineActor::Create(Point const& begin, Point const& end) LineActorPtr LineActor::Create(const Point& begin, const Point& end)
{ {
LineActorPtr ptr = new (std::nothrow) LineActor; LineActorPtr ptr = new (std::nothrow) LineActor;
if (ptr) if (ptr)
@ -141,7 +141,7 @@ LineActor::LineActor() {}
LineActor::~LineActor() {} LineActor::~LineActor() {}
void LineActor::SetLine(Point const& begin, Point const& end) void LineActor::SetLine(const Point& begin, const Point& end)
{ {
if (begin_ != begin || end_ != end) if (begin_ != begin || end_ != end)
{ {
@ -155,7 +155,7 @@ void LineActor::SetLine(Point const& begin, Point const& end)
// RectActor // RectActor
//------------------------------------------------------- //-------------------------------------------------------
RectActorPtr RectActor::Create(Size const& size) RectActorPtr RectActor::Create(const Size& size)
{ {
RectActorPtr ptr = new (std::nothrow) RectActor; RectActorPtr ptr = new (std::nothrow) RectActor;
if (ptr) if (ptr)
@ -169,7 +169,7 @@ RectActor::RectActor() {}
RectActor::~RectActor() {} RectActor::~RectActor() {}
void RectActor::SetRectSize(Size const& size) void RectActor::SetRectSize(const Size& size)
{ {
if (size != rect_size_) if (size != rect_size_)
{ {
@ -182,7 +182,7 @@ void RectActor::SetRectSize(Size const& size)
// RoundedRectActor // RoundedRectActor
//------------------------------------------------------- //-------------------------------------------------------
RoundedRectActorPtr RoundedRectActor::Create(Size const& size, Vec2 const& radius) RoundedRectActorPtr RoundedRectActor::Create(const Size& size, const Vec2& radius)
{ {
RoundedRectActorPtr ptr = new (std::nothrow) RoundedRectActor; RoundedRectActorPtr ptr = new (std::nothrow) RoundedRectActor;
if (ptr) if (ptr)
@ -196,17 +196,17 @@ RoundedRectActor::RoundedRectActor() {}
RoundedRectActor::~RoundedRectActor() {} RoundedRectActor::~RoundedRectActor() {}
void RoundedRectActor::SetRadius(Vec2 const& radius) void RoundedRectActor::SetRadius(const Vec2& radius)
{ {
SetRoundedRect(GetSize(), radius); SetRoundedRect(GetSize(), radius);
} }
void RoundedRectActor::SetRectSize(Size const& size) void RoundedRectActor::SetRectSize(const Size& size)
{ {
SetRoundedRect(size, radius_); SetRoundedRect(size, radius_);
} }
void RoundedRectActor::SetRoundedRect(Size const& size, Vec2 const& radius) void RoundedRectActor::SetRoundedRect(const Size& size, const Vec2& radius)
{ {
if (rect_size_ != size || radius_ != radius) if (rect_size_ != size || radius_ != radius)
{ {
@ -250,7 +250,7 @@ void CircleActor::SetRadius(float radius)
// EllipseActor // EllipseActor
//------------------------------------------------------- //-------------------------------------------------------
EllipseActorPtr EllipseActor::Create(Vec2 const& radius) EllipseActorPtr EllipseActor::Create(const Vec2& radius)
{ {
EllipseActorPtr ptr = new (std::nothrow) EllipseActor; EllipseActorPtr ptr = new (std::nothrow) EllipseActor;
if (ptr) if (ptr)
@ -264,7 +264,7 @@ EllipseActor::EllipseActor() {}
EllipseActor::~EllipseActor() {} EllipseActor::~EllipseActor() {}
void EllipseActor::SetRadius(Vec2 const& radius) void EllipseActor::SetRadius(const Vec2& radius)
{ {
if (radius_ != radius) if (radius_ != radius)
{ {
@ -277,7 +277,7 @@ void EllipseActor::SetRadius(Vec2 const& radius)
// PolygonActor // PolygonActor
//------------------------------------------------------- //-------------------------------------------------------
PolygonActorPtr PolygonActor::Create(Vector<Point> const& points) PolygonActorPtr PolygonActor::Create(const Vector<Point>& points)
{ {
PolygonActorPtr ptr = new (std::nothrow) PolygonActor; PolygonActorPtr ptr = new (std::nothrow) PolygonActor;
if (ptr) if (ptr)
@ -291,7 +291,7 @@ PolygonActor::PolygonActor() {}
PolygonActor::~PolygonActor() {} PolygonActor::~PolygonActor() {}
void PolygonActor::SetVertices(Vector<Point> const& points) void PolygonActor::SetVertices(const Vector<Point>& points)
{ {
if (points.size() > 1) if (points.size() > 1)
{ {

View File

@ -104,7 +104,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置填充颜色 /// @brief 设置填充颜色
/// @param color 填充颜色 /// @param color 填充颜色
void SetFillColor(Color const& color); void SetFillColor(const Color& color);
/// \~chinese /// \~chinese
/// @brief 设置填充画刷 /// @brief 设置填充画刷
@ -114,7 +114,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置轮廓颜色 /// @brief 设置轮廓颜色
/// @param color 轮廓颜色 /// @param color 轮廓颜色
void SetStrokeColor(Color const& color); void SetStrokeColor(const Color& color);
/// \~chinese /// \~chinese
/// @brief 设置轮廓画刷 /// @brief 设置轮廓画刷
@ -151,7 +151,7 @@ public:
/// @brief 创建线段角色 /// @brief 创建线段角色
/// @param begin 线段起点 /// @param begin 线段起点
/// @param end 线段终点 /// @param end 线段终点
static LineActorPtr Create(Point const& begin, Point const& end); static LineActorPtr Create(const Point& begin, const Point& end);
LineActor(); LineActor();
@ -159,27 +159,27 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取线段起点 /// @brief 获取线段起点
Point const& GetBeginPoint() const; const Point& GetBeginPoint() const;
/// \~chinese /// \~chinese
/// @brief 获取线段终点 /// @brief 获取线段终点
Point const& GetEndPoint() const; const Point& GetEndPoint() const;
/// \~chinese /// \~chinese
/// @brief 设置线段起点 /// @brief 设置线段起点
/// @param begin 线段起点 /// @param begin 线段起点
void SetBeginPoint(Point const& begin); void SetBeginPoint(const Point& begin);
/// \~chinese /// \~chinese
/// @brief 设置线段终点 /// @brief 设置线段终点
/// @param end 线段终点 /// @param end 线段终点
void SetEndPoint(Point const& end); void SetEndPoint(const Point& end);
/// \~chinese /// \~chinese
/// @brief 设置线段起点和终点 /// @brief 设置线段起点和终点
/// @param begin 线段起点 /// @param begin 线段起点
/// @param end 线段终点 /// @param end 线段终点
void SetLine(Point const& begin, Point const& end); void SetLine(const Point& begin, const Point& end);
private: private:
Point begin_; Point begin_;
@ -194,7 +194,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建矩形角色 /// @brief 创建矩形角色
/// @param size 矩形大小 /// @param size 矩形大小
static RectActorPtr Create(Size const& size); static RectActorPtr Create(const Size& size);
RectActor(); RectActor();
@ -202,12 +202,12 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取矩形大小 /// @brief 获取矩形大小
Size const& GetRectSize() const; const Size& GetRectSize() const;
/// \~chinese /// \~chinese
/// @brief 设置矩形大小 /// @brief 设置矩形大小
/// @param size 矩形大小 /// @param size 矩形大小
void SetRectSize(Size const& size); void SetRectSize(const Size& size);
private: private:
Size rect_size_; Size rect_size_;
@ -222,7 +222,7 @@ public:
/// @brief 创建圆角矩形角色 /// @brief 创建圆角矩形角色
/// @param size 圆角矩形大小 /// @param size 圆角矩形大小
/// @param radius 圆角半径 /// @param radius 圆角半径
static RoundedRectActorPtr Create(Size const& size, Vec2 const& radius); static RoundedRectActorPtr Create(const Size& size, const Vec2& radius);
RoundedRectActor(); RoundedRectActor();
@ -239,18 +239,18 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置圆角半径 /// @brief 设置圆角半径
/// @param radius 圆角半径 /// @param radius 圆角半径
void SetRadius(Vec2 const& radius); void SetRadius(const Vec2& radius);
/// \~chinese /// \~chinese
/// @brief 设置圆角矩形大小 /// @brief 设置圆角矩形大小
/// @param size 圆角矩形大小 /// @param size 圆角矩形大小
void SetRectSize(Size const& size); void SetRectSize(const Size& size);
/// \~chinese /// \~chinese
/// @brief 设置圆角矩形 /// @brief 设置圆角矩形
/// @param size 圆角矩形大小 /// @param size 圆角矩形大小
/// @param radius 圆角半径 /// @param radius 圆角半径
void SetRoundedRect(Size const& size, Vec2 const& radius); void SetRoundedRect(const Size& size, const Vec2& radius);
private: private:
Size rect_size_; Size rect_size_;
@ -292,7 +292,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建椭圆角色 /// @brief 创建椭圆角色
/// @param radius 椭圆半径 /// @param radius 椭圆半径
static EllipseActorPtr Create(Vec2 const& radius); static EllipseActorPtr Create(const Vec2& radius);
EllipseActor(); EllipseActor();
@ -305,7 +305,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置椭圆半径 /// @brief 设置椭圆半径
/// @param radius 椭圆半径 /// @param radius 椭圆半径
void SetRadius(Vec2 const& radius); void SetRadius(const Vec2& radius);
private: private:
Vec2 radius_; Vec2 radius_;
@ -319,7 +319,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建多边形角色 /// @brief 创建多边形角色
/// @param points 多边形端点集合 /// @param points 多边形端点集合
static PolygonActorPtr Create(Vector<Point> const& points); static PolygonActorPtr Create(const Vector<Point>& points);
PolygonActor(); PolygonActor();
@ -328,13 +328,13 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置多边形端点 /// @brief 设置多边形端点
/// @param points 多边形端点集合 /// @param points 多边形端点集合
void SetVertices(Vector<Point> const& points); void SetVertices(const Vector<Point>& points);
}; };
/** @} */ /** @} */
inline void ShapeActor::SetStrokeColor(Color const& color) inline void ShapeActor::SetStrokeColor(const Color& color)
{ {
if (!stroke_brush_) if (!stroke_brush_)
{ {
@ -343,7 +343,7 @@ inline void ShapeActor::SetStrokeColor(Color const& color)
stroke_brush_->SetColor(color); stroke_brush_->SetColor(color);
} }
inline void ShapeActor::SetFillColor(Color const& color) inline void ShapeActor::SetFillColor(const Color& color)
{ {
if (!fill_brush_) if (!fill_brush_)
{ {
@ -387,27 +387,27 @@ inline void ShapeActor::SetStrokeStyle(StrokeStylePtr stroke_style)
stroke_style_ = stroke_style; stroke_style_ = stroke_style;
} }
inline Point const& LineActor::GetBeginPoint() const inline const Point& LineActor::GetBeginPoint() const
{ {
return begin_; return begin_;
} }
inline Point const& LineActor::GetEndPoint() const inline const Point& LineActor::GetEndPoint() const
{ {
return end_; return end_;
} }
inline void LineActor::SetBeginPoint(Point const& begin) inline void LineActor::SetBeginPoint(const Point& begin)
{ {
SetLine(begin, end_); SetLine(begin, end_);
} }
inline void LineActor::SetEndPoint(Point const& end) inline void LineActor::SetEndPoint(const Point& end)
{ {
SetLine(begin_, end); SetLine(begin_, end);
} }
inline Size const& RectActor::GetRectSize() const inline const Size& RectActor::GetRectSize() const
{ {
return rect_size_; return rect_size_;
} }

View File

@ -24,7 +24,7 @@
namespace kiwano namespace kiwano
{ {
SpritePtr Sprite::Create(String const& file_path) SpritePtr Sprite::Create(const String& file_path)
{ {
SpritePtr ptr = new (std::nothrow) Sprite; SpritePtr ptr = new (std::nothrow) Sprite;
if (ptr) if (ptr)
@ -35,7 +35,7 @@ SpritePtr Sprite::Create(String const& file_path)
return ptr; return ptr;
} }
SpritePtr Sprite::Create(Resource const& res) SpritePtr Sprite::Create(const Resource& res)
{ {
SpritePtr ptr = new (std::nothrow) Sprite; SpritePtr ptr = new (std::nothrow) Sprite;
if (ptr) if (ptr)
@ -56,7 +56,7 @@ SpritePtr Sprite::Create(FramePtr frame)
return ptr; return ptr;
} }
SpritePtr Sprite::Create(String const& file_path, const Rect& crop_rect) SpritePtr Sprite::Create(const String& file_path, const Rect& crop_rect)
{ {
SpritePtr ptr = Sprite::Create(file_path); SpritePtr ptr = Sprite::Create(file_path);
if (ptr) if (ptr)
@ -66,7 +66,7 @@ SpritePtr Sprite::Create(String const& file_path, const Rect& crop_rect)
return ptr; return ptr;
} }
SpritePtr Sprite::Create(Resource const& res, const Rect& crop_rect) SpritePtr Sprite::Create(const Resource& res, const Rect& crop_rect)
{ {
SpritePtr ptr = Sprite::Create(res); SpritePtr ptr = Sprite::Create(res);
if (ptr) if (ptr)
@ -80,7 +80,7 @@ Sprite::Sprite() {}
Sprite::~Sprite() {} Sprite::~Sprite() {}
bool Sprite::Load(String const& file_path, bool autoresize) bool Sprite::Load(const String& file_path, bool autoresize)
{ {
FramePtr frame = Frame::Create(file_path); FramePtr frame = Frame::Create(file_path);
if (frame) if (frame)
@ -91,7 +91,7 @@ bool Sprite::Load(String const& file_path, bool autoresize)
return false; return false;
} }
bool Sprite::Load(Resource const& res, bool autoresize) bool Sprite::Load(const Resource& res, bool autoresize)
{ {
FramePtr frame = Frame::Create(res); FramePtr frame = Frame::Create(res);
if (frame) if (frame)

View File

@ -41,12 +41,12 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建精灵 /// @brief 创建精灵
/// @param file_path 本地图片路径 /// @param file_path 本地图片路径
static SpritePtr Create(String const& file_path); static SpritePtr Create(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 创建精灵 /// @brief 创建精灵
/// @param res 图片资源 /// @param res 图片资源
static SpritePtr Create(Resource const& res); static SpritePtr Create(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 创建精灵 /// @brief 创建精灵
@ -57,13 +57,13 @@ public:
/// @brief 创建精灵 /// @brief 创建精灵
/// @param file_path 本地图片路径 /// @param file_path 本地图片路径
/// @param crop_rect 裁剪矩形 /// @param crop_rect 裁剪矩形
static SpritePtr Create(String const& file_path, const Rect& crop_rect); static SpritePtr Create(const String& file_path, const Rect& crop_rect);
/// \~chinese /// \~chinese
/// @brief 创建精灵 /// @brief 创建精灵
/// @param res 图片资源 /// @param res 图片资源
/// @param crop_rect 裁剪矩形 /// @param crop_rect 裁剪矩形
static SpritePtr Create(Resource const& res, const Rect& crop_rect); static SpritePtr Create(const Resource& res, const Rect& crop_rect);
Sprite(); Sprite();
@ -73,13 +73,13 @@ public:
/// @brief 加载本地图片 /// @brief 加载本地图片
/// @param file_path 本地图片路径 /// @param file_path 本地图片路径
/// @param autoresize 是否自动调整自身大小为图像大小 /// @param autoresize 是否自动调整自身大小为图像大小
bool Load(String const& file_path, bool autoresize = true); bool Load(const String& file_path, bool autoresize = true);
/// \~chinese /// \~chinese
/// @brief 加载图像资源 /// @brief 加载图像资源
/// @param res 图片资源 /// @param res 图片资源
/// @param autoresize 是否自动调整自身大小为图像大小 /// @param autoresize 是否自动调整自身大小为图像大小
bool Load(Resource const& res, bool autoresize = true); bool Load(const Resource& res, bool autoresize = true);
/// \~chinese /// \~chinese
/// @brief 获取图像原宽度 /// @brief 获取图像原宽度

View File

@ -61,7 +61,7 @@ Size TextActor::GetSize() const
return Actor::GetSize(); return Actor::GetSize();
} }
void TextActor::SetText(String const& text) void TextActor::SetText(const String& text)
{ {
if (!layout_) if (!layout_)
{ {
@ -87,7 +87,7 @@ void TextActor::SetFont(FontPtr font)
} }
} }
void TextActor::SetFontFamily(String const& family) void TextActor::SetFontFamily(const String& family)
{ {
if (style_.font_family != family) if (style_.font_family != family)
{ {
@ -207,7 +207,7 @@ void TextActor::SetOutlineStrokeStyle(StrokeStylePtr stroke)
} }
} }
void TextActor::SetFillColor(Color const& color) void TextActor::SetFillColor(const Color& color)
{ {
if (style_.fill_brush) if (style_.fill_brush)
{ {
@ -219,7 +219,7 @@ void TextActor::SetFillColor(Color const& color)
} }
} }
void TextActor::SetOutlineColor(Color const& outline_color) void TextActor::SetOutlineColor(const Color& outline_color)
{ {
if (style_.outline_brush) if (style_.outline_brush)
{ {

View File

@ -88,7 +88,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置文本 /// @brief 设置文本
void SetText(String const& text); void SetText(const String& text);
/// \~chinese /// \~chinese
/// @brief 设置文本样式 /// @brief 设置文本样式
@ -100,7 +100,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置字体族 /// @brief 设置字体族
void SetFontFamily(String const& family); void SetFontFamily(const String& family);
/// \~chinese /// \~chinese
/// @brief 设置字号(默认值为 18 /// @brief 设置字号(默认值为 18
@ -116,7 +116,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置文字填充颜色(默认值为 Color::White /// @brief 设置文字填充颜色(默认值为 Color::White
void SetFillColor(Color const& color); void SetFillColor(const Color& color);
/// \~chinese /// \~chinese
/// @brief 设置文字斜体(默认值为 false /// @brief 设置文字斜体(默认值为 false
@ -140,7 +140,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置文字描边颜色 /// @brief 设置文字描边颜色
void SetOutlineColor(Color const& outline_color); void SetOutlineColor(const Color& outline_color);
/// \~chinese /// \~chinese
/// @brief 设置描边线条样式 /// @brief 设置描边线条样式

View File

@ -93,11 +93,11 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置动画结束时的回调函数 /// @brief 设置动画结束时的回调函数
void SetDoneCallback(DoneCallback const& cb); void SetDoneCallback(const DoneCallback& cb);
/// \~chinese /// \~chinese
/// @brief 设置动画循环结束时的回调函数 /// @brief 设置动画循环结束时的回调函数
void SetLoopDoneCallback(DoneCallback const& cb); void SetLoopDoneCallback(const DoneCallback& cb);
/// \~chinese /// \~chinese
/// @brief 获取动画的拷贝 /// @brief 获取动画的拷贝
@ -230,12 +230,12 @@ inline void Action::RemoveTargetWhenDone()
detach_target_ = true; detach_target_ = true;
} }
inline void Action::SetDoneCallback(DoneCallback const& cb) inline void Action::SetDoneCallback(const DoneCallback& cb)
{ {
cb_done_ = cb; cb_done_ = cb;
} }
inline void Action::SetLoopDoneCallback(DoneCallback const& cb) inline void Action::SetLoopDoneCallback(const DoneCallback& cb)
{ {
cb_loop_done_ = cb; cb_loop_done_ = cb;
} }

View File

@ -25,7 +25,7 @@
namespace kiwano namespace kiwano
{ {
ActionGroupPtr ActionGroup::Create(Vector<ActionPtr> const& actions, bool sync) ActionGroupPtr ActionGroup::Create(const Vector<ActionPtr>& actions, bool sync)
{ {
ActionGroupPtr ptr = new (std::nothrow) ActionGroup(sync); ActionGroupPtr ptr = new (std::nothrow) ActionGroup(sync);
if (ptr) if (ptr)
@ -116,7 +116,7 @@ void ActionGroup::AddAction(ActionPtr action)
} }
} }
void ActionGroup::AddActions(Vector<ActionPtr> const& actions) void ActionGroup::AddActions(const Vector<ActionPtr>& actions)
{ {
for (const auto& action : actions) for (const auto& action : actions)
AddAction(action); AddAction(action);

View File

@ -41,7 +41,7 @@ public:
/// @brief 创建动画组合 /// @brief 创建动画组合
/// @param actions 动画集合 /// @param actions 动画集合
/// @param sync 同步执行 /// @param sync 同步执行
static ActionGroupPtr Create(Vector<ActionPtr> const& actions, bool sync = false); static ActionGroupPtr Create(const Vector<ActionPtr>& actions, bool sync = false);
ActionGroup(); ActionGroup();
@ -57,11 +57,11 @@ public:
/// \~chinese /// \~chinese
/// @brief 添加多个动画 /// @brief 添加多个动画
/// @param actions 动画集合 /// @param actions 动画集合
void AddActions(Vector<ActionPtr> const& actions); void AddActions(const Vector<ActionPtr>& actions);
/// \~chinese /// \~chinese
/// @brief 获取所有动画 /// @brief 获取所有动画
ActionList const& GetActions() const; const ActionList& GetActions() const;
/// \~chinese /// \~chinese
/// @brief 获取该动画的拷贝对象 /// @brief 获取该动画的拷贝对象
@ -84,7 +84,7 @@ private:
/** @} */ /** @} */
inline ActionGroup::ActionList const& ActionGroup::GetActions() const inline const ActionGroup::ActionList& ActionGroup::GetActions() const
{ {
return actions_; return actions_;
} }

View File

@ -56,7 +56,7 @@ struct ActionHelper
/// \~chinese /// \~chinese
/// @brief 设置动画结束回调函数 /// @brief 设置动画结束回调函数
inline ActionHelper& SetDoneCallback(DoneCallback const& cb) inline ActionHelper& SetDoneCallback(const DoneCallback& cb)
{ {
ptr->SetDoneCallback(cb); ptr->SetDoneCallback(cb);
return (*this); return (*this);
@ -64,7 +64,7 @@ struct ActionHelper
/// \~chinese /// \~chinese
/// @brief 设置动画循环结束时的回调函数 /// @brief 设置动画循环结束时的回调函数
inline ActionHelper& SetLoopDoneCallback(DoneCallback const& cb) inline ActionHelper& SetLoopDoneCallback(const DoneCallback& cb)
{ {
ptr->SetLoopDoneCallback(cb); ptr->SetLoopDoneCallback(cb);
return (*this); return (*this);
@ -80,7 +80,7 @@ struct ActionHelper
/// \~chinese /// \~chinese
/// @brief 设置名称 /// @brief 设置名称
inline ActionHelper& SetName(String const& name) inline ActionHelper& SetName(const String& name)
{ {
ptr->SetName(name); ptr->SetName(name);
return (*this); return (*this);
@ -152,7 +152,7 @@ struct TweenHelper
/// \~chinese /// \~chinese
/// @brief 设置动画结束回调函数 /// @brief 设置动画结束回调函数
inline TweenHelper& SetDoneCallback(DoneCallback const& cb) inline TweenHelper& SetDoneCallback(const DoneCallback& cb)
{ {
ptr->SetDoneCallback(cb); ptr->SetDoneCallback(cb);
return (*this); return (*this);
@ -160,7 +160,7 @@ struct TweenHelper
/// \~chinese /// \~chinese
/// @brief 设置动画循环结束时的回调函数 /// @brief 设置动画循环结束时的回调函数
inline TweenHelper& SetLoopDoneCallback(DoneCallback const& cb) inline TweenHelper& SetLoopDoneCallback(const DoneCallback& cb)
{ {
ptr->SetLoopDoneCallback(cb); ptr->SetLoopDoneCallback(cb);
return (*this); return (*this);
@ -176,7 +176,7 @@ struct TweenHelper
/// \~chinese /// \~chinese
/// @brief 设置名称 /// @brief 设置名称
inline TweenHelper& SetName(String const& name) inline TweenHelper& SetName(const String& name)
{ {
ptr->SetName(name); ptr->SetName(name);
return (*this); return (*this);
@ -222,7 +222,7 @@ public:
/// @brief 构造相对位移动画 /// @brief 构造相对位移动画
/// @param duration 动画时长 /// @param duration 动画时长
/// @param vector 移动向量 /// @param vector 移动向量
static inline TweenHelper MoveBy(Duration dur, Point const& vector) static inline TweenHelper MoveBy(Duration dur, const Point& vector)
{ {
return TweenHelper(ActionMoveBy::Create(dur, vector)); return TweenHelper(ActionMoveBy::Create(dur, vector));
} }
@ -231,7 +231,7 @@ public:
/// @brief 构造位移动画 /// @brief 构造位移动画
/// @param duration 动画时长 /// @param duration 动画时长
/// @param pos 目的坐标 /// @param pos 目的坐标
static inline TweenHelper MoveTo(Duration dur, Point const& pos) static inline TweenHelper MoveTo(Duration dur, const Point& pos)
{ {
return TweenHelper(ActionMoveTo::Create(dur, pos)); return TweenHelper(ActionMoveTo::Create(dur, pos));
} }
@ -242,7 +242,7 @@ public:
/// @param vec 跳跃位移向量 /// @param vec 跳跃位移向量
/// @param height 跳跃高度 /// @param height 跳跃高度
/// @param jumps 跳跃次数 /// @param jumps 跳跃次数
static inline TweenHelper JumpBy(Duration duration, Vec2 const& vec, float height, int jumps = 1) static inline TweenHelper JumpBy(Duration duration, const Vec2& vec, float height, int jumps = 1)
{ {
return TweenHelper(ActionJumpBy::Create(duration, vec, height, jumps)); return TweenHelper(ActionJumpBy::Create(duration, vec, height, jumps));
} }
@ -253,7 +253,7 @@ public:
/// @param pos 目的坐标 /// @param pos 目的坐标
/// @param height 跳跃高度 /// @param height 跳跃高度
/// @param jumps 跳跃次数 /// @param jumps 跳跃次数
static inline TweenHelper JumpTo(Duration duration, Point const& pos, float height, int jumps = 1) static inline TweenHelper JumpTo(Duration duration, const Point& pos, float height, int jumps = 1)
{ {
return TweenHelper(ActionJumpTo::Create(duration, pos, height, jumps)); return TweenHelper(ActionJumpTo::Create(duration, pos, height, jumps));
} }
@ -364,7 +364,7 @@ public:
/// @brief 动画组合 /// @brief 动画组合
/// @param actions 动画集合 /// @param actions 动画集合
/// @param sync 同步执行 /// @param sync 同步执行
static inline ActionHelper Group(Vector<ActionPtr> const& actions, bool sync = false) static inline ActionHelper Group(const Vector<ActionPtr>& actions, bool sync = false)
{ {
return ActionHelper(ActionGroup::Create(actions, sync)); return ActionHelper(ActionGroup::Create(actions, sync));
} }

View File

@ -86,7 +86,7 @@ void ActionManager::StopAllActions()
} }
} }
ActionPtr ActionManager::GetAction(String const& name) ActionPtr ActionManager::GetAction(const String& name)
{ {
if (actions_.IsEmpty()) if (actions_.IsEmpty())
return nullptr; return nullptr;

View File

@ -54,7 +54,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取指定名称的动画 /// @brief 获取指定名称的动画
/// @param name 动画名称 /// @param name 动画名称
ActionPtr GetAction(String const& name); ActionPtr GetAction(const String& name);
/// \~chinese /// \~chinese
/// @brief 获取所有动画 /// @brief 获取所有动画

View File

@ -144,7 +144,7 @@ ActionPtr ActionTween::InnerClone(ActionTweenPtr to) const
// Move Action // Move Action
//------------------------------------------------------- //-------------------------------------------------------
ActionMoveByPtr ActionMoveBy::Create(Duration duration, Vec2 const& displacement) ActionMoveByPtr ActionMoveBy::Create(Duration duration, const Vec2& displacement)
{ {
ActionMoveByPtr ptr = new (std::nothrow) ActionMoveBy; ActionMoveByPtr ptr = new (std::nothrow) ActionMoveBy;
if (ptr) if (ptr)
@ -186,7 +186,7 @@ ActionPtr ActionMoveBy::Reverse() const
return InnerClone(ActionMoveBy::Create(GetDuration(), -displacement_)); return InnerClone(ActionMoveBy::Create(GetDuration(), -displacement_));
} }
ActionMoveToPtr ActionMoveTo::Create(Duration duration, Point const& distination) ActionMoveToPtr ActionMoveTo::Create(Duration duration, const Point& distination)
{ {
ActionMoveToPtr ptr = new (std::nothrow) ActionMoveTo; ActionMoveToPtr ptr = new (std::nothrow) ActionMoveTo;
if (ptr) if (ptr)
@ -214,7 +214,7 @@ void ActionMoveTo::Init(Actor* target)
// Jump Action // Jump Action
//------------------------------------------------------- //-------------------------------------------------------
ActionJumpByPtr ActionJumpBy::Create(Duration duration, Vec2 const& displacement, float height, int count, ActionJumpByPtr ActionJumpBy::Create(Duration duration, const Vec2& displacement, float height, int count,
EaseFunc ease) EaseFunc ease)
{ {
ActionJumpByPtr ptr = new (std::nothrow) ActionJumpBy; ActionJumpByPtr ptr = new (std::nothrow) ActionJumpBy;
@ -269,7 +269,7 @@ void ActionJumpBy::UpdateTween(Actor* target, float percent)
prev_pos_ = new_pos; prev_pos_ = new_pos;
} }
ActionJumpToPtr ActionJumpTo::Create(Duration duration, Point const& distination, float height, int count, ActionJumpToPtr ActionJumpTo::Create(Duration duration, const Point& distination, float height, int count,
EaseFunc ease) EaseFunc ease)
{ {
ActionJumpToPtr ptr = new (std::nothrow) ActionJumpTo; ActionJumpToPtr ptr = new (std::nothrow) ActionJumpTo;

View File

@ -108,11 +108,11 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取动画速度缓动函数 /// @brief 获取动画速度缓动函数
EaseFunc const& GetEaseFunc() const; const EaseFunc& GetEaseFunc() const;
/// \~chinese /// \~chinese
/// @brief 设置动画速度缓动函数 /// @brief 设置动画速度缓动函数
void SetEaseFunc(EaseFunc const& func); void SetEaseFunc(const EaseFunc& func);
protected: protected:
void Update(Actor* target, Duration dt) override; void Update(Actor* target, Duration dt) override;
@ -135,7 +135,7 @@ public:
/// @brief 创建相对位移动画 /// @brief 创建相对位移动画
/// @param duration 动画时长 /// @param duration 动画时长
/// @param displacement 位移向量 /// @param displacement 位移向量
static ActionMoveByPtr Create(Duration duration, Vec2 const& displacement); static ActionMoveByPtr Create(Duration duration, const Vec2& displacement);
ActionMoveBy(); ActionMoveBy();
@ -145,7 +145,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置位移向量 /// @brief 设置位移向量
void SetDisplacement(Vec2 const& displacement); void SetDisplacement(const Vec2& displacement);
/// \~chinese /// \~chinese
/// @brief 获取该动画的拷贝对象 /// @brief 获取该动画的拷贝对象
@ -175,7 +175,7 @@ public:
/// @brief 创建位移动画 /// @brief 创建位移动画
/// @param duration 动画时长 /// @param duration 动画时长
/// @param distination 目的坐标 /// @param distination 目的坐标
static ActionMoveToPtr Create(Duration duration, Point const& distination); static ActionMoveToPtr Create(Duration duration, const Point& distination);
ActionMoveTo(); ActionMoveTo();
@ -185,7 +185,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置目的坐标 /// @brief 设置目的坐标
void SetDistination(Point const& distination); void SetDistination(const Point& distination);
/// \~chinese /// \~chinese
/// @brief 获取该动画的拷贝对象 /// @brief 获取该动画的拷贝对象
@ -217,7 +217,7 @@ public:
/// @param displacement 跳跃位移向量 /// @param displacement 跳跃位移向量
/// @param height 跳跃高度 /// @param height 跳跃高度
/// @param count 跳跃次数 /// @param count 跳跃次数
static ActionJumpByPtr Create(Duration duration, Vec2 const& displacement, float height, int count = 1, static ActionJumpByPtr Create(Duration duration, const Vec2& displacement, float height, int count = 1,
EaseFunc ease = nullptr); EaseFunc ease = nullptr);
ActionJumpBy(); ActionJumpBy();
@ -236,7 +236,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置跳跃位移 /// @brief 设置跳跃位移
void SetDisplacement(Vec2 const& displacement); void SetDisplacement(const Vec2& displacement);
/// \~chinese /// \~chinese
/// @brief 设置跳跃高度 /// @brief 设置跳跃高度
@ -278,7 +278,7 @@ public:
/// @param distination 目的坐标 /// @param distination 目的坐标
/// @param height 跳跃高度 /// @param height 跳跃高度
/// @param count 跳跃次数 /// @param count 跳跃次数
static ActionJumpToPtr Create(Duration duration, Point const& distination, float height, int count = 1, static ActionJumpToPtr Create(Duration duration, const Point& distination, float height, int count = 1,
EaseFunc ease = nullptr); EaseFunc ease = nullptr);
ActionJumpTo(); ActionJumpTo();
@ -289,7 +289,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置目的坐标 /// @brief 设置目的坐标
void SetDistination(Point const& distination); void SetDistination(const Point& distination);
/// \~chinese /// \~chinese
/// @brief 获取该动画的拷贝对象 /// @brief 获取该动画的拷贝对象
@ -579,7 +579,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置动画回调函数 /// @brief 设置动画回调函数
void SetTweenFunc(TweenFunc const& tween_func); void SetTweenFunc(const TweenFunc& tween_func);
/// \~chinese /// \~chinese
/// @brief 获取该动画的拷贝对象 /// @brief 获取该动画的拷贝对象
@ -604,7 +604,7 @@ private:
/** @} */ /** @} */
inline EaseFunc const& ActionTween::GetEaseFunc() const inline const EaseFunc& ActionTween::GetEaseFunc() const
{ {
return ease_func_; return ease_func_;
} }
@ -619,7 +619,7 @@ inline void ActionTween::SetDuration(Duration duration)
dur_ = duration; dur_ = duration;
} }
inline void ActionTween::SetEaseFunc(EaseFunc const& func) inline void ActionTween::SetEaseFunc(const EaseFunc& func)
{ {
ease_func_ = func; ease_func_ = func;
} }
@ -629,7 +629,7 @@ inline Vec2 ActionMoveBy::GetDisplacement() const
return displacement_; return displacement_;
} }
inline void ActionMoveBy::SetDisplacement(Vec2 const& displacement) inline void ActionMoveBy::SetDisplacement(const Vec2& displacement)
{ {
displacement_ = displacement; displacement_ = displacement;
} }
@ -639,7 +639,7 @@ inline Point ActionMoveTo::GetDistination() const
return distination_; return distination_;
} }
inline void ActionMoveTo::SetDistination(Point const& distination) inline void ActionMoveTo::SetDistination(const Point& distination)
{ {
distination_ = distination; distination_ = distination;
} }
@ -659,7 +659,7 @@ inline int ActionJumpBy::GetJumpCount() const
return jump_count_; return jump_count_;
} }
inline void ActionJumpBy::SetDisplacement(Vec2 const& displacement) inline void ActionJumpBy::SetDisplacement(const Vec2& displacement)
{ {
displacement_ = displacement; displacement_ = displacement;
} }
@ -679,7 +679,7 @@ inline Point ActionJumpTo::GetDistination() const
return distination_; return distination_;
} }
inline void ActionJumpTo::SetDistination(Point const& distination) inline void ActionJumpTo::SetDistination(const Point& distination)
{ {
distination_ = distination; distination_ = distination;
} }
@ -759,7 +759,7 @@ inline ActionCustom::TweenFunc ActionCustom::GetTweenFunc() const
return tween_func_; return tween_func_;
} }
inline void ActionCustom::SetTweenFunc(TweenFunc const& tween_func) inline void ActionCustom::SetTweenFunc(const TweenFunc& tween_func)
{ {
tween_func_ = tween_func; tween_func_ = tween_func;
} }

View File

@ -56,7 +56,7 @@ EventListener* EventDispatcher::AddListener(EventListenerPtr listener)
return listener.Get(); return listener.Get();
} }
EventListener* EventDispatcher::AddListener(String const& name, EventType type, EventListener::Callback callback) EventListener* EventDispatcher::AddListener(const String& name, EventType type, EventListener::Callback callback)
{ {
EventListenerPtr listener = EventListener::Create(name, type, callback); EventListenerPtr listener = EventListener::Create(name, type, callback);
return AddListener(listener); return AddListener(listener);
@ -68,7 +68,7 @@ EventListener* EventDispatcher::AddListener(EventType type, EventListener::Callb
return AddListener(listener); return AddListener(listener);
} }
void EventDispatcher::StartListeners(String const& name) void EventDispatcher::StartListeners(const String& name)
{ {
for (auto& listener : listeners_) for (auto& listener : listeners_)
{ {
@ -79,7 +79,7 @@ void EventDispatcher::StartListeners(String const& name)
} }
} }
void EventDispatcher::StopListeners(String const& name) void EventDispatcher::StopListeners(const String& name)
{ {
for (auto& listener : listeners_) for (auto& listener : listeners_)
{ {
@ -90,7 +90,7 @@ void EventDispatcher::StopListeners(String const& name)
} }
} }
void EventDispatcher::RemoveListeners(String const& name) void EventDispatcher::RemoveListeners(const String& name)
{ {
for (auto& listener : listeners_) for (auto& listener : listeners_)
{ {

View File

@ -45,7 +45,7 @@ public:
/// @param name 监听器名称 /// @param name 监听器名称
/// @param type 监听的事件类型 /// @param type 监听的事件类型
/// @param callback 回调函数 /// @param callback 回调函数
EventListener* AddListener(String const& name, EventType type, EventListener::Callback callback); EventListener* AddListener(const String& name, EventType type, EventListener::Callback callback);
/// \~chinese /// \~chinese
/// @brief 添加监听器 /// @brief 添加监听器
@ -63,7 +63,7 @@ public:
/// @param name 监听器名称 /// @param name 监听器名称
/// @param callback 回调函数 /// @param callback 回调函数
template <typename _EventTy, typename = typename std::enable_if<IsEvent<_EventTy>::value, int>> template <typename _EventTy, typename = typename std::enable_if<IsEvent<_EventTy>::value, int>>
EventListener* AddListener(String const& name, EventListener::Callback callback) EventListener* AddListener(const String& name, EventListener::Callback callback)
{ {
return AddListener(name, KGE_EVENT(_EventTy), callback); return AddListener(name, KGE_EVENT(_EventTy), callback);
} }
@ -71,17 +71,17 @@ public:
/// \~chinese /// \~chinese
/// @brief 启动监听器 /// @brief 启动监听器
/// @param name 监听器名称 /// @param name 监听器名称
void StartListeners(String const& name); void StartListeners(const String& name);
/// \~chinese /// \~chinese
/// @brief 停止监听器 /// @brief 停止监听器
/// @param name 监听器名称 /// @param name 监听器名称
void StopListeners(String const& name); void StopListeners(const String& name);
/// \~chinese /// \~chinese
/// @brief 移除监听器 /// @brief 移除监听器
/// @param name 监听器名称 /// @param name 监听器名称
void RemoveListeners(String const& name); void RemoveListeners(const String& name);
/// \~chinese /// \~chinese
/// @brief 启动监听器 /// @brief 启动监听器

View File

@ -24,7 +24,7 @@
namespace kiwano namespace kiwano
{ {
EventListenerPtr EventListener::Create(EventType type, Callback const& callback) EventListenerPtr EventListener::Create(EventType type, const Callback& callback)
{ {
EventListenerPtr ptr = new (std::nothrow) EventListener; EventListenerPtr ptr = new (std::nothrow) EventListener;
if (ptr) if (ptr)
@ -35,7 +35,7 @@ EventListenerPtr EventListener::Create(EventType type, Callback const& callback)
return ptr; return ptr;
} }
EventListenerPtr EventListener::Create(String const& name, EventType type, Callback const& callback) EventListenerPtr EventListener::Create(const String& name, EventType type, const Callback& callback)
{ {
EventListenerPtr ptr = new (std::nothrow) EventListener; EventListenerPtr ptr = new (std::nothrow) EventListener;
if (ptr) if (ptr)

View File

@ -58,21 +58,21 @@ public:
/// @brief 创建监听器 /// @brief 创建监听器
/// @param type 监听的事件类型 /// @param type 监听的事件类型
/// @param callback 回调函数 /// @param callback 回调函数
static EventListenerPtr Create(EventType type, Callback const& callback); static EventListenerPtr Create(EventType type, const Callback& callback);
/// \~chinese /// \~chinese
/// @brief 创建监听器 /// @brief 创建监听器
/// @param name 监听器名称 /// @param name 监听器名称
/// @param type 监听的事件类型 /// @param type 监听的事件类型
/// @param callback 回调函数 /// @param callback 回调函数
static EventListenerPtr Create(String const& name, EventType type, Callback const& callback); static EventListenerPtr Create(const String& name, EventType type, const Callback& callback);
/// \~chinese /// \~chinese
/// @brief 创建监听器 /// @brief 创建监听器
/// @tparam _EventTy 事件类型 /// @tparam _EventTy 事件类型
/// @param callback 回调函数 /// @param callback 回调函数
template <typename _EventTy, typename = typename std::enable_if<IsEvent<_EventTy>::value, int>::type> template <typename _EventTy, typename = typename std::enable_if<IsEvent<_EventTy>::value, int>::type>
static inline EventListenerPtr Create(Callback const& callback) static inline EventListenerPtr Create(const Callback& callback)
{ {
return EventListener::Create(KGE_EVENT(_EventTy), callback); return EventListener::Create(KGE_EVENT(_EventTy), callback);
} }
@ -83,7 +83,7 @@ public:
/// @param name 监听器名称 /// @param name 监听器名称
/// @param callback 回调函数 /// @param callback 回调函数
template <typename _EventTy, typename = typename std::enable_if<IsEvent<_EventTy>::value, int>::type> template <typename _EventTy, typename = typename std::enable_if<IsEvent<_EventTy>::value, int>::type>
static inline EventListenerPtr Create(String const& name, Callback const& callback) static inline EventListenerPtr Create(const String& name, const Callback& callback)
{ {
return EventListener::Create(name, KGE_EVENT(_EventTy), callback); return EventListener::Create(name, KGE_EVENT(_EventTy), callback);
} }
@ -127,7 +127,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置回调函数 /// @brief 设置回调函数
void SetCallback(Callback const& cb); void SetCallback(const Callback& cb);
/// \~chinese /// \~chinese
/// @brief 获取监听的事件类型 /// @brief 获取监听的事件类型
@ -135,7 +135,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置监听的事件类型 /// @brief 设置监听的事件类型
void SetEventType(EventType const& type); void SetEventType(const EventType& type);
/// \~chinese /// \~chinese
/// @brief 设置监听的事件类型 /// @brief 设置监听的事件类型
@ -198,7 +198,7 @@ inline const EventListener::Callback& EventListener::GetCallback() const
return callback_; return callback_;
} }
inline void EventListener::SetCallback(Callback const& cb) inline void EventListener::SetCallback(const Callback& cb)
{ {
callback_ = cb; callback_ = cb;
} }
@ -208,7 +208,7 @@ inline EventType EventListener::GetEventType() const
return type_; return type_;
} }
inline void EventListener::SetEventType(EventType const& type) inline void EventListener::SetEventType(const EventType& type)
{ {
type_ = type; type_ = type;
} }

View File

@ -307,12 +307,12 @@ public:
return old; return old;
} }
inline bool operator==(Iterator const& other) const inline bool operator==(const Iterator& other) const
{ {
return base_ == other.base_ && is_end_ == other.is_end_; return base_ == other.base_ && is_end_ == other.is_end_;
} }
inline bool operator!=(Iterator const& other) const inline bool operator!=(const Iterator& other) const
{ {
return !(*this == other); return !(*this == other);
} }

View File

@ -28,7 +28,7 @@ Library::Library()
{ {
} }
Library::Library(String const& lib) Library::Library(const String& lib)
: instance_(nullptr) : instance_(nullptr)
{ {
Load(lib); Load(lib);
@ -39,7 +39,7 @@ Library::~Library()
Free(); Free();
} }
bool Library::Load(String const& lib) bool Library::Load(const String& lib)
{ {
instance_ = ::LoadLibraryA(lib.c_str()); instance_ = ::LoadLibraryA(lib.c_str());
return IsValid(); return IsValid();
@ -59,7 +59,7 @@ void Library::Free()
} }
} }
FARPROC Library::GetProcess(String const& proc_name) FARPROC Library::GetProcess(const String& proc_name)
{ {
KGE_ASSERT(instance_ != nullptr); KGE_ASSERT(instance_ != nullptr);

View File

@ -37,14 +37,14 @@ public:
/// \~chinese /// \~chinese
/// @brief 构造DLL库 /// @brief 构造DLL库
/// @param lib DLL文件路径 /// @param lib DLL文件路径
Library(String const& lib); Library(const String& lib);
virtual ~Library(); virtual ~Library();
/// \~chinese /// \~chinese
/// @brief 加载DLL /// @brief 加载DLL
/// @param lib DLL文件路径 /// @param lib DLL文件路径
bool Load(String const& lib); bool Load(const String& lib);
/// \~chinese /// \~chinese
/// @brief 是否有效 /// @brief 是否有效
@ -57,13 +57,13 @@ public:
/// \~chinese /// \~chinese
/// @brief 检索指定的DLL中的输出库函数地址 /// @brief 检索指定的DLL中的输出库函数地址
/// @param proc_name 函数名 /// @param proc_name 函数名
FARPROC GetProcess(String const& proc_name); FARPROC GetProcess(const String& proc_name);
/// \~chinese /// \~chinese
/// @brief 检索指定的DLL中的输出库函数地址 /// @brief 检索指定的DLL中的输出库函数地址
/// @param proc_name 函数名 /// @param proc_name 函数名
template <typename _Proc> template <typename _Proc>
inline _Proc GetProcess(String const& proc_name) inline _Proc GetProcess(const String& proc_name)
{ {
return reinterpret_cast<_Proc>(GetProcess(proc_name)); return reinterpret_cast<_Proc>(GetProcess(proc_name));
} }

View File

@ -61,12 +61,12 @@ const Any& ObjectBase::GetUserData() const
return user_data_; return user_data_;
} }
void ObjectBase::SetUserData(Any const& data) void ObjectBase::SetUserData(const Any& data)
{ {
user_data_ = data; user_data_ = data;
} }
void ObjectBase::SetName(String const& name) void ObjectBase::SetName(const String& name)
{ {
if (IsName(name)) if (IsName(name))
return; return;

View File

@ -43,7 +43,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置对象名 /// @brief 设置对象名
void SetName(String const& name); void SetName(const String& name);
/// \~chinese /// \~chinese
/// @brief 获取对象名 /// @brief 获取对象名
@ -52,7 +52,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 判断对象的名称是否相同 /// @brief 判断对象的名称是否相同
/// @param name 需要判断的名称 /// @param name 需要判断的名称
bool IsName(String const& name) const; bool IsName(const String& name) const;
/// \~chinese /// \~chinese
/// @brief 获取用户数据 /// @brief 获取用户数据
@ -60,7 +60,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置用户数据 /// @brief 设置用户数据
void SetUserData(Any const& data); void SetUserData(const Any& data);
/// \~chinese /// \~chinese
/// @brief 获取对象ID /// @brief 获取对象ID
@ -111,7 +111,7 @@ inline String ObjectBase::GetName() const
return String(); return String();
} }
inline bool ObjectBase::IsName(String const& name) const inline bool ObjectBase::IsName(const String& name) const
{ {
return name_ ? (*name_ == name) : name.empty(); return name_ ? (*name_ == name) : name.empty();
} }

View File

@ -202,67 +202,67 @@ private:
}; };
template <class _Ty, class _UTy, class _ProxyTy> template <class _Ty, class _UTy, class _ProxyTy>
inline bool operator==(SmartPtr<_Ty, _ProxyTy> const& lhs, SmartPtr<_UTy, _ProxyTy> const& rhs) noexcept inline bool operator==(const SmartPtr<_Ty, _ProxyTy>& lhs, const SmartPtr<_UTy, _ProxyTy>& rhs) noexcept
{ {
return lhs.Get() == rhs.Get(); return lhs.Get() == rhs.Get();
} }
template <class _Ty, class _ProxyTy> template <class _Ty, class _ProxyTy>
inline bool operator==(SmartPtr<_Ty, _ProxyTy> const& lhs, _Ty* rhs) noexcept inline bool operator==(const SmartPtr<_Ty, _ProxyTy>& lhs, _Ty* rhs) noexcept
{ {
return lhs.Get() == rhs; return lhs.Get() == rhs;
} }
template <class _Ty, class _ProxyTy> template <class _Ty, class _ProxyTy>
inline bool operator==(_Ty* lhs, SmartPtr<_Ty, _ProxyTy> const& rhs) noexcept inline bool operator==(_Ty* lhs, const SmartPtr<_Ty, _ProxyTy>& rhs) noexcept
{ {
return lhs == rhs.Get(); return lhs == rhs.Get();
} }
template <class _Ty, class _ProxyTy> template <class _Ty, class _ProxyTy>
inline bool operator==(SmartPtr<_Ty, _ProxyTy> const& lhs, std::nullptr_t) noexcept inline bool operator==(const SmartPtr<_Ty, _ProxyTy>& lhs, std::nullptr_t) noexcept
{ {
return !static_cast<bool>(lhs); return !static_cast<bool>(lhs);
} }
template <class _Ty, class _ProxyTy> template <class _Ty, class _ProxyTy>
inline bool operator==(std::nullptr_t, SmartPtr<_Ty, _ProxyTy> const& rhs) noexcept inline bool operator==(std::nullptr_t, const SmartPtr<_Ty, _ProxyTy>& rhs) noexcept
{ {
return !static_cast<bool>(rhs); return !static_cast<bool>(rhs);
} }
template <class _Ty, class _UTy, class _ProxyTy> template <class _Ty, class _UTy, class _ProxyTy>
inline bool operator!=(SmartPtr<_Ty, _ProxyTy> const& lhs, SmartPtr<_UTy, _ProxyTy> const& rhs) noexcept inline bool operator!=(const SmartPtr<_Ty, _ProxyTy>& lhs, const SmartPtr<_UTy, _ProxyTy>& rhs) noexcept
{ {
return !(lhs == rhs); return !(lhs == rhs);
} }
template <class _Ty, class _ProxyTy> template <class _Ty, class _ProxyTy>
inline bool operator!=(SmartPtr<_Ty, _ProxyTy> const& lhs, _Ty* rhs) noexcept inline bool operator!=(const SmartPtr<_Ty, _ProxyTy>& lhs, _Ty* rhs) noexcept
{ {
return lhs.Get() != rhs; return lhs.Get() != rhs;
} }
template <class _Ty, class _ProxyTy> template <class _Ty, class _ProxyTy>
inline bool operator!=(_Ty* lhs, SmartPtr<_Ty, _ProxyTy> const& rhs) noexcept inline bool operator!=(_Ty* lhs, const SmartPtr<_Ty, _ProxyTy>& rhs) noexcept
{ {
return lhs != rhs.Get(); return lhs != rhs.Get();
} }
template <class _Ty, class _ProxyTy> template <class _Ty, class _ProxyTy>
inline bool operator!=(SmartPtr<_Ty, _ProxyTy> const& lhs, std::nullptr_t) noexcept inline bool operator!=(const SmartPtr<_Ty, _ProxyTy>& lhs, std::nullptr_t) noexcept
{ {
return static_cast<bool>(lhs); return static_cast<bool>(lhs);
} }
template <class _Ty, class _ProxyTy> template <class _Ty, class _ProxyTy>
inline bool operator!=(std::nullptr_t, SmartPtr<_Ty, _ProxyTy> const& rhs) noexcept inline bool operator!=(std::nullptr_t, const SmartPtr<_Ty, _ProxyTy>& rhs) noexcept
{ {
return static_cast<bool>(rhs); return static_cast<bool>(rhs);
} }
template <class _Ty, class _UTy, class _ProxyTy> template <class _Ty, class _UTy, class _ProxyTy>
inline bool operator<(SmartPtr<_Ty, _ProxyTy> const& lhs, SmartPtr<_UTy, _ProxyTy> const& rhs) noexcept inline bool operator<(const SmartPtr<_Ty, _ProxyTy>& lhs, const SmartPtr<_UTy, _ProxyTy>& rhs) noexcept
{ {
return lhs.Get() < rhs.Get(); return lhs.Get() < rhs.Get();
} }

View File

@ -23,7 +23,7 @@
namespace kiwano namespace kiwano
{ {
TimerPtr Timer::Create(Callback const& cb, Duration interval, int times) TimerPtr Timer::Create(const Callback& cb, Duration interval, int times)
{ {
TimerPtr ptr = new (std::nothrow) Timer; TimerPtr ptr = new (std::nothrow) Timer;
if (ptr) if (ptr)
@ -35,7 +35,7 @@ TimerPtr Timer::Create(Callback const& cb, Duration interval, int times)
return ptr; return ptr;
} }
TimerPtr Timer::Create(String const& name, Callback const& cb, Duration interval, int times) TimerPtr Timer::Create(const String& name, const Callback& cb, Duration interval, int times)
{ {
TimerPtr ptr = new (std::nothrow) Timer; TimerPtr ptr = new (std::nothrow) Timer;
if (ptr) if (ptr)

View File

@ -55,7 +55,7 @@ public:
/// @param cb 回调函数 /// @param cb 回调函数
/// @param interval 时间间隔 /// @param interval 时间间隔
/// @param times 执行次数(设 -1 为永久执行) /// @param times 执行次数(设 -1 为永久执行)
static TimerPtr Create(Callback const& cb, Duration interval, int times = -1); static TimerPtr Create(const Callback& cb, Duration interval, int times = -1);
/// \~chinese /// \~chinese
/// @brief 创建定时器 /// @brief 创建定时器
@ -63,7 +63,7 @@ public:
/// @param cb 回调函数 /// @param cb 回调函数
/// @param interval 时间间隔 /// @param interval 时间间隔
/// @param times 执行次数(设 -1 为永久执行) /// @param times 执行次数(设 -1 为永久执行)
static TimerPtr Create(String const& name, Callback const& cb, Duration interval, int times = -1); static TimerPtr Create(const String& name, const Callback& cb, Duration interval, int times = -1);
/// \~chinese /// \~chinese
/// @brief 构造空定时器 /// @brief 构造空定时器

View File

@ -40,12 +40,12 @@ void TimerManager::UpdateTimers(Duration dt)
} }
} }
Timer* TimerManager::AddTimer(Timer::Callback const& cb, Duration interval, int times) Timer* TimerManager::AddTimer(const Timer::Callback& cb, Duration interval, int times)
{ {
return AddTimer(String(), cb, interval, times); return AddTimer(String(), cb, interval, times);
} }
Timer* TimerManager::AddTimer(String const& name, Timer::Callback const& cb, Duration interval, int times) Timer* TimerManager::AddTimer(const String& name, const Timer::Callback& cb, Duration interval, int times)
{ {
TimerPtr timer = Timer::Create(name, cb, interval, times); TimerPtr timer = Timer::Create(name, cb, interval, times);
return AddTimer(timer); return AddTimer(timer);
@ -64,7 +64,7 @@ Timer* TimerManager::AddTimer(TimerPtr timer)
return timer.Get(); return timer.Get();
} }
void TimerManager::StopTimers(String const& name) void TimerManager::StopTimers(const String& name)
{ {
if (timers_.IsEmpty()) if (timers_.IsEmpty())
return; return;
@ -78,7 +78,7 @@ void TimerManager::StopTimers(String const& name)
} }
} }
void TimerManager::StartTimers(String const& name) void TimerManager::StartTimers(const String& name)
{ {
if (timers_.IsEmpty()) if (timers_.IsEmpty())
return; return;
@ -92,7 +92,7 @@ void TimerManager::StartTimers(String const& name)
} }
} }
void TimerManager::RemoveTimers(String const& name) void TimerManager::RemoveTimers(const String& name)
{ {
if (timers_.IsEmpty()) if (timers_.IsEmpty())
return; return;

View File

@ -35,7 +35,7 @@ public:
/// @param cb 回调函数 /// @param cb 回调函数
/// @param interval 时间间隔 /// @param interval 时间间隔
/// @param times 执行次数(设 -1 为永久执行) /// @param times 执行次数(设 -1 为永久执行)
Timer* AddTimer(Timer::Callback const& cb, Duration interval, int times = -1); Timer* AddTimer(const Timer::Callback& cb, Duration interval, int times = -1);
/// \~chinese /// \~chinese
/// @brief 添加定时器 /// @brief 添加定时器
@ -43,7 +43,7 @@ public:
/// @param cb 回调函数 /// @param cb 回调函数
/// @param interval 时间间隔 /// @param interval 时间间隔
/// @param times 执行次数(设 -1 为永久执行) /// @param times 执行次数(设 -1 为永久执行)
Timer* AddTimer(String const& name, Timer::Callback const& cb, Duration interval, int times = -1); Timer* AddTimer(const String& name, const Timer::Callback& cb, Duration interval, int times = -1);
/// \~chinese /// \~chinese
/// @brief 添加定时器 /// @brief 添加定时器
@ -51,15 +51,15 @@ public:
/// \~chinese /// \~chinese
/// @brief 启动定时器 /// @brief 启动定时器
void StartTimers(String const& timer_name); void StartTimers(const String& timer_name);
/// \~chinese /// \~chinese
/// @brief 停止定时器 /// @brief 停止定时器
void StopTimers(String const& timer_name); void StopTimers(const String& timer_name);
/// \~chinese /// \~chinese
/// @brief 移除定时器 /// @brief 移除定时器
void RemoveTimers(String const& timer_name); void RemoveTimers(const String& timer_name);
/// \~chinese /// \~chinese
/// @brief 启动所有定时器 /// @brief 启动所有定时器

View File

@ -2,7 +2,7 @@
namespace kiwano namespace kiwano
{ {
Event::Event(EventType const& type) Event::Event(const EventType& type)
: type_(type) : type_(type)
{ {
} }

View File

@ -44,7 +44,7 @@ class KGE_API Event : public RefCounter
public: public:
/// \~chinese /// \~chinese
/// @brief 构造事件 /// @brief 构造事件
Event(EventType const& type); Event(const EventType& type);
virtual ~Event(); virtual ~Event();

View File

@ -2,7 +2,7 @@
namespace kiwano namespace kiwano
{ {
MouseEvent::MouseEvent(EventType const& type) MouseEvent::MouseEvent(const EventType& type)
: Event(type) : Event(type)
, pos() , pos()
{ {

View File

@ -46,7 +46,7 @@ class KGE_API MouseEvent : public Event
public: public:
Point pos; ///< 鼠标位置 Point pos; ///< 鼠标位置
MouseEvent(EventType const& type); MouseEvent(const EventType& type);
}; };
/// \~chinese /// \~chinese

View File

@ -75,7 +75,7 @@ struct Matrix3x2T
m[i] = p[i]; m[i] = p[i];
} }
Matrix3x2T(Matrix3x2T const& other) Matrix3x2T(const Matrix3x2T& other)
: _11(other._11) : _11(other._11)
, _12(other._12) , _12(other._12)
, _21(other._21) , _21(other._21)
@ -89,7 +89,7 @@ KGE_SUPPRESS_WARNING_PUSH
KGE_SUPPRESS_WARNING(26495) // ignore warning "always initialize member variables" KGE_SUPPRESS_WARNING(26495) // ignore warning "always initialize member variables"
template <typename _MTy> template <typename _MTy>
Matrix3x2T(_MTy const& other) Matrix3x2T(const _MTy& other)
{ {
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
m[i] = other[i]; m[i] = other[i];
@ -107,7 +107,7 @@ KGE_SUPPRESS_WARNING_POP
return m[index]; return m[index];
} }
inline Matrix3x2T& operator=(Matrix3x2T const& other) inline Matrix3x2T& operator=(const Matrix3x2T& other)
{ {
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
m[i] = other[i]; m[i] = other[i];
@ -115,14 +115,14 @@ KGE_SUPPRESS_WARNING_POP
} }
template <typename _Lty, typename _Rty> template <typename _Lty, typename _Rty>
inline Matrix3x2T& operator=(MatrixMultiply<ValueType, _Lty, _Rty> const& other) inline Matrix3x2T& operator=(MatrixMultiply<ValueType, _Lty, const _Rty>& other)
{ {
Matrix3x2T result(other); Matrix3x2T result(other);
(*this) = result; (*this) = result;
return (*this); return (*this);
} }
inline Matrix3x2T& operator*=(Matrix3x2T const& other) inline Matrix3x2T& operator*=(const Matrix3x2T& other)
{ {
return operator=((*this) * other); return operator=((*this) * other);
} }
@ -240,10 +240,10 @@ KGE_SUPPRESS_WARNING_POP
template <typename _Ty, typename _Lty, typename _Rty> template <typename _Ty, typename _Lty, typename _Rty>
struct MatrixMultiply struct MatrixMultiply
{ {
_Lty const& lhs; const _Lty& lhs;
_Rty const& rhs; const _Rty& rhs;
MatrixMultiply(_Lty const& lhs, _Rty const& rhs) MatrixMultiply(const _Lty& lhs, const _Rty& rhs)
: lhs(lhs) : lhs(lhs)
, rhs(rhs) , rhs(rhs)
{ {
@ -272,15 +272,15 @@ struct MatrixMultiply
}; };
template <typename _Ty> template <typename _Ty>
inline MatrixMultiply<_Ty, Matrix3x2T<_Ty>, Matrix3x2T<_Ty>> operator*(Matrix3x2T<_Ty> const& lhs, inline MatrixMultiply<_Ty, Matrix3x2T<_Ty>, Matrix3x2T<_Ty>> operator*(const Matrix3x2T<_Ty>& lhs,
Matrix3x2T<_Ty> const& rhs) const Matrix3x2T<_Ty>& rhs)
{ {
return MatrixMultiply<_Ty, Matrix3x2T<_Ty>, Matrix3x2T<_Ty>>(lhs, rhs); return MatrixMultiply<_Ty, Matrix3x2T<_Ty>, Matrix3x2T<_Ty>>(lhs, rhs);
} }
template <typename _Ty, typename _Lty, typename _Rty> template <typename _Ty, typename _Lty, typename _Rty>
inline MatrixMultiply<_Ty, MatrixMultiply<_Ty, _Lty, _Rty>, Matrix3x2T<_Ty>> inline MatrixMultiply<_Ty, MatrixMultiply<_Ty, _Lty, _Rty>, Matrix3x2T<_Ty>>
operator*(MatrixMultiply<_Ty, _Lty, _Rty> const& lhs, Matrix3x2T<_Ty> const& rhs) operator*(MatrixMultiply<_Ty, _Lty, const _Rty>& lhs, const Matrix3x2T<_Ty>& rhs)
{ {
return MatrixMultiply<_Ty, MatrixMultiply<_Ty, _Lty, _Rty>, Matrix3x2T<_Ty>>(lhs, rhs); return MatrixMultiply<_Ty, MatrixMultiply<_Ty, _Lty, _Rty>, Matrix3x2T<_Ty>>(lhs, rhs);
} }

View File

@ -72,7 +72,7 @@ Matrix3x2T<_Ty> TransformT<_Ty>::ToMatrix() const
} }
template <typename _Ty> template <typename _Ty>
bool TransformT<_Ty>::operator==(TransformT const& rhs) const bool TransformT<_Ty>::operator==(const TransformT& rhs) const
{ {
return position == rhs.position && rotation == rhs.rotation && scale == rhs.scale && skew == rhs.skew; return position == rhs.position && rotation == rhs.rotation && scale == rhs.scale && skew == rhs.skew;
} }

View File

@ -25,7 +25,7 @@ namespace kiwano
{ {
namespace namespace
{ {
inline String ConvertPathFormat(String const& path) inline String ConvertPathFormat(const String& path)
{ {
// C:\a\b\c.txt => C:/a/b/c.txt // C:\a\b\c.txt => C:/a/b/c.txt
@ -41,7 +41,7 @@ inline String ConvertPathFormat(String const& path)
return result; return result;
} }
inline bool IsFileExists(String const& path) inline bool IsFileExists(const String& path)
{ {
DWORD dwAttrib = ::GetFileAttributesA(path.c_str()); DWORD dwAttrib = ::GetFileAttributesA(path.c_str());
@ -53,7 +53,7 @@ FileSystem::FileSystem() {}
FileSystem::~FileSystem() {} FileSystem::~FileSystem() {}
void FileSystem::AddSearchPath(String const& path) void FileSystem::AddSearchPath(const String& path)
{ {
String search_path = ConvertPathFormat(path); String search_path = ConvertPathFormat(path);
if (!search_path.empty() && search_path[search_path.length() - 1] != '/') if (!search_path.empty() && search_path[search_path.length() - 1] != '/')
@ -64,7 +64,7 @@ void FileSystem::AddSearchPath(String const& path)
search_paths_.push_back(search_path); search_paths_.push_back(search_path);
} }
void FileSystem::SetSearchPaths(Vector<String> const& paths) void FileSystem::SetSearchPaths(const Vector<String>& paths)
{ {
search_paths_ = paths; search_paths_ = paths;
@ -78,7 +78,7 @@ void FileSystem::SetSearchPaths(Vector<String> const& paths)
} }
} }
String FileSystem::GetFullPathForFile(String const& file) const String FileSystem::GetFullPathForFile(const String& file) const
{ {
if (file.empty()) if (file.empty())
{ {
@ -130,19 +130,19 @@ String FileSystem::GetFullPathForFile(String const& file) const
return ""; return "";
} }
void FileSystem::AddFileLookupRule(String const& key, String const& file_path) void FileSystem::AddFileLookupRule(const String& key, const String& file_path)
{ {
file_lookup_dict_.emplace(key, ConvertPathFormat(file_path)); file_lookup_dict_.emplace(key, ConvertPathFormat(file_path));
} }
void FileSystem::SetFileLookupDictionary(UnorderedMap<String, String> const& dict) void FileSystem::SetFileLookupDictionary(const UnorderedMap<String, String>& dict)
{ {
file_lookup_cache_.clear(); file_lookup_cache_.clear();
file_lookup_dict_ = dict; file_lookup_dict_ = dict;
} }
bool FileSystem::IsFileExists(String const& file_path) const bool FileSystem::IsFileExists(const String& file_path) const
{ {
if (IsAbsolutePath(file_path)) if (IsAbsolutePath(file_path))
{ {
@ -155,20 +155,20 @@ bool FileSystem::IsFileExists(String const& file_path) const
} }
} }
bool FileSystem::IsAbsolutePath(String const& path) const bool FileSystem::IsAbsolutePath(const String& path) const
{ {
// like "C:\some.file" // like "C:\some.file"
return path.length() > 2 && ((std::isalpha(path[0]) && path[1] == ':') || (path[0] == '/' && path[1] == '/')); return path.length() > 2 && ((std::isalpha(path[0]) && path[1] == ':') || (path[0] == '/' && path[1] == '/'));
} }
bool FileSystem::RemoveFile(String const& file_path) const bool FileSystem::RemoveFile(const String& file_path) const
{ {
if (::DeleteFileA(file_path.c_str())) if (::DeleteFileA(file_path.c_str()))
return true; return true;
return false; return false;
} }
bool FileSystem::ExtractResourceToFile(Resource const& res, String const& dest_file_name) const bool FileSystem::ExtractResourceToFile(const Resource& res, const String& dest_file_name) const
{ {
HANDLE file_handle = HANDLE file_handle =
::CreateFileA(dest_file_name.c_str(), GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); ::CreateFileA(dest_file_name.c_str(), GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

View File

@ -37,14 +37,14 @@ public:
* @brief * @brief
* @param path * @param path
*/ */
void AddSearchPath(String const& path); void AddSearchPath(const String& path);
/** /**
* \~chinese * \~chinese
* @brief * @brief
* @param paths * @param paths
*/ */
void SetSearchPaths(Vector<String> const& paths); void SetSearchPaths(const Vector<String>& paths);
/** /**
* \~chinese * \~chinese
@ -52,7 +52,7 @@ public:
* @param file * @param file
* @return * @return
*/ */
String GetFullPathForFile(String const& file) const; String GetFullPathForFile(const String& file) const;
/** /**
* \~chinese * \~chinese
@ -60,14 +60,14 @@ public:
* @param key * @param key
* @param file_path * @param file_path
*/ */
void AddFileLookupRule(String const& key, String const& file_path); void AddFileLookupRule(const String& key, const String& file_path);
/** /**
* \~chinese * \~chinese
* @brief * @brief
* @param dict * @param dict
*/ */
void SetFileLookupDictionary(UnorderedMap<String, String> const& dict); void SetFileLookupDictionary(const UnorderedMap<String, String>& dict);
/** /**
* \~chinese * \~chinese
@ -75,7 +75,7 @@ public:
* @param file_path * @param file_path
* @return true * @return true
*/ */
bool IsFileExists(String const& file_path) const; bool IsFileExists(const String& file_path) const;
/** /**
* \~chinese * \~chinese
@ -83,7 +83,7 @@ public:
* @param path * @param path
* @return true * @return true
*/ */
bool IsAbsolutePath(String const& path) const; bool IsAbsolutePath(const String& path) const;
/** /**
* \~chinese * \~chinese
@ -91,7 +91,7 @@ public:
* @param file_path * @param file_path
* @return * @return
*/ */
bool RemoveFile(String const& file_path) const; bool RemoveFile(const String& file_path) const;
/** /**
* \~chinese * \~chinese
@ -100,7 +100,7 @@ public:
* @param dest_file_name * @param dest_file_name
* @return * @return
*/ */
bool ExtractResourceToFile(Resource const& res, String const& dest_file_name) const; bool ExtractResourceToFile(const Resource& res, const String& dest_file_name) const;
private: private:
FileSystem(); FileSystem();

View File

@ -69,7 +69,7 @@ public:
* @param fullscreen * @param fullscreen
* @throw kiwano::SystemError * @throw kiwano::SystemError
*/ */
static WindowPtr Create(String const& title, uint32_t width, uint32_t height, uint32_t icon = 0, static WindowPtr Create(const String& title, uint32_t width, uint32_t height, uint32_t icon = 0,
bool resizable = false, bool fullscreen = false); bool resizable = false, bool fullscreen = false);
/** /**
@ -111,7 +111,7 @@ public:
* @brief * @brief
* @param title * @param title
*/ */
virtual void SetTitle(String const& title) = 0; virtual void SetTitle(const String& title) = 0;
/** /**
* \~chinese * \~chinese

View File

@ -46,9 +46,9 @@ public:
virtual ~WindowWin32Impl(); virtual ~WindowWin32Impl();
void Init(String const& title, uint32_t width, uint32_t height, uint32_t icon, bool resizable, bool fullscreen); void Init(const String& title, uint32_t width, uint32_t height, uint32_t icon, bool resizable, bool fullscreen);
void SetTitle(String const& title) override; void SetTitle(const String& title) override;
void SetIcon(uint32_t icon_resource) override; void SetIcon(uint32_t icon_resource) override;
@ -81,7 +81,7 @@ private:
std::array<KeyCode, 256> key_map_; std::array<KeyCode, 256> key_map_;
}; };
WindowPtr Window::Create(String const& title, uint32_t width, uint32_t height, uint32_t icon, bool resizable, WindowPtr Window::Create(const String& title, uint32_t width, uint32_t height, uint32_t icon, bool resizable,
bool fullscreen) bool fullscreen)
{ {
WindowWin32ImplPtr ptr = new (std::nothrow) WindowWin32Impl; WindowWin32ImplPtr ptr = new (std::nothrow) WindowWin32Impl;
@ -208,7 +208,7 @@ WindowWin32Impl::WindowWin32Impl()
WindowWin32Impl::~WindowWin32Impl() {} WindowWin32Impl::~WindowWin32Impl() {}
void WindowWin32Impl::Init(String const& title, uint32_t width, uint32_t height, uint32_t icon, bool resizable, void WindowWin32Impl::Init(const String& title, uint32_t width, uint32_t height, uint32_t icon, bool resizable,
bool fullscreen) bool fullscreen)
{ {
HINSTANCE hinst = GetModuleHandleW(nullptr); HINSTANCE hinst = GetModuleHandleW(nullptr);
@ -317,7 +317,7 @@ void WindowWin32Impl::PumpEvents()
} }
} }
void WindowWin32Impl::SetTitle(String const& title) void WindowWin32Impl::SetTitle(const String& title)
{ {
if (handle_) if (handle_)
{ {

View File

@ -40,7 +40,7 @@ GradientStop::GradientStop(float offset, Color color)
{ {
} }
LinearGradientStyle::LinearGradientStyle(Point const& begin, Point const& end, Vector<GradientStop> const& stops, LinearGradientStyle::LinearGradientStyle(const Point& begin, const Point& end, const Vector<GradientStop>& stops,
GradientExtendMode extend_mode) GradientExtendMode extend_mode)
: begin(begin) : begin(begin)
, end(end) , end(end)
@ -49,8 +49,8 @@ LinearGradientStyle::LinearGradientStyle(Point const& begin, Point const& end, V
{ {
} }
RadialGradientStyle::RadialGradientStyle(Point const& center, Vec2 const& offset, Vec2 const& radius, RadialGradientStyle::RadialGradientStyle(const Point& center, const Vec2& offset, const Vec2& radius,
Vector<GradientStop> const& stops, GradientExtendMode extend_mode) const Vector<GradientStop>& stops, GradientExtendMode extend_mode)
: center(center) : center(center)
, offset(offset) , offset(offset)
, radius(radius) , radius(radius)
@ -59,7 +59,7 @@ RadialGradientStyle::RadialGradientStyle(Point const& center, Vec2 const& offset
{ {
} }
BrushPtr Brush::Create(Color const& color) BrushPtr Brush::Create(const Color& color)
{ {
BrushPtr ptr = new (std::nothrow) Brush; BrushPtr ptr = new (std::nothrow) Brush;
if (ptr) if (ptr)
@ -69,7 +69,7 @@ BrushPtr Brush::Create(Color const& color)
return ptr; return ptr;
} }
BrushPtr Brush::Create(LinearGradientStyle const& style) BrushPtr Brush::Create(const LinearGradientStyle& style)
{ {
BrushPtr ptr = new (std::nothrow) Brush; BrushPtr ptr = new (std::nothrow) Brush;
if (ptr) if (ptr)
@ -79,7 +79,7 @@ BrushPtr Brush::Create(LinearGradientStyle const& style)
return ptr; return ptr;
} }
BrushPtr Brush::Create(RadialGradientStyle const& style) BrushPtr Brush::Create(const RadialGradientStyle& style)
{ {
BrushPtr ptr = new (std::nothrow) Brush; BrushPtr ptr = new (std::nothrow) Brush;
if (ptr) if (ptr)
@ -94,19 +94,19 @@ Brush::Brush()
{ {
} }
void Brush::SetColor(Color const& color) void Brush::SetColor(const Color& color)
{ {
Renderer::GetInstance().CreateBrush(*this, color); Renderer::GetInstance().CreateBrush(*this, color);
type_ = Brush::Type::SolidColor; type_ = Brush::Type::SolidColor;
} }
void Brush::SetStyle(LinearGradientStyle const& style) void Brush::SetStyle(const LinearGradientStyle& style)
{ {
Renderer::GetInstance().CreateBrush(*this, style); Renderer::GetInstance().CreateBrush(*this, style);
type_ = Brush::Type::LinearGradient; type_ = Brush::Type::LinearGradient;
} }
void Brush::SetStyle(RadialGradientStyle const& style) void Brush::SetStyle(const RadialGradientStyle& style)
{ {
Renderer::GetInstance().CreateBrush(*this, style); Renderer::GetInstance().CreateBrush(*this, style);
type_ = Brush::Type::RadialGradient; type_ = Brush::Type::RadialGradient;

View File

@ -63,7 +63,7 @@ struct LinearGradientStyle
Vector<GradientStop> stops; ///< 渐变转换点集合 Vector<GradientStop> stops; ///< 渐变转换点集合
GradientExtendMode extend_mode; ///< 渐变扩充模式 GradientExtendMode extend_mode; ///< 渐变扩充模式
LinearGradientStyle(Point const& begin, Point const& end, Vector<GradientStop> const& stops, LinearGradientStyle(const Point& begin, const Point& end, const Vector<GradientStop>& stops,
GradientExtendMode extend_mode = GradientExtendMode::Clamp); GradientExtendMode extend_mode = GradientExtendMode::Clamp);
}; };
@ -77,7 +77,7 @@ struct RadialGradientStyle
Vector<GradientStop> stops; ///< 渐变转换点集合 Vector<GradientStop> stops; ///< 渐变转换点集合
GradientExtendMode extend_mode; ///< 渐变扩充模式 GradientExtendMode extend_mode; ///< 渐变扩充模式
RadialGradientStyle(Point const& center, Vec2 const& offset, Vec2 const& radius, Vector<GradientStop> const& stops, RadialGradientStyle(const Point& center, const Vec2& offset, const Vec2& radius, const Vector<GradientStop>& stops,
GradientExtendMode extend_mode = GradientExtendMode::Clamp); GradientExtendMode extend_mode = GradientExtendMode::Clamp);
}; };
@ -91,31 +91,31 @@ public:
/// \~chinese /// \~chinese
/// @brief 创建纯色画刷 /// @brief 创建纯色画刷
/// @param color 画刷颜色 /// @param color 画刷颜色
static BrushPtr Create(Color const& color); static BrushPtr Create(const Color& color);
/// \~chinese /// \~chinese
/// @brief 创建线性渐变样式 /// @brief 创建线性渐变样式
/// @param style 线性渐变样式 /// @param style 线性渐变样式
static BrushPtr Create(LinearGradientStyle const& style); static BrushPtr Create(const LinearGradientStyle& style);
/// \~chinese /// \~chinese
/// @brief 创建径向渐变样式 /// @brief 创建径向渐变样式
/// @param style 径向渐变样式 /// @param style 径向渐变样式
static BrushPtr Create(RadialGradientStyle const& style); static BrushPtr Create(const RadialGradientStyle& style);
Brush(); Brush();
/// \~chinese /// \~chinese
/// @brief 设置纯色画刷颜色 /// @brief 设置纯色画刷颜色
void SetColor(Color const& color); void SetColor(const Color& color);
/// \~chinese /// \~chinese
/// @brief 设置线性渐变样式 /// @brief 设置线性渐变样式
void SetStyle(LinearGradientStyle const& style); void SetStyle(const LinearGradientStyle& style);
/// \~chinese /// \~chinese
/// @brief 设置径向渐变样式 /// @brief 设置径向渐变样式
void SetStyle(RadialGradientStyle const& style); void SetStyle(const RadialGradientStyle& style);
/// \~chinese /// \~chinese
/// @brief 设置纹理 /// @brief 设置纹理

View File

@ -74,7 +74,7 @@ public:
unsigned long STDMETHODCALLTYPE Release(); unsigned long STDMETHODCALLTYPE Release();
HRESULT STDMETHODCALLTYPE QueryInterface(IID const& riid, void** ppvObject); HRESULT STDMETHODCALLTYPE QueryInterface(const IID& riid, void** ppvObject);
private: private:
unsigned long ref_count_; unsigned long ref_count_;
@ -148,7 +148,7 @@ STDMETHODIMP_(unsigned long) D2DDeviceResources::Release()
return newCount; return newCount;
} }
STDMETHODIMP D2DDeviceResources::QueryInterface(IID const& riid, void** object) STDMETHODIMP D2DDeviceResources::QueryInterface(const IID& riid, void** object)
{ {
if (__uuidof(ID2DDeviceResources) == riid) if (__uuidof(ID2DDeviceResources) == riid)
{ {

View File

@ -82,7 +82,7 @@ public:
unsigned long STDMETHODCALLTYPE Release(); unsigned long STDMETHODCALLTYPE Release();
HRESULT STDMETHODCALLTYPE QueryInterface(IID const& riid, void** ppvObject); HRESULT STDMETHODCALLTYPE QueryInterface(const IID& riid, void** ppvObject);
public: public:
D3D10DeviceResources(); D3D10DeviceResources();
@ -414,7 +414,7 @@ STDMETHODIMP_(unsigned long) D3D10DeviceResources::Release()
return newCount; return newCount;
} }
STDMETHODIMP D3D10DeviceResources::QueryInterface(IID const& riid, void** object) STDMETHODIMP D3D10DeviceResources::QueryInterface(const IID& riid, void** object)
{ {
if (__uuidof(ID3D10DeviceResources) == riid) if (__uuidof(ID3D10DeviceResources) == riid)
{ {

View File

@ -71,7 +71,7 @@ public:
unsigned long STDMETHODCALLTYPE Release(); unsigned long STDMETHODCALLTYPE Release();
HRESULT STDMETHODCALLTYPE QueryInterface(IID const& riid, void** ppvObject); HRESULT STDMETHODCALLTYPE QueryInterface(const IID& riid, void** ppvObject);
public: public:
D3D11DeviceResources(); D3D11DeviceResources();
@ -434,7 +434,7 @@ STDMETHODIMP_(unsigned long) D3D11DeviceResources::Release()
return newCount; return newCount;
} }
STDMETHODIMP D3D11DeviceResources::QueryInterface(IID const& riid, void** object) STDMETHODIMP D3D11DeviceResources::QueryInterface(const IID& riid, void** object)
{ {
if (__uuidof(ID3D11DeviceResources) == riid) if (__uuidof(ID3D11DeviceResources) == riid)
{ {

View File

@ -37,7 +37,7 @@ public:
} }
STDMETHOD(AddFilePaths) STDMETHOD(AddFilePaths)
(Vector<String> const& filePaths, _Out_ LPVOID* pCollectionKey, _Out_ uint32_t* pCollectionKeySize); (const Vector<String>& filePaths, _Out_ LPVOID* pCollectionKey, _Out_ uint32_t* pCollectionKeySize);
// IUnknown methods // IUnknown methods
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void** ppvObject); virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void** ppvObject);
@ -80,7 +80,7 @@ HRESULT IFontCollectionLoader::Create(_Out_ IFontCollectionLoader** ppCollection
return hr; return hr;
} }
STDMETHODIMP FontCollectionLoader::AddFilePaths(Vector<String> const& filePaths, _Out_ LPVOID* pCollectionKey, STDMETHODIMP FontCollectionLoader::AddFilePaths(const Vector<String>& filePaths, _Out_ LPVOID* pCollectionKey,
_Out_ uint32_t* pCollectionKeySize) _Out_ uint32_t* pCollectionKeySize)
{ {
if (!pCollectionKey || !pCollectionKeySize) if (!pCollectionKey || !pCollectionKeySize)
@ -178,7 +178,7 @@ public:
STDMETHOD(Initialize)(IDWriteFactory* pFactory); STDMETHOD(Initialize)(IDWriteFactory* pFactory);
STDMETHOD(SetFilePaths)(Vector<String> const& filePaths); STDMETHOD(SetFilePaths)(const Vector<String>& filePaths);
~FontFileEnumerator() ~FontFileEnumerator()
{ {
@ -250,7 +250,7 @@ STDMETHODIMP FontFileEnumerator::Initialize(IDWriteFactory* pFactory)
return E_INVALIDARG; return E_INVALIDARG;
} }
STDMETHODIMP FontFileEnumerator::SetFilePaths(Vector<String> const& filePaths) STDMETHODIMP FontFileEnumerator::SetFilePaths(const Vector<String>& filePaths)
{ {
try try
{ {
@ -343,7 +343,7 @@ public:
} }
STDMETHOD(AddResources) STDMETHOD(AddResources)
(Vector<Resource> const& resources, _Out_ LPVOID* pCollectionKey, _Out_ uint32_t* pCollectionKeySize); (const Vector<Resource>& resources, _Out_ LPVOID* pCollectionKey, _Out_ uint32_t* pCollectionKeySize);
// IUnknown methods // IUnknown methods
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void** ppvObject); virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void** ppvObject);
@ -388,7 +388,7 @@ HRESULT IResourceFontCollectionLoader::Create(_Out_ IResourceFontCollectionLoade
return hr; return hr;
} }
STDMETHODIMP ResourceFontCollectionLoader::AddResources(Vector<Resource> const& resources, _Out_ LPVOID* pCollectionKey, STDMETHODIMP ResourceFontCollectionLoader::AddResources(const Vector<Resource>& resources, _Out_ LPVOID* pCollectionKey,
_Out_ uint32_t* pCollectionKeySize) _Out_ uint32_t* pCollectionKeySize)
{ {
if (!pCollectionKey || !pCollectionKeySize) if (!pCollectionKey || !pCollectionKeySize)
@ -593,7 +593,7 @@ public:
STDMETHOD(Initialize)(IDWriteFactory* pFactory, IDWriteFontFileLoader* pLoader); STDMETHOD(Initialize)(IDWriteFactory* pFactory, IDWriteFontFileLoader* pLoader);
STDMETHOD(SetResources)(Vector<Resource> const& resources); STDMETHOD(SetResources)(const Vector<Resource>& resources);
~ResourceFontFileEnumerator() ~ResourceFontFileEnumerator()
{ {
@ -669,7 +669,7 @@ STDMETHODIMP ResourceFontFileEnumerator::Initialize(IDWriteFactory* pFactory, ID
return E_INVALIDARG; return E_INVALIDARG;
} }
STDMETHODIMP ResourceFontFileEnumerator::SetResources(Vector<Resource> const& resources) STDMETHODIMP ResourceFontFileEnumerator::SetResources(const Vector<Resource>& resources)
{ {
try try
{ {

View File

@ -31,7 +31,7 @@ public:
static HRESULT Create(_Out_ IFontCollectionLoader * *ppCollectionLoader); static HRESULT Create(_Out_ IFontCollectionLoader * *ppCollectionLoader);
STDMETHOD(AddFilePaths) STDMETHOD(AddFilePaths)
(Vector<String> const& filePaths, _Out_ LPVOID* pCollectionKey, _Out_ uint32_t* pCollectionKeySize) PURE; (const Vector<String>& filePaths, _Out_ LPVOID* pCollectionKey, _Out_ uint32_t* pCollectionKeySize) PURE;
}; };
interface DWRITE_DECLARE_INTERFACE("0A1A3F2A-85F2-41BB-80FD-EC01271740C4") IFontFileEnumerator interface DWRITE_DECLARE_INTERFACE("0A1A3F2A-85F2-41BB-80FD-EC01271740C4") IFontFileEnumerator
@ -40,7 +40,7 @@ interface DWRITE_DECLARE_INTERFACE("0A1A3F2A-85F2-41BB-80FD-EC01271740C4") IFont
public: public:
static HRESULT Create(_Out_ IFontFileEnumerator * *ppEnumerator, IDWriteFactory * pFactory); static HRESULT Create(_Out_ IFontFileEnumerator * *ppEnumerator, IDWriteFactory * pFactory);
STDMETHOD(SetFilePaths)(Vector<String> const& filePaths) PURE; STDMETHOD(SetFilePaths)(const Vector<String>& filePaths) PURE;
}; };
interface DWRITE_DECLARE_INTERFACE("F2C411F0-2FB0-4D0E-8C73-D2B8F30137A4") IResourceFontCollectionLoader interface DWRITE_DECLARE_INTERFACE("F2C411F0-2FB0-4D0E-8C73-D2B8F30137A4") IResourceFontCollectionLoader
@ -51,7 +51,7 @@ public:
IDWriteFontFileLoader * pFileLoader); IDWriteFontFileLoader * pFileLoader);
STDMETHOD(AddResources) STDMETHOD(AddResources)
(Vector<Resource> const& resources, _Out_ LPVOID* pCollectionKey, _Out_ uint32_t* pCollectionKeySize) PURE; (const Vector<Resource>& resources, _Out_ LPVOID* pCollectionKey, _Out_ uint32_t* pCollectionKeySize) PURE;
}; };
interface DWRITE_DECLARE_INTERFACE("08D21408-6FC1-4E36-A4EB-4DA16BE3399E") IResourceFontFileLoader interface DWRITE_DECLARE_INTERFACE("08D21408-6FC1-4E36-A4EB-4DA16BE3399E") IResourceFontFileLoader
@ -68,7 +68,7 @@ public:
static HRESULT Create(_Out_ IResourceFontFileEnumerator * *ppEnumerator, IDWriteFactory * pFactory, static HRESULT Create(_Out_ IResourceFontFileEnumerator * *ppEnumerator, IDWriteFactory * pFactory,
IDWriteFontFileLoader * pFileLoader); IDWriteFontFileLoader * pFileLoader);
STDMETHOD(SetResources)(Vector<Resource> const& resources) PURE; STDMETHOD(SetResources)(const Vector<Resource>& resources) PURE;
}; };
interface DWRITE_DECLARE_INTERFACE("A6267450-27F3-4948-995F-FF8345A72F88") IResourceFontFileStream interface DWRITE_DECLARE_INTERFACE("A6267450-27F3-4948-995F-FF8345A72F88") IResourceFontFileStream

View File

@ -94,7 +94,7 @@ void RenderContextImpl::EndDraw()
RestoreDrawingState(); RestoreDrawingState();
} }
void RenderContextImpl::DrawTexture(Texture const& texture, const Rect* src_rect, const Rect* dest_rect) void RenderContextImpl::DrawTexture(const Texture& texture, const Rect* src_rect, const Rect* dest_rect)
{ {
KGE_ASSERT(render_target_ && "Render target has not been initialized!"); KGE_ASSERT(render_target_ && "Render target has not been initialized!");
@ -118,7 +118,7 @@ void RenderContextImpl::DrawTexture(Texture const& texture, const Rect* src_rect
} }
} }
void RenderContextImpl::DrawTextLayout(TextLayout const& layout, Point const& offset) void RenderContextImpl::DrawTextLayout(const TextLayout& layout, const Point& offset)
{ {
KGE_ASSERT(text_renderer_ && "Text renderer has not been initialized!"); KGE_ASSERT(text_renderer_ && "Text renderer has not been initialized!");
@ -159,7 +159,7 @@ void RenderContextImpl::DrawTextLayout(TextLayout const& layout, Point const& of
} }
} }
void RenderContextImpl::DrawShape(Shape const& shape) void RenderContextImpl::DrawShape(const Shape& shape)
{ {
KGE_ASSERT(render_target_ && "Render target has not been initialized!"); KGE_ASSERT(render_target_ && "Render target has not been initialized!");
KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!"); KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!");
@ -177,7 +177,7 @@ void RenderContextImpl::DrawShape(Shape const& shape)
} }
} }
void RenderContextImpl::DrawLine(Point const& point1, Point const& point2) void RenderContextImpl::DrawLine(const Point& point1, const Point& point2)
{ {
KGE_ASSERT(render_target_ && "Render target has not been initialized!"); KGE_ASSERT(render_target_ && "Render target has not been initialized!");
KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!"); KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!");
@ -192,7 +192,7 @@ void RenderContextImpl::DrawLine(Point const& point1, Point const& point2)
IncreasePrimitivesCount(); IncreasePrimitivesCount();
} }
void RenderContextImpl::DrawRectangle(Rect const& rect) void RenderContextImpl::DrawRectangle(const Rect& rect)
{ {
KGE_ASSERT(render_target_ && "Render target has not been initialized!"); KGE_ASSERT(render_target_ && "Render target has not been initialized!");
KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!"); KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!");
@ -206,7 +206,7 @@ void RenderContextImpl::DrawRectangle(Rect const& rect)
IncreasePrimitivesCount(); IncreasePrimitivesCount();
} }
void RenderContextImpl::DrawRoundedRectangle(Rect const& rect, Vec2 const& radius) void RenderContextImpl::DrawRoundedRectangle(const Rect& rect, const Vec2& radius)
{ {
KGE_ASSERT(render_target_ && "Render target has not been initialized!"); KGE_ASSERT(render_target_ && "Render target has not been initialized!");
KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!"); KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!");
@ -221,7 +221,7 @@ void RenderContextImpl::DrawRoundedRectangle(Rect const& rect, Vec2 const& radiu
IncreasePrimitivesCount(); IncreasePrimitivesCount();
} }
void RenderContextImpl::DrawEllipse(Point const& center, Vec2 const& radius) void RenderContextImpl::DrawEllipse(const Point& center, const Vec2& radius)
{ {
KGE_ASSERT(render_target_ && "Render target has not been initialized!"); KGE_ASSERT(render_target_ && "Render target has not been initialized!");
KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!"); KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!");
@ -236,7 +236,7 @@ void RenderContextImpl::DrawEllipse(Point const& center, Vec2 const& radius)
IncreasePrimitivesCount(); IncreasePrimitivesCount();
} }
void RenderContextImpl::FillShape(Shape const& shape) void RenderContextImpl::FillShape(const Shape& shape)
{ {
KGE_ASSERT(render_target_ && "Render target has not been initialized!"); KGE_ASSERT(render_target_ && "Render target has not been initialized!");
KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!"); KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!");
@ -251,7 +251,7 @@ void RenderContextImpl::FillShape(Shape const& shape)
} }
} }
void RenderContextImpl::FillRectangle(Rect const& rect) void RenderContextImpl::FillRectangle(const Rect& rect)
{ {
KGE_ASSERT(render_target_ && "Render target has not been initialized!"); KGE_ASSERT(render_target_ && "Render target has not been initialized!");
KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!"); KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!");
@ -262,7 +262,7 @@ void RenderContextImpl::FillRectangle(Rect const& rect)
IncreasePrimitivesCount(); IncreasePrimitivesCount();
} }
void RenderContextImpl::FillRoundedRectangle(Rect const& rect, Vec2 const& radius) void RenderContextImpl::FillRoundedRectangle(const Rect& rect, const Vec2& radius)
{ {
KGE_ASSERT(render_target_ && "Render target has not been initialized!"); KGE_ASSERT(render_target_ && "Render target has not been initialized!");
KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!"); KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!");
@ -273,7 +273,7 @@ void RenderContextImpl::FillRoundedRectangle(Rect const& rect, Vec2 const& radiu
IncreasePrimitivesCount(); IncreasePrimitivesCount();
} }
void RenderContextImpl::FillEllipse(Point const& center, Vec2 const& radius) void RenderContextImpl::FillEllipse(const Point& center, const Vec2& radius)
{ {
KGE_ASSERT(render_target_ && "Render target has not been initialized!"); KGE_ASSERT(render_target_ && "Render target has not been initialized!");
KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!"); KGE_ASSERT(current_brush_ && "The brush used for rendering has not been set!");
@ -300,7 +300,7 @@ void RenderContextImpl::CreateTexture(Texture& texture, math::Vec2T<uint32_t> si
KGE_THROW_IF_FAILED(hr, "Create texture failed"); KGE_THROW_IF_FAILED(hr, "Create texture failed");
} }
void RenderContextImpl::PushClipRect(Rect const& clip_rect) void RenderContextImpl::PushClipRect(const Rect& clip_rect)
{ {
KGE_ASSERT(render_target_ && "Render target has not been initialized!"); KGE_ASSERT(render_target_ && "Render target has not been initialized!");
@ -360,7 +360,7 @@ void RenderContextImpl::Clear()
render_target_->Clear(); render_target_->Clear();
} }
void RenderContextImpl::Clear(Color const& clear_color) void RenderContextImpl::Clear(const Color& clear_color)
{ {
KGE_ASSERT(render_target_ && "Render target has not been initialized!"); KGE_ASSERT(render_target_ && "Render target has not been initialized!");
render_target_->Clear(DX::ConvertToColorF(clear_color)); render_target_->Clear(DX::ConvertToColorF(clear_color));
@ -445,7 +445,7 @@ void RenderContextImpl::SetTextAntialiasMode(TextAntialiasMode mode)
render_target_->SetTextAntialiasMode(antialias_mode); render_target_->SetTextAntialiasMode(antialias_mode);
} }
bool RenderContextImpl::CheckVisibility(Rect const& bounds, Matrix3x2 const& transform) bool RenderContextImpl::CheckVisibility(const Rect& bounds, const Matrix3x2& transform)
{ {
KGE_ASSERT(render_target_ && "Render target has not been initialized!"); KGE_ASSERT(render_target_ && "Render target has not been initialized!");
@ -456,7 +456,7 @@ bool RenderContextImpl::CheckVisibility(Rect const& bounds, Matrix3x2 const& tra
return visible_size_.Intersects(Matrix3x2(transform * global_transform_).Transform(bounds)); return visible_size_.Intersects(Matrix3x2(transform * global_transform_).Transform(bounds));
} }
void RenderContextImpl::Resize(Size const& size) void RenderContextImpl::Resize(const Size& size)
{ {
visible_size_ = Rect(Point(), size); visible_size_ = Rect(Point(), size);
} }

View File

@ -40,31 +40,31 @@ public:
void EndDraw() override; void EndDraw() override;
void DrawTexture(Texture const& texture, const Rect* src_rect, const Rect* dest_rect) override; void DrawTexture(const Texture& texture, const Rect* src_rect, const Rect* dest_rect) override;
void DrawTextLayout(TextLayout const& layout, Point const& offset) override; void DrawTextLayout(const TextLayout& layout, const Point& offset) override;
void DrawShape(Shape const& shape) override; void DrawShape(const Shape& shape) override;
void DrawLine(Point const& point1, Point const& point2) override; void DrawLine(const Point& point1, const Point& point2) override;
void DrawRectangle(Rect const& rect) override; void DrawRectangle(const Rect& rect) override;
void DrawRoundedRectangle(Rect const& rect, Vec2 const& radius) override; void DrawRoundedRectangle(const Rect& rect, const Vec2& radius) override;
void DrawEllipse(Point const& center, Vec2 const& radius) override; void DrawEllipse(const Point& center, const Vec2& radius) override;
void FillShape(Shape const& shape) override; void FillShape(const Shape& shape) override;
void FillRectangle(Rect const& rect) override; void FillRectangle(const Rect& rect) override;
void FillRoundedRectangle(Rect const& rect, Vec2 const& radius) override; void FillRoundedRectangle(const Rect& rect, const Vec2& radius) override;
void FillEllipse(Point const& center, Vec2 const& radius) override; void FillEllipse(const Point& center, const Vec2& radius) override;
void CreateTexture(Texture& texture, math::Vec2T<uint32_t> size) override; void CreateTexture(Texture& texture, math::Vec2T<uint32_t> size) override;
void PushClipRect(Rect const& clip_rect) override; void PushClipRect(const Rect& clip_rect) override;
void PopClipRect() override; void PopClipRect() override;
@ -74,7 +74,7 @@ public:
void Clear() override; void Clear() override;
void Clear(Color const& clear_color) override; void Clear(const Color& clear_color) override;
Size GetSize() const override; Size GetSize() const override;
@ -88,9 +88,9 @@ public:
void SetTextAntialiasMode(TextAntialiasMode mode) override; void SetTextAntialiasMode(TextAntialiasMode mode) override;
bool CheckVisibility(Rect const& bounds, Matrix3x2 const& transform) override; bool CheckVisibility(const Rect& bounds, const Matrix3x2& transform) override;
void Resize(Size const& size) override; void Resize(const Size& size) override;
protected: protected:
RenderContextImpl(); RenderContextImpl();

View File

@ -187,7 +187,7 @@ HRESULT RendererImpl::HandleDeviceLost()
return hr; return hr;
} }
void RendererImpl::CreateTexture(Texture& texture, String const& file_path) void RendererImpl::CreateTexture(Texture& texture, const String& file_path)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -243,7 +243,7 @@ void RendererImpl::CreateTexture(Texture& texture, String const& file_path)
} }
} }
void RendererImpl::CreateTexture(Texture& texture, Resource const& resource) void RendererImpl::CreateTexture(Texture& texture, const Resource& resource)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -298,7 +298,7 @@ void RendererImpl::CreateTexture(Texture& texture, Resource const& resource)
} }
} }
void RendererImpl::CreateGifImage(GifImage& gif, String const& file_path) void RendererImpl::CreateGifImage(GifImage& gif, const String& file_path)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -331,7 +331,7 @@ void RendererImpl::CreateGifImage(GifImage& gif, String const& file_path)
} }
} }
void RendererImpl::CreateGifImage(GifImage& gif, Resource const& resource) void RendererImpl::CreateGifImage(GifImage& gif, const Resource& resource)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -363,7 +363,7 @@ void RendererImpl::CreateGifImage(GifImage& gif, Resource const& resource)
} }
} }
void RendererImpl::CreateGifImageFrame(GifImage::Frame& frame, GifImage const& gif, size_t frame_index) void RendererImpl::CreateGifImageFrame(GifImage::Frame& frame, const GifImage& gif, size_t frame_index)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -527,7 +527,7 @@ void RendererImpl::CreateGifImageFrame(GifImage::Frame& frame, GifImage const& g
} }
} }
void RendererImpl::CreateFontCollection(Font& font, String const& file_path) void RendererImpl::CreateFontCollection(Font& font, const String& file_path)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -568,7 +568,7 @@ void RendererImpl::CreateFontCollection(Font& font, String const& file_path)
KGE_THROW_IF_FAILED(hr, "Create font collection failed"); KGE_THROW_IF_FAILED(hr, "Create font collection failed");
} }
void RendererImpl::CreateFontCollection(Font& font, Resource const& res) void RendererImpl::CreateFontCollection(Font& font, const Resource& res)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -643,7 +643,7 @@ void RendererImpl::CreateTextLayout(TextLayout& layout, const String& content, c
KGE_THROW_IF_FAILED(hr, "Create text layout failed"); KGE_THROW_IF_FAILED(hr, "Create text layout failed");
} }
void RendererImpl::CreateLineShape(Shape& shape, Point const& begin_pos, Point const& end_pos) void RendererImpl::CreateLineShape(Shape& shape, const Point& begin_pos, const Point& end_pos)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -679,7 +679,7 @@ void RendererImpl::CreateLineShape(Shape& shape, Point const& begin_pos, Point c
KGE_THROW_IF_FAILED(hr, "Create ID2D1PathGeometry failed"); KGE_THROW_IF_FAILED(hr, "Create ID2D1PathGeometry failed");
} }
void RendererImpl::CreateRectShape(Shape& shape, Rect const& rect) void RendererImpl::CreateRectShape(Shape& shape, const Rect& rect)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -701,7 +701,7 @@ void RendererImpl::CreateRectShape(Shape& shape, Rect const& rect)
KGE_THROW_IF_FAILED(hr, "Create ID2D1RectangleGeometry failed"); KGE_THROW_IF_FAILED(hr, "Create ID2D1RectangleGeometry failed");
} }
void RendererImpl::CreateRoundedRectShape(Shape& shape, Rect const& rect, Vec2 const& radius) void RendererImpl::CreateRoundedRectShape(Shape& shape, const Rect& rect, const Vec2& radius)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -724,7 +724,7 @@ void RendererImpl::CreateRoundedRectShape(Shape& shape, Rect const& rect, Vec2 c
KGE_THROW_IF_FAILED(hr, "Create ID2D1RoundedRectangleGeometry failed"); KGE_THROW_IF_FAILED(hr, "Create ID2D1RoundedRectangleGeometry failed");
} }
void RendererImpl::CreateEllipseShape(Shape& shape, Point const& center, Vec2 const& radius) void RendererImpl::CreateEllipseShape(Shape& shape, const Point& center, const Vec2& radius)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -772,7 +772,7 @@ void RendererImpl::CreateShapeSink(ShapeMaker& maker)
KGE_THROW_IF_FAILED(hr, "Create ID2D1PathGeometry failed"); KGE_THROW_IF_FAILED(hr, "Create ID2D1PathGeometry failed");
} }
void RendererImpl::CreateBrush(Brush& brush, Color const& color) void RendererImpl::CreateBrush(Brush& brush, const Color& color)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -806,7 +806,7 @@ void RendererImpl::CreateBrush(Brush& brush, Color const& color)
KGE_THROW_IF_FAILED(hr, "Create ID2D1SolidBrush failed"); KGE_THROW_IF_FAILED(hr, "Create ID2D1SolidBrush failed");
} }
void RendererImpl::CreateBrush(Brush& brush, LinearGradientStyle const& style) void RendererImpl::CreateBrush(Brush& brush, const LinearGradientStyle& style)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -838,7 +838,7 @@ void RendererImpl::CreateBrush(Brush& brush, LinearGradientStyle const& style)
KGE_THROW_IF_FAILED(hr, "Create ID2D1LinearGradientBrush failed"); KGE_THROW_IF_FAILED(hr, "Create ID2D1LinearGradientBrush failed");
} }
void RendererImpl::CreateBrush(Brush& brush, RadialGradientStyle const& style) void RendererImpl::CreateBrush(Brush& brush, const RadialGradientStyle& style)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)

View File

@ -44,37 +44,37 @@ class KGE_API RendererImpl
public: public:
static RendererImpl& GetInstance(); static RendererImpl& GetInstance();
void CreateTexture(Texture& texture, String const& file_path) override; void CreateTexture(Texture& texture, const String& file_path) override;
void CreateTexture(Texture& texture, Resource const& resource) override; void CreateTexture(Texture& texture, const Resource& resource) override;
void CreateGifImage(GifImage& gif, String const& file_path) override; void CreateGifImage(GifImage& gif, const String& file_path) override;
void CreateGifImage(GifImage& gif, Resource const& resource) override; void CreateGifImage(GifImage& gif, const Resource& resource) override;
void CreateGifImageFrame(GifImage::Frame& frame, GifImage const& gif, size_t frame_index) override; void CreateGifImageFrame(GifImage::Frame& frame, const GifImage& gif, size_t frame_index) override;
void CreateFontCollection(Font& font, String const& file_path) override; void CreateFontCollection(Font& font, const String& file_path) override;
void CreateFontCollection(Font& font, Resource const& res) override; void CreateFontCollection(Font& font, const Resource& res) override;
void CreateTextLayout(TextLayout& layout, const String& content, const TextStyle& style) override; void CreateTextLayout(TextLayout& layout, const String& content, const TextStyle& style) override;
void CreateLineShape(Shape& shape, Point const& begin_pos, Point const& end_pos) override; void CreateLineShape(Shape& shape, const Point& begin_pos, const Point& end_pos) override;
void CreateRectShape(Shape& shape, Rect const& rect) override; void CreateRectShape(Shape& shape, const Rect& rect) override;
void CreateRoundedRectShape(Shape& shape, Rect const& rect, Vec2 const& radius) override; void CreateRoundedRectShape(Shape& shape, const Rect& rect, const Vec2& radius) override;
void CreateEllipseShape(Shape& shape, Point const& center, Vec2 const& radius) override; void CreateEllipseShape(Shape& shape, const Point& center, const Vec2& radius) override;
void CreateShapeSink(ShapeMaker& maker) override; void CreateShapeSink(ShapeMaker& maker) override;
void CreateBrush(Brush& brush, Color const& color) override; void CreateBrush(Brush& brush, const Color& color) override;
void CreateBrush(Brush& brush, LinearGradientStyle const& style) override; void CreateBrush(Brush& brush, const LinearGradientStyle& style) override;
void CreateBrush(Brush& brush, RadialGradientStyle const& style) override; void CreateBrush(Brush& brush, const RadialGradientStyle& style) override;
void CreateBrush(Brush& brush, TexturePtr texture) override; void CreateBrush(Brush& brush, TexturePtr texture) override;

View File

@ -53,9 +53,9 @@ inline T* SafeAcquire(T* ptr)
// Point2F // Point2F
// //
inline D2D1_POINT_2F const& ConvertToPoint2F(Vec2 const& vec2) inline const D2D1_POINT_2F& ConvertToPoint2F(const Vec2& vec2)
{ {
return reinterpret_cast<D2D1_POINT_2F const&>(vec2); return reinterpret_cast<const D2D1_POINT_2F&>(vec2);
} }
inline D2D1_POINT_2F& ConvertToPoint2F(Vec2& vec2) inline D2D1_POINT_2F& ConvertToPoint2F(Vec2& vec2)
@ -77,9 +77,9 @@ inline D2D1_POINT_2F* ConvertToPoint2F(Vec2* vec2)
// SizeF // SizeF
// //
inline D2D1_SIZE_F const& ConvertToSizeF(Vec2 const& vec2) inline const D2D1_SIZE_F& ConvertToSizeF(const Vec2& vec2)
{ {
return reinterpret_cast<D2D1_SIZE_F const&>(vec2); return reinterpret_cast<const D2D1_SIZE_F&>(vec2);
} }
inline D2D1_SIZE_F& ConvertToSizeF(Vec2& vec2) inline D2D1_SIZE_F& ConvertToSizeF(Vec2& vec2)
@ -101,9 +101,9 @@ inline D2D1_SIZE_F* ConvertToSizeF(Vec2* vec2)
// RectF // RectF
// //
inline D2D1_RECT_F const& ConvertToRectF(Rect const& rect) inline const D2D1_RECT_F& ConvertToRectF(const Rect& rect)
{ {
return reinterpret_cast<D2D1_RECT_F const&>(rect); return reinterpret_cast<const D2D1_RECT_F&>(rect);
} }
inline D2D1_RECT_F& ConvertToRectF(Rect& rect) inline D2D1_RECT_F& ConvertToRectF(Rect& rect)
@ -124,9 +124,9 @@ inline D2D1_RECT_F* ConvertToRectF(Rect* rect)
// //
// ColorF // ColorF
// //
inline D2D1_COLOR_F const& ConvertToColorF(Color const& color) inline const D2D1_COLOR_F& ConvertToColorF(const Color& color)
{ {
return reinterpret_cast<D2D1_COLOR_F const&>(color); return reinterpret_cast<const D2D1_COLOR_F&>(color);
} }
inline D2D1_COLOR_F& ConvertToColorF(Color& color) inline D2D1_COLOR_F& ConvertToColorF(Color& color)
@ -148,9 +148,9 @@ inline D2D1_COLOR_F* ConvertToColorF(Color* color)
// MatrixF // MatrixF
// //
inline D2D1_MATRIX_3X2_F const& ConvertToMatrix3x2F(Matrix3x2 const& matrix) inline const D2D1_MATRIX_3X2_F& ConvertToMatrix3x2F(const Matrix3x2& matrix)
{ {
return reinterpret_cast<D2D1_MATRIX_3X2_F const&>(matrix); return reinterpret_cast<const D2D1_MATRIX_3X2_F&>(matrix);
} }
inline D2D1_MATRIX_3X2_F& ConvertToMatrix3x2F(Matrix3x2& matrix) inline D2D1_MATRIX_3X2_F& ConvertToMatrix3x2F(Matrix3x2& matrix)

View File

@ -24,7 +24,7 @@
namespace kiwano namespace kiwano
{ {
FontPtr Font::Create(String const& file) FontPtr Font::Create(const String& file)
{ {
FontPtr ptr = new (std::nothrow) Font; FontPtr ptr = new (std::nothrow) Font;
if (ptr) if (ptr)
@ -35,7 +35,7 @@ FontPtr Font::Create(String const& file)
return ptr; return ptr;
} }
FontPtr Font::Create(Resource const& resource) FontPtr Font::Create(const Resource& resource)
{ {
FontPtr ptr = new (std::nothrow) Font; FontPtr ptr = new (std::nothrow) Font;
if (ptr) if (ptr)
@ -48,7 +48,7 @@ FontPtr Font::Create(Resource const& resource)
Font::Font() {} Font::Font() {}
bool Font::Load(String const& file) bool Font::Load(const String& file)
{ {
try try
{ {
@ -61,7 +61,7 @@ bool Font::Load(String const& file)
return true; return true;
} }
bool Font::Load(Resource const& resource) bool Font::Load(const Resource& resource)
{ {
try try
{ {

View File

@ -44,21 +44,21 @@ class Font : public NativeObject
public: public:
/// \~chinese /// \~chinese
/// @brief 创建字体 /// @brief 创建字体
static FontPtr Create(String const& file); static FontPtr Create(const String& file);
/// \~chinese /// \~chinese
/// @brief 创建字体 /// @brief 创建字体
static FontPtr Create(Resource const& resource); static FontPtr Create(const Resource& resource);
Font(); Font();
/// \~chinese /// \~chinese
/// @brief 加载字体文件 /// @brief 加载字体文件
bool Load(String const& file); bool Load(const String& file);
/// \~chinese /// \~chinese
/// @brief 加载字体资源 /// @brief 加载字体资源
bool Load(Resource const& resource); bool Load(const Resource& resource);
}; };
/** @} */ /** @} */

View File

@ -25,7 +25,7 @@
namespace kiwano namespace kiwano
{ {
GifImagePtr GifImage::Create(String const& file_path) GifImagePtr GifImage::Create(const String& file_path)
{ {
GifImagePtr ptr = new (std::nothrow) GifImage; GifImagePtr ptr = new (std::nothrow) GifImage;
if (ptr) if (ptr)
@ -36,7 +36,7 @@ GifImagePtr GifImage::Create(String const& file_path)
return ptr; return ptr;
} }
GifImagePtr GifImage::Create(Resource const& res) GifImagePtr GifImage::Create(const Resource& res)
{ {
GifImagePtr ptr = new (std::nothrow) GifImage; GifImagePtr ptr = new (std::nothrow) GifImage;
if (ptr) if (ptr)
@ -52,7 +52,7 @@ GifImage::GifImage()
{ {
} }
bool GifImage::Load(String const& file_path) bool GifImage::Load(const String& file_path)
{ {
Renderer::GetInstance().CreateGifImage(*this, file_path); Renderer::GetInstance().CreateGifImage(*this, file_path);
@ -67,7 +67,7 @@ bool GifImage::Load(String const& file_path)
return false; return false;
} }
bool GifImage::Load(Resource const& res) bool GifImage::Load(const Resource& res)
{ {
Renderer::GetInstance().CreateGifImage(*this, res); Renderer::GetInstance().CreateGifImage(*this, res);

View File

@ -40,21 +40,21 @@ class KGE_API GifImage : public NativeObject
public: public:
/// \~chinese /// \~chinese
/// @brief 创建GIF图片 /// @brief 创建GIF图片
static GifImagePtr Create(String const& file_path); static GifImagePtr Create(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 创建GIF图片 /// @brief 创建GIF图片
static GifImagePtr Create(Resource const& res); static GifImagePtr Create(const Resource& res);
GifImage(); GifImage();
/// \~chinese /// \~chinese
/// @brief 加载本地GIF图片 /// @brief 加载本地GIF图片
bool Load(String const& file_path); bool Load(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 加载GIF资源 /// @brief 加载GIF资源
bool Load(Resource const& res); bool Load(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 获取像素宽度 /// @brief 获取像素宽度

View File

@ -42,7 +42,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取图层裁剪区域 /// @brief 获取图层裁剪区域
Rect const& GetClipRect() const; const Rect& GetClipRect() const;
/// \~chinese /// \~chinese
/// @brief 获取图层透明度 /// @brief 获取图层透明度
@ -54,11 +54,11 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取几何蒙层变换 /// @brief 获取几何蒙层变换
Matrix3x2 const& GetMaskTransform() const; const Matrix3x2& GetMaskTransform() const;
/// \~chinese /// \~chinese
/// @brief 设置图层裁剪区域 /// @brief 设置图层裁剪区域
void SetClipRect(Rect const& rect); void SetClipRect(const Rect& rect);
/// \~chinese /// \~chinese
/// @brief 设置图层透明度 /// @brief 设置图层透明度
@ -70,7 +70,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置几何蒙层变换 /// @brief 设置几何蒙层变换
void SetMaskTransform(Matrix3x2 const& matrix); void SetMaskTransform(const Matrix3x2& matrix);
private: private:
Rect clip_rect_; Rect clip_rect_;
@ -81,7 +81,7 @@ private:
/** @} */ /** @} */
inline Rect const& Layer::GetClipRect() const inline const Rect& Layer::GetClipRect() const
{ {
return clip_rect_; return clip_rect_;
} }
@ -96,12 +96,12 @@ inline ShapePtr Layer::GetMaskShape() const
return mask_; return mask_;
} }
inline Matrix3x2 const& Layer::GetMaskTransform() const inline const Matrix3x2& Layer::GetMaskTransform() const
{ {
return mask_transform_; return mask_transform_;
} }
inline void Layer::SetClipRect(Rect const& rect) inline void Layer::SetClipRect(const Rect& rect)
{ {
clip_rect_ = rect; clip_rect_ = rect;
} }
@ -116,7 +116,7 @@ inline void Layer::SetMaskShape(ShapePtr mask)
mask_ = mask; mask_ = mask;
} }
inline void Layer::SetMaskTransform(Matrix3x2 const& matrix) inline void Layer::SetMaskTransform(const Matrix3x2& matrix)
{ {
mask_transform_ = matrix; mask_transform_ = matrix;
} }

View File

@ -74,64 +74,64 @@ public:
/// @param texture 纹理 /// @param texture 纹理
/// @param src_rect 源纹理裁剪矩形 /// @param src_rect 源纹理裁剪矩形
/// @param dest_rect 绘制的目标区域 /// @param dest_rect 绘制的目标区域
virtual void DrawTexture(Texture const& texture, const Rect* src_rect = nullptr, virtual void DrawTexture(const Texture& texture, const Rect* src_rect = nullptr,
const Rect* dest_rect = nullptr) = 0; const Rect* dest_rect = nullptr) = 0;
/// \~chinese /// \~chinese
/// @brief 绘制文本布局 /// @brief 绘制文本布局
/// @param layout 文本布局 /// @param layout 文本布局
/// @param offset 偏移量 /// @param offset 偏移量
virtual void DrawTextLayout(TextLayout const& layout, Point const& offset = Point()) = 0; virtual void DrawTextLayout(const TextLayout& layout, const Point& offset = Point()) = 0;
/// \~chinese /// \~chinese
/// @brief 绘制形状轮廓 /// @brief 绘制形状轮廓
/// @param shape 形状 /// @param shape 形状
virtual void DrawShape(Shape const& shape) = 0; virtual void DrawShape(const Shape& shape) = 0;
/// \~chinese /// \~chinese
/// @brief 绘制线段 /// @brief 绘制线段
/// @param point1 线段起点 /// @param point1 线段起点
/// @param point2 线段终点 /// @param point2 线段终点
virtual void DrawLine(Point const& point1, Point const& point2) = 0; virtual void DrawLine(const Point& point1, const Point& point2) = 0;
/// \~chinese /// \~chinese
/// @brief 绘制矩形边框 /// @brief 绘制矩形边框
/// @param rect 矩形 /// @param rect 矩形
virtual void DrawRectangle(Rect const& rect) = 0; virtual void DrawRectangle(const Rect& rect) = 0;
/// \~chinese /// \~chinese
/// @brief 绘制圆角矩形边框 /// @brief 绘制圆角矩形边框
/// @param rect 矩形 /// @param rect 矩形
/// @param radius 圆角半径 /// @param radius 圆角半径
virtual void DrawRoundedRectangle(Rect const& rect, Vec2 const& radius) = 0; virtual void DrawRoundedRectangle(const Rect& rect, const Vec2& radius) = 0;
/// \~chinese /// \~chinese
/// @brief 绘制椭圆边框 /// @brief 绘制椭圆边框
/// @param center 圆心 /// @param center 圆心
/// @param radius 椭圆半径 /// @param radius 椭圆半径
virtual void DrawEllipse(Point const& center, Vec2 const& radius) = 0; virtual void DrawEllipse(const Point& center, const Vec2& radius) = 0;
/// \~chinese /// \~chinese
/// @brief 填充形状 /// @brief 填充形状
/// @param shape 形状 /// @param shape 形状
virtual void FillShape(Shape const& shape) = 0; virtual void FillShape(const Shape& shape) = 0;
/// \~chinese /// \~chinese
/// @brief 填充矩形 /// @brief 填充矩形
/// @param rect 矩形 /// @param rect 矩形
virtual void FillRectangle(Rect const& rect) = 0; virtual void FillRectangle(const Rect& rect) = 0;
/// \~chinese /// \~chinese
/// @brief 填充圆角矩形 /// @brief 填充圆角矩形
/// @param rect 矩形 /// @param rect 矩形
/// @param radius 圆角半径 /// @param radius 圆角半径
virtual void FillRoundedRectangle(Rect const& rect, Vec2 const& radius) = 0; virtual void FillRoundedRectangle(const Rect& rect, const Vec2& radius) = 0;
/// \~chinese /// \~chinese
/// @brief 填充椭圆 /// @brief 填充椭圆
/// @param center 圆心 /// @param center 圆心
/// @param radius 椭圆半径 /// @param radius 椭圆半径
virtual void FillEllipse(Point const& center, Vec2 const& radius) = 0; virtual void FillEllipse(const Point& center, const Vec2& radius) = 0;
/// \~chinese /// \~chinese
/// @brief 创建纹理 /// @brief 创建纹理
@ -142,7 +142,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置绘制的裁剪区域 /// @brief 设置绘制的裁剪区域
/// @param clip_rect 裁剪矩形 /// @param clip_rect 裁剪矩形
virtual void PushClipRect(Rect const& clip_rect) = 0; virtual void PushClipRect(const Rect& clip_rect) = 0;
/// \~chinese /// \~chinese
/// @brief 取消上一次设置的绘制裁剪区域 /// @brief 取消上一次设置的绘制裁剪区域
@ -164,7 +164,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 使用纯色清空渲染内容 /// @brief 使用纯色清空渲染内容
/// @param clear_color 清屏颜色 /// @param clear_color 清屏颜色
virtual void Clear(Color const& clear_color) = 0; virtual void Clear(const Color& clear_color) = 0;
/// \~chinese /// \~chinese
/// @brief 获取渲染区域大小 /// @brief 获取渲染区域大小
@ -204,11 +204,11 @@ public:
/// \~chinese /// \~chinese
/// @brief 检查边界是否在视区内 /// @brief 检查边界是否在视区内
virtual bool CheckVisibility(Rect const& bounds, Matrix3x2 const& transform) = 0; virtual bool CheckVisibility(const Rect& bounds, const Matrix3x2& transform) = 0;
/// \~chinese /// \~chinese
/// @brief 重设渲染上下文大小 /// @brief 重设渲染上下文大小
virtual void Resize(Size const& size) = 0; virtual void Resize(const Size& size) = 0;
/// \~chinese /// \~chinese
/// @brief 设置上下文的二维变换 /// @brief 设置上下文的二维变换
@ -240,7 +240,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取渲染上下文状态 /// @brief 获取渲染上下文状态
Status const& GetStatus() const; const Status& GetStatus() const;
protected: protected:
RenderContext(); RenderContext();
@ -269,7 +269,7 @@ inline RenderContext::Status::Status()
{ {
} }
inline RenderContext::Status const& RenderContext::GetStatus() const inline const RenderContext::Status& RenderContext::GetStatus() const
{ {
return status_; return status_;
} }

View File

@ -57,7 +57,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 设置清屏颜色 /// @brief 设置清屏颜色
virtual void SetClearColor(Color const& clear_color); virtual void SetClearColor(const Color& clear_color);
/// \~chinese /// \~chinese
/// @brief 开启或关闭垂直同步 /// @brief 开启或关闭垂直同步
@ -68,28 +68,28 @@ public:
/// @param[out] texture 纹理 /// @param[out] texture 纹理
/// @param[in] file_path 图片路径 /// @param[in] file_path 图片路径
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateTexture(Texture& texture, String const& file_path) = 0; virtual void CreateTexture(Texture& texture, const String& file_path) = 0;
/// \~chinese /// \~chinese
/// @brief 创建纹理内部资源 /// @brief 创建纹理内部资源
/// @param[out] texture 纹理 /// @param[out] texture 纹理
/// @param[in] resource 图片资源 /// @param[in] resource 图片资源
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateTexture(Texture& texture, Resource const& resource) = 0; virtual void CreateTexture(Texture& texture, const Resource& resource) = 0;
/// \~chinese /// \~chinese
/// @brief 创建GIF图像内部资源 /// @brief 创建GIF图像内部资源
/// @param[out] gif GIF图像 /// @param[out] gif GIF图像
/// @param[in] file_path 图片路径 /// @param[in] file_path 图片路径
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateGifImage(GifImage& gif, String const& file_path) = 0; virtual void CreateGifImage(GifImage& gif, const String& file_path) = 0;
/// \~chinese /// \~chinese
/// @brief 创建GIF图像内部资源 /// @brief 创建GIF图像内部资源
/// @param[out] gif GIF图像 /// @param[out] gif GIF图像
/// @param[in] resource 图片资源 /// @param[in] resource 图片资源
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateGifImage(GifImage& gif, Resource const& resource) = 0; virtual void CreateGifImage(GifImage& gif, const Resource& resource) = 0;
/// \~chinese /// \~chinese
/// @brief 创建GIF图像帧内部资源 /// @brief 创建GIF图像帧内部资源
@ -97,21 +97,21 @@ public:
/// @param[in] gif GIF图像 /// @param[in] gif GIF图像
/// @param[in] frame_index 帧下标 /// @param[in] frame_index 帧下标
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateGifImageFrame(GifImage::Frame& frame, GifImage const& gif, size_t frame_index) = 0; virtual void CreateGifImageFrame(GifImage::Frame& frame, const GifImage& gif, size_t frame_index) = 0;
/// \~chinese /// \~chinese
/// @brief 创建字体集内部资源 /// @brief 创建字体集内部资源
/// @param[out] font 字体 /// @param[out] font 字体
/// @param[in] file_paths 字体文件路径 /// @param[in] file_paths 字体文件路径
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateFontCollection(Font& font, String const& file_path) = 0; virtual void CreateFontCollection(Font& font, const String& file_path) = 0;
/// \~chinese /// \~chinese
/// @brief 创建字体集内部资源 /// @brief 创建字体集内部资源
/// @param[out] font 字体 /// @param[out] font 字体
/// @param[in] res_arr 字体资源 /// @param[in] res_arr 字体资源
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateFontCollection(Font& font, Resource const& res) = 0; virtual void CreateFontCollection(Font& font, const Resource& res) = 0;
/// \~chinese /// \~chinese
/// @brief 创建文字布局内部资源 /// @brief 创建文字布局内部资源
@ -127,14 +127,14 @@ public:
/// @param[in] begin_pos 线段起点 /// @param[in] begin_pos 线段起点
/// @param[in] end_pos 线段终点 /// @param[in] end_pos 线段终点
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateLineShape(Shape& shape, Point const& begin_pos, Point const& end_pos) = 0; virtual void CreateLineShape(Shape& shape, const Point& begin_pos, const Point& end_pos) = 0;
/// \~chinese /// \~chinese
/// @brief 创建矩形形状内部资源 /// @brief 创建矩形形状内部资源
/// @param[out] shape 形状 /// @param[out] shape 形状
/// @param[in] rect 矩形大小 /// @param[in] rect 矩形大小
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateRectShape(Shape& shape, Rect const& rect) = 0; virtual void CreateRectShape(Shape& shape, const Rect& rect) = 0;
/// \~chinese /// \~chinese
/// @brief 创建圆角矩形形状内部资源 /// @brief 创建圆角矩形形状内部资源
@ -142,7 +142,7 @@ public:
/// @param[in] rect 矩形大小 /// @param[in] rect 矩形大小
/// @param[in] radius 圆角半径 /// @param[in] radius 圆角半径
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateRoundedRectShape(Shape& shape, Rect const& rect, Vec2 const& radius) = 0; virtual void CreateRoundedRectShape(Shape& shape, const Rect& rect, const Vec2& radius) = 0;
/// \~chinese /// \~chinese
/// @brief 创建椭圆形状内部资源 /// @brief 创建椭圆形状内部资源
@ -150,7 +150,7 @@ public:
/// @param[in] center 椭圆圆心 /// @param[in] center 椭圆圆心
/// @param[in] radius 椭圆半径 /// @param[in] radius 椭圆半径
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateEllipseShape(Shape& shape, Point const& center, Vec2 const& radius) = 0; virtual void CreateEllipseShape(Shape& shape, const Point& center, const Vec2& radius) = 0;
/// \~chinese /// \~chinese
/// @brief 创建几何图形生成器内部资源 /// @brief 创建几何图形生成器内部资源
@ -163,21 +163,21 @@ public:
/// @param[out] brush 画刷 /// @param[out] brush 画刷
/// @param[in] color 颜色 /// @param[in] color 颜色
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateBrush(Brush& brush, Color const& color) = 0; virtual void CreateBrush(Brush& brush, const Color& color) = 0;
/// \~chinese /// \~chinese
/// @brief 创建线性渐变画刷内部资源 /// @brief 创建线性渐变画刷内部资源
/// @param[out] brush 画刷 /// @param[out] brush 画刷
/// @param[in] style 线性渐变样式 /// @param[in] style 线性渐变样式
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateBrush(Brush& brush, LinearGradientStyle const& style) = 0; virtual void CreateBrush(Brush& brush, const LinearGradientStyle& style) = 0;
/// \~chinese /// \~chinese
/// @brief 创建径向渐变画刷内部资源 /// @brief 创建径向渐变画刷内部资源
/// @param[out] brush 画刷 /// @param[out] brush 画刷
/// @param[in] style 径向渐变样式 /// @param[in] style 径向渐变样式
/// @throw kiwano::SystemError 创建失败时抛出 /// @throw kiwano::SystemError 创建失败时抛出
virtual void CreateBrush(Brush& brush, RadialGradientStyle const& style) = 0; virtual void CreateBrush(Brush& brush, const RadialGradientStyle& style) = 0;
/// \~chinese /// \~chinese
/// @brief 创建纹理画刷内部资源 /// @brief 创建纹理画刷内部资源

View File

@ -52,7 +52,7 @@ Rect Shape::GetBoundingBox() const
#endif #endif
} }
Rect Shape::GetBoundingBox(Matrix3x2 const& transform) const Rect Shape::GetBoundingBox(const Matrix3x2& transform) const
{ {
#if KGE_RENDER_ENGINE == KGE_RENDER_ENGINE_DIRECTX #if KGE_RENDER_ENGINE == KGE_RENDER_ENGINE_DIRECTX
Rect bounds; Rect bounds;
@ -117,7 +117,7 @@ float Shape::ComputeArea() const
#endif #endif
} }
bool Shape::ContainsPoint(Point const& point, const Matrix3x2* transform) const bool Shape::ContainsPoint(const Point& point, const Matrix3x2* transform) const
{ {
#if KGE_RENDER_ENGINE == KGE_RENDER_ENGINE_DIRECTX #if KGE_RENDER_ENGINE == KGE_RENDER_ENGINE_DIRECTX
auto geometry = NativePtr::Get<ID2D1Geometry>(this); auto geometry = NativePtr::Get<ID2D1Geometry>(this);
@ -134,35 +134,35 @@ bool Shape::ContainsPoint(Point const& point, const Matrix3x2* transform) const
#endif #endif
} }
ShapePtr Shape::CreateLine(Point const& begin, Point const& end) ShapePtr Shape::CreateLine(const Point& begin, const Point& end)
{ {
ShapePtr output = new Shape; ShapePtr output = new Shape;
Renderer::GetInstance().CreateLineShape(*output, begin, end); Renderer::GetInstance().CreateLineShape(*output, begin, end);
return output; return output;
} }
ShapePtr Shape::CreateRect(Rect const& rect) ShapePtr Shape::CreateRect(const Rect& rect)
{ {
ShapePtr output = new Shape; ShapePtr output = new Shape;
Renderer::GetInstance().CreateRectShape(*output, rect); Renderer::GetInstance().CreateRectShape(*output, rect);
return output; return output;
} }
ShapePtr Shape::CreateRoundedRect(Rect const& rect, Vec2 const& radius) ShapePtr Shape::CreateRoundedRect(const Rect& rect, const Vec2& radius)
{ {
ShapePtr output = new Shape; ShapePtr output = new Shape;
Renderer::GetInstance().CreateRoundedRectShape(*output, rect, radius); Renderer::GetInstance().CreateRoundedRectShape(*output, rect, radius);
return output; return output;
} }
ShapePtr Shape::CreateCircle(Point const& center, float radius) ShapePtr Shape::CreateCircle(const Point& center, float radius)
{ {
ShapePtr output = new Shape; ShapePtr output = new Shape;
Renderer::GetInstance().CreateEllipseShape(*output, center, Vec2{ radius, radius }); Renderer::GetInstance().CreateEllipseShape(*output, center, Vec2{ radius, radius });
return output; return output;
} }
ShapePtr Shape::CreateEllipse(Point const& center, Vec2 const& radius) ShapePtr Shape::CreateEllipse(const Point& center, const Vec2& radius)
{ {
ShapePtr output = new Shape; ShapePtr output = new Shape;
Renderer::GetInstance().CreateEllipseShape(*output, center, radius); Renderer::GetInstance().CreateEllipseShape(*output, center, radius);

View File

@ -45,30 +45,30 @@ public:
/// @brief 创建线段形状 /// @brief 创建线段形状
/// @param begin 线段起点 /// @param begin 线段起点
/// @param end 线段终点 /// @param end 线段终点
static ShapePtr CreateLine(Point const& begin, Point const& end); static ShapePtr CreateLine(const Point& begin, const Point& end);
/// \~chinese /// \~chinese
/// @brief 创建矩形 /// @brief 创建矩形
/// @param rect 矩形 /// @param rect 矩形
static ShapePtr CreateRect(Rect const& rect); static ShapePtr CreateRect(const Rect& rect);
/// \~chinese /// \~chinese
/// @brief 创建圆角矩形 /// @brief 创建圆角矩形
/// @param rect 矩形 /// @param rect 矩形
/// @param radius 矩形圆角半径 /// @param radius 矩形圆角半径
static ShapePtr CreateRoundedRect(Rect const& rect, Vec2 const& radius); static ShapePtr CreateRoundedRect(const Rect& rect, const Vec2& radius);
/// \~chinese /// \~chinese
/// @brief 创建圆形 /// @brief 创建圆形
/// @param center 圆形原点 /// @param center 圆形原点
/// @param radius 圆形半径 /// @param radius 圆形半径
static ShapePtr CreateCircle(Point const& center, float radius); static ShapePtr CreateCircle(const Point& center, float radius);
/// \~chinese /// \~chinese
/// @brief 创建椭圆形 /// @brief 创建椭圆形
/// @param center 椭圆原点 /// @param center 椭圆原点
/// @param radius 椭圆半径 /// @param radius 椭圆半径
static ShapePtr CreateEllipse(Point const& center, Vec2 const& radius); static ShapePtr CreateEllipse(const Point& center, const Vec2& radius);
Shape(); Shape();
@ -79,13 +79,13 @@ public:
/// \~chinese /// \~chinese
/// @brief 获取外切包围盒 /// @brief 获取外切包围盒
/// @param transform 二维变换 /// @param transform 二维变换
Rect GetBoundingBox(Matrix3x2 const& transform) const; Rect GetBoundingBox(const Matrix3x2& transform) const;
/// \~chinese /// \~chinese
/// @brief 判断图形是否包含点 /// @brief 判断图形是否包含点
/// @param point 点 /// @param point 点
/// @param transform 应用到点上的二维变换 /// @param transform 应用到点上的二维变换
bool ContainsPoint(Point const& point, const Matrix3x2* transform = nullptr) const; bool ContainsPoint(const Point& point, const Matrix3x2* transform = nullptr) const;
/// \~chinese /// \~chinese
/// @brief 获取图形展开成一条直线的长度 /// @brief 获取图形展开成一条直线的长度

View File

@ -57,7 +57,7 @@ bool ShapeMaker::IsStreamOpened() const
return IsValid(); return IsValid();
} }
void ShapeMaker::BeginPath(Point const& begin_pos) void ShapeMaker::BeginPath(const Point& begin_pos)
{ {
if (!IsStreamOpened()) if (!IsStreamOpened())
{ {
@ -86,7 +86,7 @@ void ShapeMaker::EndPath(bool closed)
this->CloseStream(); this->CloseStream();
} }
void ShapeMaker::AddLine(Point const& point) void ShapeMaker::AddLine(const Point& point)
{ {
KGE_ASSERT(IsStreamOpened()); KGE_ASSERT(IsStreamOpened());
@ -98,7 +98,7 @@ void ShapeMaker::AddLine(Point const& point)
#endif #endif
} }
void ShapeMaker::AddLines(Vector<Point> const& points) void ShapeMaker::AddLines(const Vector<Point>& points)
{ {
KGE_ASSERT(IsStreamOpened()); KGE_ASSERT(IsStreamOpened());
@ -122,7 +122,7 @@ void kiwano::ShapeMaker::AddLines(const Point* points, size_t count)
#endif #endif
} }
void ShapeMaker::AddBezier(Point const& point1, Point const& point2, Point const& point3) void ShapeMaker::AddBezier(const Point& point1, const Point& point2, const Point& point3)
{ {
KGE_ASSERT(IsStreamOpened()); KGE_ASSERT(IsStreamOpened());
@ -135,7 +135,7 @@ void ShapeMaker::AddBezier(Point const& point1, Point const& point2, Point const
#endif #endif
} }
void ShapeMaker::AddArc(Point const& point, Size const& radius, float rotation, bool clockwise, bool is_small) void ShapeMaker::AddArc(const Point& point, const Size& radius, float rotation, bool clockwise, bool is_small)
{ {
KGE_ASSERT(IsStreamOpened()); KGE_ASSERT(IsStreamOpened());

View File

@ -65,7 +65,7 @@ public:
/// \~chinese /// \~chinese
/// @brief 开始添加路径并打开输入流 /// @brief 开始添加路径并打开输入流
/// @param begin_pos 路径起始点 /// @param begin_pos 路径起始点
void BeginPath(Point const& begin_pos = Point()); void BeginPath(const Point& begin_pos = Point());
/// \~chinese /// \~chinese
/// @brief 结束路径并关闭输入流 /// @brief 结束路径并关闭输入流
@ -75,12 +75,12 @@ public:
/// \~chinese /// \~chinese
/// @brief 添加一条线段 /// @brief 添加一条线段
/// @param point 端点 /// @param point 端点
void AddLine(Point const& point); void AddLine(const Point& point);
/// \~chinese /// \~chinese
/// @brief 添加多条线段 /// @brief 添加多条线段
/// @param points 端点集合 /// @param points 端点集合
void AddLines(Vector<Point> const& points); void AddLines(const Vector<Point>& points);
/// \~chinese /// \~chinese
/// @brief 添加多条线段 /// @brief 添加多条线段
@ -93,7 +93,7 @@ public:
/// @param point1 贝塞尔曲线的第一个控制点 /// @param point1 贝塞尔曲线的第一个控制点
/// @param point2 贝塞尔曲线的第二个控制点 /// @param point2 贝塞尔曲线的第二个控制点
/// @param point3 贝塞尔曲线的终点 /// @param point3 贝塞尔曲线的终点
void AddBezier(Point const& point1, Point const& point2, Point const& point3); void AddBezier(const Point& point1, const Point& point2, const Point& point3);
/// \~chinese /// \~chinese
/// @brief 添加弧线 /// @brief 添加弧线
@ -102,7 +102,7 @@ public:
/// @param rotation 椭圆旋转角度 /// @param rotation 椭圆旋转角度
/// @param clockwise 顺时针 or 逆时针 /// @param clockwise 顺时针 or 逆时针
/// @param is_small 是否取小于 180° 的弧 /// @param is_small 是否取小于 180° 的弧
void AddArc(Point const& point, Size const& radius, float rotation, bool clockwise = true, bool is_small = true); void AddArc(const Point& point, const Size& radius, float rotation, bool clockwise = true, bool is_small = true);
/// \~chinese /// \~chinese
/// @brief 合并形状 /// @brief 合并形状

View File

@ -115,7 +115,7 @@ void TextLayout::SetFont(FontPtr font, TextRange range)
SetDirtyFlag(DirtyFlag::Dirty); SetDirtyFlag(DirtyFlag::Dirty);
} }
void TextLayout::SetFontFamily(String const& family, TextRange range) void TextLayout::SetFontFamily(const String& family, TextRange range)
{ {
KGE_ASSERT(content_.size() >= (range.start + range.length)); KGE_ASSERT(content_.size() >= (range.start + range.length));
if (range.length == 0) if (range.length == 0)

View File

@ -117,7 +117,7 @@ public:
/// @brief 设置字体族 /// @brief 设置字体族
/// @param family 字体族 /// @param family 字体族
/// @param range 文字范围 /// @param range 文字范围
void SetFontFamily(String const& family, TextRange range); void SetFontFamily(const String& family, TextRange range);
/// \~chinese /// \~chinese
/// @brief 设置字号(默认值为 18 /// @brief 设置字号(默认值为 18

View File

@ -30,7 +30,7 @@ namespace kiwano
InterpolationMode Texture::default_interpolation_mode_ = InterpolationMode::Linear; InterpolationMode Texture::default_interpolation_mode_ = InterpolationMode::Linear;
TexturePtr Texture::Create(String const& file_path) TexturePtr Texture::Create(const String& file_path)
{ {
TexturePtr ptr = new (std::nothrow) Texture; TexturePtr ptr = new (std::nothrow) Texture;
if (ptr) if (ptr)
@ -41,7 +41,7 @@ TexturePtr Texture::Create(String const& file_path)
return ptr; return ptr;
} }
TexturePtr Texture::Create(Resource const& res) TexturePtr Texture::Create(const Resource& res)
{ {
TexturePtr ptr = new (std::nothrow) Texture; TexturePtr ptr = new (std::nothrow) Texture;
if (ptr) if (ptr)
@ -59,13 +59,13 @@ Texture::Texture()
Texture::~Texture() {} Texture::~Texture() {}
bool Texture::Load(String const& file_path) bool Texture::Load(const String& file_path)
{ {
Renderer::GetInstance().CreateTexture(*this, file_path); Renderer::GetInstance().CreateTexture(*this, file_path);
return IsValid(); return IsValid();
} }
bool Texture::Load(Resource const& res) bool Texture::Load(const Resource& res)
{ {
Renderer::GetInstance().CreateTexture(*this, res); Renderer::GetInstance().CreateTexture(*this, res);
return IsValid(); return IsValid();
@ -88,7 +88,7 @@ void Texture::CopyFrom(TexturePtr copy_from)
#endif #endif
} }
void Texture::CopyFrom(TexturePtr copy_from, Rect const& src_rect, Point const& dest_point) void Texture::CopyFrom(TexturePtr copy_from, const Rect& src_rect, const Point& dest_point)
{ {
#if KGE_RENDER_ENGINE == KGE_RENDER_ENGINE_DIRECTX #if KGE_RENDER_ENGINE == KGE_RENDER_ENGINE_DIRECTX
if (IsValid() && copy_from) if (IsValid() && copy_from)

View File

@ -56,11 +56,11 @@ class KGE_API Texture : public NativeObject
public: public:
/// \~chinese /// \~chinese
/// @brief 从本地文件创建纹理 /// @brief 从本地文件创建纹理
static TexturePtr Create(String const& file_path); static TexturePtr Create(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 从资源创建纹理 /// @brief 从资源创建纹理
static TexturePtr Create(Resource const& res); static TexturePtr Create(const Resource& res);
Texture(); Texture();
@ -68,11 +68,11 @@ public:
/// \~chinese /// \~chinese
/// @brief 加载本地文件 /// @brief 加载本地文件
bool Load(String const& file_path); bool Load(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 加载资源 /// @brief 加载资源
bool Load(Resource const& res); bool Load(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 获取纹理宽度 /// @brief 获取纹理宽度
@ -123,7 +123,7 @@ public:
/// @param copy_from 源纹理 /// @param copy_from 源纹理
/// @param src_rect 源纹理裁剪矩形 /// @param src_rect 源纹理裁剪矩形
/// @param dest_point 拷贝至目标位置 /// @param dest_point 拷贝至目标位置
void CopyFrom(TexturePtr copy_from, Rect const& src_rect, Point const& dest_point); void CopyFrom(TexturePtr copy_from, const Rect& src_rect, const Point& dest_point);
/// \~chinese /// \~chinese
/// @brief 设置默认的像素插值方式 /// @brief 设置默认的像素插值方式

View File

@ -25,7 +25,7 @@
namespace kiwano namespace kiwano
{ {
template <typename _Ty, typename _PathTy, typename _CacheTy> template <typename _Ty, typename _PathTy, typename _CacheTy>
SmartPtr<_Ty> CreateOrGetCache(_CacheTy& cache, _PathTy const& path, size_t hash) SmartPtr<_Ty> CreateOrGetCache(_CacheTy& cache, const _PathTy& path, size_t hash)
{ {
auto iter = cache.find(hash); auto iter = cache.find(hash);
if (iter != cache.end()) if (iter != cache.end())
@ -55,46 +55,46 @@ TextureCache::TextureCache() {}
TextureCache::~TextureCache() {} TextureCache::~TextureCache() {}
TexturePtr TextureCache::AddOrGetTexture(String const& file_path) TexturePtr TextureCache::AddOrGetTexture(const String& file_path)
{ {
size_t hash = std::hash<String>()(file_path); size_t hash = std::hash<String>()(file_path);
return CreateOrGetCache<Texture>(texture_cache_, file_path, hash); return CreateOrGetCache<Texture>(texture_cache_, file_path, hash);
} }
TexturePtr TextureCache::AddOrGetTexture(Resource const& res) TexturePtr TextureCache::AddOrGetTexture(const Resource& res)
{ {
return CreateOrGetCache<Texture>(texture_cache_, res, res.GetId()); return CreateOrGetCache<Texture>(texture_cache_, res, res.GetId());
} }
GifImagePtr TextureCache::AddOrGetGifImage(String const& file_path) GifImagePtr TextureCache::AddOrGetGifImage(const String& file_path)
{ {
size_t hash = std::hash<String>()(file_path); size_t hash = std::hash<String>()(file_path);
return CreateOrGetCache<GifImage>(gif_texture_cache_, file_path, hash); return CreateOrGetCache<GifImage>(gif_texture_cache_, file_path, hash);
} }
GifImagePtr TextureCache::AddOrGetGifImage(Resource const& res) GifImagePtr TextureCache::AddOrGetGifImage(const Resource& res)
{ {
return CreateOrGetCache<GifImage>(gif_texture_cache_, res, res.GetId()); return CreateOrGetCache<GifImage>(gif_texture_cache_, res, res.GetId());
} }
void TextureCache::RemoveTexture(String const& file_path) void TextureCache::RemoveTexture(const String& file_path)
{ {
size_t hash = std::hash<String>()(file_path); size_t hash = std::hash<String>()(file_path);
RemoveCache(texture_cache_, hash); RemoveCache(texture_cache_, hash);
} }
void TextureCache::RemoveTexture(Resource const& res) void TextureCache::RemoveTexture(const Resource& res)
{ {
RemoveCache(texture_cache_, res.GetId()); RemoveCache(texture_cache_, res.GetId());
} }
void TextureCache::RemoveGifImage(String const& file_path) void TextureCache::RemoveGifImage(const String& file_path)
{ {
size_t hash = std::hash<String>()(file_path); size_t hash = std::hash<String>()(file_path);
RemoveCache(gif_texture_cache_, hash); RemoveCache(gif_texture_cache_, hash);
} }
void TextureCache::RemoveGifImage(Resource const& res) void TextureCache::RemoveGifImage(const Resource& res)
{ {
RemoveCache(gif_texture_cache_, res.GetId()); RemoveCache(gif_texture_cache_, res.GetId());
} }

View File

@ -40,35 +40,35 @@ class KGE_API TextureCache : public Singleton<TextureCache>
public: public:
/// \~chinese /// \~chinese
/// @brief 添加或获取纹理 /// @brief 添加或获取纹理
TexturePtr AddOrGetTexture(String const& file_path); TexturePtr AddOrGetTexture(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 添加或获取纹理 /// @brief 添加或获取纹理
TexturePtr AddOrGetTexture(Resource const& res); TexturePtr AddOrGetTexture(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 添加或获取GIF图像 /// @brief 添加或获取GIF图像
GifImagePtr AddOrGetGifImage(String const& file_path); GifImagePtr AddOrGetGifImage(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 添加或获取GIF图像 /// @brief 添加或获取GIF图像
GifImagePtr AddOrGetGifImage(Resource const& res); GifImagePtr AddOrGetGifImage(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 移除纹理缓存 /// @brief 移除纹理缓存
void RemoveTexture(String const& file_path); void RemoveTexture(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 移除纹理缓存 /// @brief 移除纹理缓存
void RemoveTexture(Resource const& res); void RemoveTexture(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 移除GIF图像缓存 /// @brief 移除GIF图像缓存
void RemoveGifImage(String const& file_path); void RemoveGifImage(const String& file_path);
/// \~chinese /// \~chinese
/// @brief 移除GIF图像缓存 /// @brief 移除GIF图像缓存
void RemoveGifImage(Resource const& res); void RemoveGifImage(const Resource& res);
/// \~chinese /// \~chinese
/// @brief 清空缓存 /// @brief 清空缓存

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