From ee2854b3fed6967a9907954ac574e3252a730e96 Mon Sep 17 00:00:00 2001 From: Nomango Date: Sat, 12 Oct 2019 11:26:41 +0800 Subject: [PATCH] tidy --- src/kiwano-audio/Sound.cpp | 4 +- src/kiwano-audio/SoundPlayer.cpp | 16 +++---- src/kiwano-audio/SoundPlayer.h | 16 +++---- src/kiwano-audio/Transcoder.cpp | 4 +- src/kiwano-audio/Transcoder.h | 4 +- src/kiwano-imgui/ImGuiModule.cpp | 6 +-- src/kiwano-imgui/ImGuiModule.h | 2 +- src/kiwano-network/HttpClient.cpp | 4 +- src/kiwano/2d/Actor.cpp | 6 +-- src/kiwano/2d/Actor.h | 4 +- src/kiwano/2d/FrameSequence.cpp | 2 +- src/kiwano/2d/FrameSequence.h | 2 +- src/kiwano/2d/GifSprite.h | 6 +-- src/kiwano/2d/Text.cpp | 2 +- src/kiwano/2d/Text.h | 2 +- src/kiwano/2d/action/Animation.cpp | 2 +- src/kiwano/base/EventDispatcher.cpp | 8 ++-- src/kiwano/base/EventDispatcher.h | 10 ++--- src/kiwano/base/EventListener.cpp | 2 +- src/kiwano/base/EventListener.h | 14 +++---- src/kiwano/base/Logger.cpp | 2 +- src/kiwano/base/ObjectBase.cpp | 2 +- src/kiwano/base/ObjectBase.h | 16 +++---- src/kiwano/base/Resource.cpp | 4 +- src/kiwano/base/Resource.h | 8 ++-- src/kiwano/base/Window.cpp | 38 ++++++++--------- src/kiwano/base/Window.h | 22 +++++----- src/kiwano/base/time.cpp | 6 +-- src/kiwano/core/basic_json.hpp | 42 +++++++++---------- src/kiwano/core/core.h | 2 +- src/kiwano/core/function.hpp | 2 +- src/kiwano/core/intrusive_ptr.hpp | 12 +++--- src/kiwano/core/string.hpp | 22 +++++----- src/kiwano/core/vector.hpp | 6 +-- src/kiwano/math/Matrix.hpp | 6 +-- src/kiwano/platform/Application.cpp | 2 +- src/kiwano/platform/Application.h | 6 +-- src/kiwano/renderer/Color.cpp | 16 +++---- src/kiwano/renderer/Color.h | 8 ++-- src/kiwano/renderer/Font.cpp | 4 +- src/kiwano/renderer/Font.h | 22 +++++----- src/kiwano/renderer/Geometry.cpp | 6 +-- src/kiwano/renderer/Geometry.h | 2 +- src/kiwano/renderer/GifImage.cpp | 8 ++-- src/kiwano/renderer/GifImage.h | 12 +++--- src/kiwano/renderer/Renderer.cpp | 14 +++---- src/kiwano/renderer/Renderer.h | 4 +- src/kiwano/renderer/TextLayout.cpp | 2 +- src/kiwano/renderer/TextLayout.h | 2 +- src/kiwano/renderer/Texture.cpp | 20 ++++----- src/kiwano/renderer/Texture.h | 6 +-- src/kiwano/renderer/TextureCache.cpp | 4 +- src/kiwano/renderer/TextureCache.h | 4 +- .../renderer/win32/D3D10DeviceResources.cpp | 14 +++---- .../renderer/win32/D3D11DeviceResources.cpp | 6 +-- .../renderer/win32/FontCollectionLoader.cpp | 40 +++++++++--------- .../renderer/win32/FontCollectionLoader.h | 4 +- src/kiwano/ui/Menu.cpp | 2 +- src/kiwano/ui/Menu.h | 2 +- src/kiwano/utils/ResourceCache.cpp | 6 +-- src/kiwano/utils/ResourceCache.h | 6 +-- 61 files changed, 264 insertions(+), 264 deletions(-) diff --git a/src/kiwano-audio/Sound.cpp b/src/kiwano-audio/Sound.cpp index db4edab5..d0bda67f 100644 --- a/src/kiwano-audio/Sound.cpp +++ b/src/kiwano-audio/Sound.cpp @@ -141,7 +141,7 @@ namespace kiwano buffer.pAudioData = wave_buffer.data; buffer.Flags = XAUDIO2_END_OF_STREAM; buffer.AudioBytes = wave_buffer.size; - buffer.LoopCount = static_cast(loop_count); + buffer.LoopCount = static_cast(loop_count); HRESULT hr = voice_->SubmitSourceBuffer(&buffer); if (SUCCEEDED(hr)) @@ -214,7 +214,7 @@ namespace kiwano XAUDIO2_VOICE_STATE state; voice_->GetState(&state); - std::uint32_t buffers_queued = state.BuffersQueued; + uint32_t buffers_queued = state.BuffersQueued; if (buffers_queued && playing_) return true; diff --git a/src/kiwano-audio/SoundPlayer.cpp b/src/kiwano-audio/SoundPlayer.cpp index 50ca363b..1d81484f 100644 --- a/src/kiwano-audio/SoundPlayer.cpp +++ b/src/kiwano-audio/SoundPlayer.cpp @@ -34,7 +34,7 @@ namespace kiwano ClearCache(); } - std::size_t SoundPlayer::Load(String const& file_path) + size_t SoundPlayer::Load(String const& file_path) { int hash_code = static_cast(file_path.hash()); if (sound_cache_.end() != sound_cache_.find(hash_code)) @@ -54,9 +54,9 @@ namespace kiwano return 0; } - std::size_t SoundPlayer::Load(Resource const& res) + size_t SoundPlayer::Load(Resource const& res) { - std::size_t hash_code = static_cast(res.GetId()); + size_t hash_code = static_cast(res.GetId()); if (sound_cache_.end() != sound_cache_.find(hash_code)) return hash_code; @@ -74,35 +74,35 @@ namespace kiwano return 0; } - void SoundPlayer::Play(std::size_t id, int loop_count) + void SoundPlayer::Play(size_t id, int loop_count) { auto iter = sound_cache_.find(id); if (sound_cache_.end() != iter) iter->second->Play(loop_count); } - void SoundPlayer::Pause(std::size_t id) + void SoundPlayer::Pause(size_t id) { auto iter = sound_cache_.find(id); if (sound_cache_.end() != iter) iter->second->Pause(); } - void SoundPlayer::Resume(std::size_t id) + void SoundPlayer::Resume(size_t id) { auto iter = sound_cache_.find(id); if (sound_cache_.end() != iter) iter->second->Resume(); } - void SoundPlayer::Stop(std::size_t id) + void SoundPlayer::Stop(size_t id) { auto iter = sound_cache_.find(id); if (sound_cache_.end() != iter) iter->second->Stop(); } - bool SoundPlayer::IsPlaying(std::size_t id) + bool SoundPlayer::IsPlaying(size_t id) { auto iter = sound_cache_.find(id); if (sound_cache_.end() != iter) diff --git a/src/kiwano-audio/SoundPlayer.h b/src/kiwano-audio/SoundPlayer.h index 356b9249..f3659a5d 100644 --- a/src/kiwano-audio/SoundPlayer.h +++ b/src/kiwano-audio/SoundPlayer.h @@ -39,39 +39,39 @@ namespace kiwano ~SoundPlayer(); // 加载本地音频文件, 返回该资源的标识符 - std::size_t Load( + size_t Load( String const& file_path ); // 加载音乐资源, 返回该资源的标识符 - std::size_t Load( + size_t Load( Resource const& res /* 音乐资源 */ ); // 播放音乐 void Play( - std::size_t id, /* 标识符 */ + size_t id, /* 标识符 */ int loop_count = 0 /* 播放循环次数 (-1 为循环播放) */ ); // 暂停音乐 void Pause( - std::size_t id /* 标识符 */ + size_t id /* 标识符 */ ); // 继续播放音乐 void Resume( - std::size_t id /* 标识符 */ + size_t id /* 标识符 */ ); // 停止音乐 void Stop( - std::size_t id /* 标识符 */ + size_t id /* 标识符 */ ); // 获取音乐播放状态 bool IsPlaying( - std::size_t id /* 标识符 */ + size_t id /* 标识符 */ ); // 获取音量 @@ -97,7 +97,7 @@ namespace kiwano protected: float volume_; - using SoundMap = Map; + using SoundMap = Map; SoundMap sound_cache_; }; } diff --git a/src/kiwano-audio/Transcoder.cpp b/src/kiwano-audio/Transcoder.cpp index 742b371b..23552f8b 100644 --- a/src/kiwano-audio/Transcoder.cpp +++ b/src/kiwano-audio/Transcoder.cpp @@ -103,7 +103,7 @@ namespace kiwano stream = kiwano::modules::Shlwapi::Get().SHCreateMemStream( static_cast(data.buffer), - static_cast(data.size) + static_cast(data.size) ); if (stream == nullptr) @@ -185,7 +185,7 @@ namespace kiwano // 获取 WAVEFORMAT 数据 if (SUCCEEDED(hr)) { - std::uint32_t size = 0; + uint32_t size = 0; hr = modules::MediaFoundation::Get().MFCreateWaveFormatExFromMFMediaType( uncompressed_type.get(), &wave_format_, diff --git a/src/kiwano-audio/Transcoder.h b/src/kiwano-audio/Transcoder.h index e6a6b4c1..7d6d0d78 100644 --- a/src/kiwano-audio/Transcoder.h +++ b/src/kiwano-audio/Transcoder.h @@ -35,7 +35,7 @@ namespace kiwano struct Buffer { BYTE* data; - std::uint32_t size; + uint32_t size; const WAVEFORMATEX* format; }; @@ -61,7 +61,7 @@ namespace kiwano private: BYTE* wave_data_; - std::uint32_t wave_size_; + uint32_t wave_size_; WAVEFORMATEX* wave_format_; }; } diff --git a/src/kiwano-imgui/ImGuiModule.cpp b/src/kiwano-imgui/ImGuiModule.cpp index ac4c031c..5ed0034f 100644 --- a/src/kiwano-imgui/ImGuiModule.cpp +++ b/src/kiwano-imgui/ImGuiModule.cpp @@ -119,7 +119,7 @@ namespace kiwano Render(); } - void ImGuiModule::HandleMessage(HWND hwnd, std::uint32_t msg, WPARAM wparam, LPARAM lparam) + void ImGuiModule::HandleMessage(HWND hwnd, UINT32 msg, WPARAM wparam, LPARAM lparam) { if (ImGui::GetCurrentContext() == NULL) return; @@ -185,7 +185,7 @@ namespace kiwano case WM_CHAR: { // You can also use ToAscii()+GetKeyboardState() to retrieve characters. - io.AddInputCharacter((std::uint32_t)wparam); + io.AddInputCharacter((uint32_t)wparam); break; } case WM_SETCURSOR: @@ -198,7 +198,7 @@ namespace kiwano } case WM_DEVICECHANGE: { - if ((std::uint32_t)wparam == DBT_DEVNODES_CHANGED) + if ((uint32_t)wparam == DBT_DEVNODES_CHANGED) want_update_has_gamepad_ = true; break; } diff --git a/src/kiwano-imgui/ImGuiModule.h b/src/kiwano-imgui/ImGuiModule.h index 034a47a7..a047da68 100644 --- a/src/kiwano-imgui/ImGuiModule.h +++ b/src/kiwano-imgui/ImGuiModule.h @@ -54,7 +54,7 @@ namespace kiwano void AfterRender() override; - void HandleMessage(HWND hwnd, std::uint32_t msg, WPARAM wparam, LPARAM lparam) override; + void HandleMessage(HWND hwnd, UINT32 msg, WPARAM wparam, LPARAM lparam) override; void UpdateMousePos(); diff --git a/src/kiwano-network/HttpClient.cpp b/src/kiwano-network/HttpClient.cpp index 09862d58..169d9825 100644 --- a/src/kiwano-network/HttpClient.cpp +++ b/src/kiwano-network/HttpClient.cpp @@ -34,10 +34,10 @@ namespace using namespace kiwano; using namespace kiwano::network; - std::uint32_t write_data(void* buffer, std::uint32_t size, std::uint32_t nmemb, void* userp) + uint32_t write_data(void* buffer, uint32_t size, uint32_t nmemb, void* userp) { kiwano::string* recv_buffer = (kiwano::string*)userp; - std::uint32_t total = size * nmemb; + uint32_t total = size * nmemb; // add data to the end of recv_buffer // write data maybe called more than once in a single request diff --git a/src/kiwano/2d/Actor.cpp b/src/kiwano/2d/Actor.cpp index d8d969c3..8ec36482 100644 --- a/src/kiwano/2d/Actor.cpp +++ b/src/kiwano/2d/Actor.cpp @@ -502,7 +502,7 @@ namespace kiwano Vector Actor::GetChildren(String const& name) const { Vector children; - std::size_t hash_code = std::hash{}(name); + size_t hash_code = std::hash{}(name); for (Actor* child = children_.first_item().get(); child; child = child->next_item().get()) { @@ -516,7 +516,7 @@ namespace kiwano ActorPtr Actor::GetChild(String const& name) const { - std::size_t hash_code = std::hash{}(name); + size_t hash_code = std::hash{}(name); for (Actor* child = children_.first_item().get(); child; child = child->next_item().get()) { @@ -568,7 +568,7 @@ namespace kiwano return; } - std::size_t hash_code = std::hash{}(child_name); + size_t hash_code = std::hash{}(child_name); Actor* next; for (Actor* child = children_.first_item().get(); child; child = next) diff --git a/src/kiwano/2d/Actor.h b/src/kiwano/2d/Actor.h index 4d9381d9..a3bb4fee 100644 --- a/src/kiwano/2d/Actor.h +++ b/src/kiwano/2d/Actor.h @@ -64,7 +64,7 @@ namespace kiwano bool IsCascadeOpacityEnabled() const { return cascade_opacity_; } // 获取名称的 Hash 值 - std::size_t GetHashName() const { return hash_name_; } + size_t GetHashName() const { return hash_name_; } // 获取 Z 轴顺序 int GetZOrder() const { return z_order_; } @@ -413,7 +413,7 @@ namespace kiwano float displayed_opacity_; Actor* parent_; Stage* stage_; - std::size_t hash_name_; + size_t hash_name_; Point anchor_; Size size_; Children children_; diff --git a/src/kiwano/2d/FrameSequence.cpp b/src/kiwano/2d/FrameSequence.cpp index 19ed23ab..0bc00b5e 100644 --- a/src/kiwano/2d/FrameSequence.cpp +++ b/src/kiwano/2d/FrameSequence.cpp @@ -59,7 +59,7 @@ namespace kiwano } } - FramePtr FrameSequence::GetFrame(std::size_t index) const + FramePtr FrameSequence::GetFrame(size_t index) const { KGE_ASSERT(index < frames_.size()); return frames_[index]; diff --git a/src/kiwano/2d/FrameSequence.h b/src/kiwano/2d/FrameSequence.h index 367aa0c7..6a52839b 100644 --- a/src/kiwano/2d/FrameSequence.h +++ b/src/kiwano/2d/FrameSequence.h @@ -47,7 +47,7 @@ namespace kiwano ); // 获取关键帧 - FramePtr GetFrame(std::size_t index) const; + FramePtr GetFrame(size_t index) const; // 获取关键帧 Vector const& GetFrames() const; diff --git a/src/kiwano/2d/GifSprite.h b/src/kiwano/2d/GifSprite.h index fb09b8c9..bc5c4cb8 100644 --- a/src/kiwano/2d/GifSprite.h +++ b/src/kiwano/2d/GifSprite.h @@ -104,9 +104,9 @@ namespace kiwano protected: bool animating_; - int total_loop_count_; - int loop_count_; - std::size_t next_index_; + int total_loop_count_; + int loop_count_; + size_t next_index_; Duration frame_elapsed_; LoopDoneCallback loop_cb_; DoneCallback done_cb_; diff --git a/src/kiwano/2d/Text.cpp b/src/kiwano/2d/Text.cpp index a979466d..508598a5 100644 --- a/src/kiwano/2d/Text.cpp +++ b/src/kiwano/2d/Text.cpp @@ -112,7 +112,7 @@ namespace kiwano } } - void Text::SetFontWeight(std::uint32_t weight) + void Text::SetFontWeight(uint32_t weight) { if (font_.weight != weight) { diff --git a/src/kiwano/2d/Text.h b/src/kiwano/2d/Text.h index f3fdc528..4ee9df11 100644 --- a/src/kiwano/2d/Text.h +++ b/src/kiwano/2d/Text.h @@ -92,7 +92,7 @@ namespace kiwano // 设置字体粗细值(默认值为 FontWeight::Normal) void SetFontWeight( - std::uint32_t weight + uint32_t weight ); // 设置文字颜色(默认值为 Color::White) diff --git a/src/kiwano/2d/action/Animation.cpp b/src/kiwano/2d/action/Animation.cpp index c870bea1..f146e4cc 100644 --- a/src/kiwano/2d/action/Animation.cpp +++ b/src/kiwano/2d/action/Animation.cpp @@ -76,7 +76,7 @@ namespace kiwano { const auto& frames = frame_seq_->GetFrames(); auto size = frames.size(); - auto index = std::min(static_cast(math::Floor(size * percent)), size - 1); + auto index = std::min(static_cast(math::Floor(size * percent)), size - 1); sprite_target->SetFrame(frames[index]); } diff --git a/src/kiwano/base/EventDispatcher.cpp b/src/kiwano/base/EventDispatcher.cpp index a05199ff..3537c53c 100644 --- a/src/kiwano/base/EventDispatcher.cpp +++ b/src/kiwano/base/EventDispatcher.cpp @@ -51,7 +51,7 @@ namespace kiwano return listener.get(); } - EventListener* EventDispatcher::AddListener(std::uint32_t type, EventCallback callback, String const& name) + EventListener* EventDispatcher::AddListener(EventType type, EventListener::Callback callback, String const& name) { EventListenerPtr listener = new EventListener(type, callback, name); return AddListener(listener); @@ -93,7 +93,7 @@ namespace kiwano } } - void EventDispatcher::StartListeners(std::uint32_t type) + void EventDispatcher::StartListeners(uint32_t type) { for (auto listener = listeners_.first_item(); listener; listener = listener->next_item()) { @@ -104,7 +104,7 @@ namespace kiwano } } - void EventDispatcher::StopListeners(std::uint32_t type) + void EventDispatcher::StopListeners(uint32_t type) { for (auto listener = listeners_.first_item(); listener; listener = listener->next_item()) { @@ -115,7 +115,7 @@ namespace kiwano } } - void EventDispatcher::RemoveListeners(std::uint32_t type) + void EventDispatcher::RemoveListeners(uint32_t type) { EventListenerPtr next; for (auto listener = listeners_.first_item(); listener; listener = next) diff --git a/src/kiwano/base/EventDispatcher.h b/src/kiwano/base/EventDispatcher.h index f1c956bc..4b59abca 100644 --- a/src/kiwano/base/EventDispatcher.h +++ b/src/kiwano/base/EventDispatcher.h @@ -35,8 +35,8 @@ namespace kiwano // 添加监听器 EventListener* AddListener( - std::uint32_t type, - EventCallback callback, + EventType type, + EventListener::Callback callback, String const& name = L"" ); @@ -57,17 +57,17 @@ namespace kiwano // 启动监听器 void StartListeners( - std::uint32_t type + uint32_t type ); // 停止监听器 void StopListeners( - std::uint32_t type + uint32_t type ); // 移除监听器 void RemoveListeners( - std::uint32_t type + uint32_t type ); virtual void Dispatch(Event& evt); diff --git a/src/kiwano/base/EventListener.cpp b/src/kiwano/base/EventListener.cpp index 60a6fca6..e8ffcb6b 100644 --- a/src/kiwano/base/EventListener.cpp +++ b/src/kiwano/base/EventListener.cpp @@ -23,7 +23,7 @@ namespace kiwano { - EventListener::EventListener(std::uint32_t type, EventCallback const & callback, String const & name) + EventListener::EventListener(EventType type, Callback const & callback, String const & name) : type_(type) , callback_(callback) , running_(true) diff --git a/src/kiwano/base/EventListener.h b/src/kiwano/base/EventListener.h index 0a1ae86c..ee0fc59a 100644 --- a/src/kiwano/base/EventListener.h +++ b/src/kiwano/base/EventListener.h @@ -26,8 +26,6 @@ namespace kiwano { - typedef Function EventCallback; - class EventDispatcher; KGE_DECLARE_SMART_PTR(EventListener); @@ -41,9 +39,11 @@ namespace kiwano friend class intrusive_list; public: + using Callback = Function; + EventListener( - std::uint32_t type, - EventCallback const& callback, + EventType type, + Callback const& callback, String const& name = L"" ); @@ -56,8 +56,8 @@ namespace kiwano inline bool IsRunning() const { return running_; } protected: - bool running_; - std::uint32_t type_; - EventCallback callback_; + bool running_; + EventType type_; + Callback callback_; }; } diff --git a/src/kiwano/base/Logger.cpp b/src/kiwano/base/Logger.cpp index adfe259a..7454ab2a 100644 --- a/src/kiwano/base/Logger.cpp +++ b/src/kiwano/base/Logger.cpp @@ -298,7 +298,7 @@ namespace kiwano std::wostream& Logger::OutPrefix(std::wostream& out) { - std::time_t unix = std::time(nullptr); + time_t unix = std::time(nullptr); std::tm tmbuf; localtime_s(&tmbuf, &unix); out << std::put_time(&tmbuf, L"[kiwano] %H:%M:%S"); diff --git a/src/kiwano/base/ObjectBase.cpp b/src/kiwano/base/ObjectBase.cpp index e526ed1d..af095dd6 100644 --- a/src/kiwano/base/ObjectBase.cpp +++ b/src/kiwano/base/ObjectBase.cpp @@ -30,7 +30,7 @@ namespace kiwano Vector tracing_objects; } - std::uint32_t ObjectBase::last_object_id = 0; + uint32_t ObjectBase::last_object_id = 0; ObjectBase::ObjectBase() : tracing_leak_(false) diff --git a/src/kiwano/base/ObjectBase.h b/src/kiwano/base/ObjectBase.h index 178120e7..b3c5f0bc 100644 --- a/src/kiwano/base/ObjectBase.h +++ b/src/kiwano/base/ObjectBase.h @@ -44,11 +44,11 @@ namespace kiwano String DumpObject(); - inline String GetName() const { if (name_) return *name_; return String(); } + inline String GetName() const { if (name_) return *name_; return String(); } - inline bool IsName(String const& name) const { return name_ ? (*name_ == name) : name.empty(); } + inline bool IsName(String const& name) const { return name_ ? (*name_ == name) : name.empty(); } - inline std::uint32_t GetObjectID() const { return id_; } + inline uint32_t GetObjectID() const { return id_; } public: static bool IsTracingLeaks(); @@ -67,11 +67,11 @@ namespace kiwano static void __RemoveObjectFromTracingList(ObjectBase*); private: - bool tracing_leak_; - void* user_data_; - String* name_; + bool tracing_leak_; + void* user_data_; + String* name_; - const std::uint32_t id_; - static std::uint32_t last_object_id; + const uint32_t id_; + static uint32_t last_object_id; }; } diff --git a/src/kiwano/base/Resource.cpp b/src/kiwano/base/Resource.cpp index 2157c7ad..6dfc3ceb 100644 --- a/src/kiwano/base/Resource.cpp +++ b/src/kiwano/base/Resource.cpp @@ -32,7 +32,7 @@ namespace kiwano } - Resource::Resource(std::uint32_t id, const wchar_t* type) + Resource::Resource(uint32_t id, const wchar_t* type) : id_(id) , type_(type) { @@ -76,7 +76,7 @@ namespace kiwano } data_.buffer = static_cast(buffer); - data_.size = static_cast(size); + data_.size = static_cast(size); } while (0); return data_; diff --git a/src/kiwano/base/Resource.h b/src/kiwano/base/Resource.h index 2dce4c29..53aed99c 100644 --- a/src/kiwano/base/Resource.h +++ b/src/kiwano/base/Resource.h @@ -39,7 +39,7 @@ namespace kiwano struct Data { void* buffer; - std::uint32_t size; + uint32_t size; inline Data() : buffer(nullptr), size(0) {} @@ -49,19 +49,19 @@ namespace kiwano Resource(); Resource( - std::uint32_t id, /* 资源 ID */ + uint32_t id, /* 资源 ID */ const wchar_t* type /* 资源类型 */ ); // 获取二进制数据 Resource::Data GetData() const; - inline std::uint32_t GetId() const { return id_; } + inline uint32_t GetId() const { return id_; } inline const wchar_t* GetType() const { return type_; } private: - std::uint32_t id_; + uint32_t id_; const wchar_t* type_; mutable Resource::Data data_; diff --git a/src/kiwano/base/Window.cpp b/src/kiwano/base/Window.cpp index 93514036..ff0f1f91 100644 --- a/src/kiwano/base/Window.cpp +++ b/src/kiwano/base/Window.cpp @@ -33,14 +33,14 @@ namespace kiwano { MONITORINFOEX GetMoniterInfoEx(HWND hwnd); - void AdjustWindow(std::uint32_t width, std::uint32_t height, DWORD style, std::uint32_t* win_width, std::uint32_t* win_height); + void AdjustWindow(uint32_t width, uint32_t height, DWORD style, uint32_t* win_width, uint32_t* win_height); void ChangeFullScreenResolution(int width, int height, WCHAR* device_name); void RestoreResolution(WCHAR* device_name); } - WindowConfig::WindowConfig(String const& title, std::uint32_t width, std::uint32_t height, std::uint32_t icon, bool resizable, bool fullscreen) + WindowConfig::WindowConfig(String const& title, uint32_t width, uint32_t height, uint32_t icon, bool resizable, bool fullscreen) : title(title) , width(width) , height(height) @@ -114,11 +114,11 @@ namespace kiwano // Save the device name int len = lstrlenW(monitor_info_ex.szDevice); - device_name_ = new WCHAR[len + 1]; + device_name_ = new wchar_t[len + 1]; lstrcpyW(device_name_, monitor_info_ex.szDevice); - std::uint32_t width = config.width; - std::uint32_t height = config.height; + uint32_t width = config.width; + uint32_t height = config.height; int left = -1; int top = -1; @@ -130,18 +130,18 @@ namespace kiwano top = monitor_info_ex.rcMonitor.top; left = monitor_info_ex.rcMonitor.left; - if (width > static_cast(monitor_info_ex.rcWork.right - left)) - width = static_cast(monitor_info_ex.rcWork.right - left); + if (width > static_cast(monitor_info_ex.rcWork.right - left)) + width = static_cast(monitor_info_ex.rcWork.right - left); - if (height > static_cast(monitor_info_ex.rcWork.bottom - top)) - height = static_cast(monitor_info_ex.rcWork.bottom - top); + if (height > static_cast(monitor_info_ex.rcWork.bottom - top)) + height = static_cast(monitor_info_ex.rcWork.bottom - top); } else { - std::uint32_t screenw = monitor_info_ex.rcWork.right - monitor_info_ex.rcWork.left; - std::uint32_t screenh = monitor_info_ex.rcWork.bottom - monitor_info_ex.rcWork.top; + uint32_t screenw = monitor_info_ex.rcWork.right - monitor_info_ex.rcWork.left; + uint32_t screenh = monitor_info_ex.rcWork.bottom - monitor_info_ex.rcWork.top; - std::uint32_t win_width, win_height; + uint32_t win_width, win_height; AdjustWindow( width, height, @@ -242,7 +242,7 @@ namespace kiwano return static_cast(height_); } - void Window::SetIcon(std::uint32_t icon_resource) + void Window::SetIcon(uint32_t icon_resource) { if (handle_) { @@ -301,10 +301,10 @@ namespace kiwano MONITORINFOEX info = GetMoniterInfoEx(handle_); - std::uint32_t screenw = info.rcWork.right - info.rcWork.left; - std::uint32_t screenh = info.rcWork.bottom - info.rcWork.top; + uint32_t screenw = info.rcWork.right - info.rcWork.left; + uint32_t screenh = info.rcWork.bottom - info.rcWork.top; - std::uint32_t win_width, win_height; + uint32_t win_width, win_height; AdjustWindow(width, height, GetWindowStyle(), &win_width, &win_height); int left = screenw > win_width ? ((screenw - win_width) / 2) : 0; @@ -402,7 +402,7 @@ namespace kiwano return monitor_info; } - void AdjustWindow(std::uint32_t width, std::uint32_t height, DWORD style, std::uint32_t* win_width, std::uint32_t* win_height) + void AdjustWindow(uint32_t width, uint32_t height, DWORD style, uint32_t* win_width, uint32_t* win_height) { RECT rc; ::SetRect(&rc, 0, 0, (int)width, (int)height); @@ -413,8 +413,8 @@ namespace kiwano MONITORINFOEX info = GetMoniterInfoEx(NULL); - std::uint32_t screenw = info.rcWork.right - info.rcWork.left; - std::uint32_t screenh = info.rcWork.bottom - info.rcWork.top; + uint32_t screenw = info.rcWork.right - info.rcWork.left; + uint32_t screenh = info.rcWork.bottom - info.rcWork.top; if (*win_width > screenw) *win_width = screenw; diff --git a/src/kiwano/base/Window.h b/src/kiwano/base/Window.h index 02244d3f..d8ace2f0 100644 --- a/src/kiwano/base/Window.h +++ b/src/kiwano/base/Window.h @@ -41,18 +41,18 @@ namespace kiwano // 窗口设置 struct WindowConfig { - String title; // 标题 - std::uint32_t width; // 宽度 - std::uint32_t height; // 高度 - std::uint32_t icon; // 图标资源 ID - bool resizable; // 窗口大小可拉伸 - bool fullscreen; // 全屏模式 + String title; // 标题 + uint32_t width; // 宽度 + uint32_t height; // 高度 + uint32_t icon; // 图标资源 ID + bool resizable; // 窗口大小可拉伸 + bool fullscreen; // 全屏模式 WindowConfig( String const& title = L"Kiwano Game", - std::uint32_t width = 640, - std::uint32_t height = 480, - std::uint32_t icon = 0, + uint32_t width = 640, + uint32_t height = 480, + uint32_t icon = 0, bool resizable = false, bool fullscreen = false ); @@ -82,7 +82,7 @@ namespace kiwano void SetTitle(String const& title); // 设置窗口图标 - void SetIcon(std::uint32_t icon_resource); + void SetIcon(uint32_t icon_resource); // 重设窗口大小 void Resize(int width, int height); @@ -121,7 +121,7 @@ namespace kiwano HWND handle_; int width_; int height_; - WCHAR* device_name_; + wchar_t* device_name_; CursorType mouse_cursor_; }; } diff --git a/src/kiwano/base/time.cpp b/src/kiwano/base/time.cpp index 3ff4fd33..5010ef5c 100644 --- a/src/kiwano/base/time.cpp +++ b/src/kiwano/base/time.cpp @@ -359,8 +359,8 @@ namespace kiwano Duration Duration::Parse(const String& str) { bool negative = false; - std::size_t len = str.length(); - std::size_t pos = 0; + size_t len = str.length(); + size_t pos = 0; Duration ret; if (!std::regex_match(str.c_str(), duration_regex)) @@ -381,7 +381,7 @@ namespace kiwano while (pos < len) { // 数值 - std::size_t i = pos; + size_t i = pos; for (; i < len; ++i) { wchar_t ch = str[i]; diff --git a/src/kiwano/core/basic_json.hpp b/src/kiwano/core/basic_json.hpp index b8323a27..5ef5e514 100644 --- a/src/kiwano/core/basic_json.hpp +++ b/src/kiwano/core/basic_json.hpp @@ -355,7 +355,7 @@ namespace __json_detail struct primitive_iterator { - using difference_type = std::ptrdiff_t; + using difference_type = ptrdiff_t; inline primitive_iterator(difference_type it = 0) : it_(it) {} @@ -403,7 +403,7 @@ namespace __json_detail using object_type = typename _BasicJsonTy::object_type; using value_type = _BasicJsonTy; - using difference_type = std::ptrdiff_t; + using difference_type = ptrdiff_t; using iterator_category = std::bidirectional_iterator_tag; using pointer = value_type*; using reference = value_type&; @@ -731,11 +731,11 @@ namespace __json_detail using char_traits = std::char_traits; virtual void write(const _CharTy ch) = 0; - virtual void write(const _CharTy* str, std::uint32_t size) = 0; + virtual void write(const _CharTy* str, uint32_t size) = 0; virtual void write(const _CharTy* str) { const auto size = char_traits::length(str); - write(str, static_cast(size)); + write(str, static_cast(size)); } }; @@ -754,7 +754,7 @@ namespace __json_detail str_.push_back(ch); } - virtual void write(const char_type* str, std::uint32_t size) override + virtual void write(const char_type* str, uint32_t size) override { str_.append(str, static_cast(size)); } @@ -778,7 +778,7 @@ namespace __json_detail stream_.put(ch); } - virtual void write(const char_type* str, std::uint32_t size) override + virtual void write(const char_type* str, uint32_t size) override { stream_.write(str, static_cast(size)); } @@ -815,8 +815,8 @@ namespace __json_detail void dump( const _BasicJsonTy& json, const bool pretty_print, - const std::uint32_t indent_step, - const std::uint32_t current_indent = 0) + const uint32_t indent_step, + const uint32_t current_indent = 0) { switch (json.type()) { @@ -842,7 +842,7 @@ namespace __json_detail auto iter = object.cbegin(); const auto size = object.size(); - for (std::uint32_t i = 0; i < size; ++i, ++iter) + for (uint32_t i = 0; i < size; ++i, ++iter) { out->write(indent_string.c_str(), new_indent); out->write('\"'); @@ -865,7 +865,7 @@ namespace __json_detail auto iter = object.cbegin(); const auto size = object.size(); - for (std::uint32_t i = 0; i < size; ++i, ++iter) + for (uint32_t i = 0; i < size; ++i, ++iter) { out->write('\"'); out->write(iter->first.c_str()); @@ -905,7 +905,7 @@ namespace __json_detail auto iter = vector.cbegin(); const auto size = vector.size(); - for (std::uint32_t i = 0; i < size; ++i, ++iter) + for (uint32_t i = 0; i < size; ++i, ++iter) { out->write(indent_string.c_str(), new_indent); dump(*iter, true, indent_step, new_indent); @@ -925,7 +925,7 @@ namespace __json_detail auto iter = vector.cbegin(); const auto size = vector.size(); - for (std::uint32_t i = 0; i < size; ++i, ++iter) + for (uint32_t i = 0; i < size; ++i, ++iter) { dump(*iter, false, indent_step, current_indent); // not last element @@ -1015,7 +1015,7 @@ namespace __json_detail if (len) { number_buffer[0] = '\0'; - ::swprintf_s(&number_buffer[0], std::size_t(len) + 1, L"%.*g", digits, val); + ::swprintf_s(&number_buffer[0], size_t(len) + 1, L"%.*g", digits, val); } else { @@ -1204,7 +1204,7 @@ namespace __json_detail private: const char_type* str; - std::uint32_t index; + uint32_t index; }; } // end of namespace __json_detail @@ -1338,7 +1338,7 @@ namespace __json_detail token_type scan_literal(const char_type* text, token_type result) { - for (std::uint32_t i = 0; text[i] != '\0'; ++i) + for (uint32_t i = 0; text[i] != '\0'; ++i) { if (text[i] != char_traits::to_char_type(current)) { @@ -1613,10 +1613,10 @@ namespace __json_detail read_next(); } - std::uint32_t exponent = static_cast(current - '0'); + uint32_t exponent = static_cast(current - '0'); while (std::isdigit(read_next())) { - exponent = (exponent * 10) + static_cast(current - '0'); + exponent = (exponent * 10) + static_cast(current - '0'); } float_type power = 1; @@ -1858,8 +1858,8 @@ class basic_json public: template using allocator_type = _Allocator<_Ty>; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; + using size_type = size_t; + using difference_type = ptrdiff_t; using string_type = _StringTy; using char_type = typename _StringTy::value_type; using integer_type = _IntegerTy; @@ -2544,7 +2544,7 @@ public: out.width(0); __json_detail::stream_output_adapter adapter(out); - __json_detail::json_serializer(&adapter, out.fill()).dump(json, pretty_print, static_cast(indentation)); + __json_detail::json_serializer(&adapter, out.fill()).dump(json, pretty_print, static_cast(indentation)); return out; } @@ -2565,7 +2565,7 @@ public: { if (indent >= 0) { - __json_detail::json_serializer(adapter, indent_char).dump(*this, true, static_cast(indent)); + __json_detail::json_serializer(adapter, indent_char).dump(*this, true, static_cast(indent)); } else { diff --git a/src/kiwano/core/core.h b/src/kiwano/core/core.h index 76c525f5..c32ba3f0 100644 --- a/src/kiwano/core/core.h +++ b/src/kiwano/core/core.h @@ -78,7 +78,7 @@ namespace std template<> struct hash<::kiwano::Json> { - ::std::size_t operator()(const ::kiwano::Json& json) const + size_t operator()(const ::kiwano::Json& json) const { return hash<::kiwano::Json::string_type>{}(json.dump()); } diff --git a/src/kiwano/core/function.hpp b/src/kiwano/core/function.hpp index a2b7fdcf..261affff 100644 --- a/src/kiwano/core/function.hpp +++ b/src/kiwano/core/function.hpp @@ -219,7 +219,7 @@ public: { } - function(::std::nullptr_t) + function(std::nullptr_t) : callable_(nullptr) { } diff --git a/src/kiwano/core/intrusive_ptr.hpp b/src/kiwano/core/intrusive_ptr.hpp index 7821b546..03ed1aa0 100644 --- a/src/kiwano/core/intrusive_ptr.hpp +++ b/src/kiwano/core/intrusive_ptr.hpp @@ -40,7 +40,7 @@ public: intrusive_ptr() noexcept {} - intrusive_ptr(nullptr_t) noexcept {} + intrusive_ptr(std::nullptr_t) noexcept {} intrusive_ptr(pointer_type p) noexcept : ptr_(p) { @@ -132,7 +132,7 @@ public: return *this; } - inline intrusive_ptr& operator =(nullptr_t) noexcept + inline intrusive_ptr& operator =(std::nullptr_t) noexcept { if (nullptr != ptr_) intrusive_ptr{}.swap(*this); @@ -186,25 +186,25 @@ inline bool operator!=(_Ty* lhs, intrusive_ptr<_Ty, manager_type> const& rhs) no } template -inline bool operator==(intrusive_ptr<_Ty, manager_type> const& lhs, nullptr_t) noexcept +inline bool operator==(intrusive_ptr<_Ty, manager_type> const& lhs, std::nullptr_t) noexcept { return !static_cast(lhs); } template -inline bool operator!=(intrusive_ptr<_Ty, manager_type> const& lhs, nullptr_t) noexcept +inline bool operator!=(intrusive_ptr<_Ty, manager_type> const& lhs, std::nullptr_t) noexcept { return static_cast(lhs); } template -inline bool operator==(nullptr_t, intrusive_ptr<_Ty, manager_type> const& rhs) noexcept +inline bool operator==(std::nullptr_t, intrusive_ptr<_Ty, manager_type> const& rhs) noexcept { return !static_cast(rhs); } template -inline bool operator!=(nullptr_t, intrusive_ptr<_Ty, manager_type> const& rhs) noexcept +inline bool operator!=(std::nullptr_t, intrusive_ptr<_Ty, manager_type> const& rhs) noexcept { return static_cast(rhs); } diff --git a/src/kiwano/core/string.hpp b/src/kiwano/core/string.hpp index 0fa07e09..df6eaa11 100644 --- a/src/kiwano/core/string.hpp +++ b/src/kiwano/core/string.hpp @@ -95,7 +95,7 @@ public: public: using value_type = _CharTy; using char_type = value_type; - using size_type = std::size_t; + using size_type = size_t; using reference = value_type &; using const_reference = const value_type &; using iterator = iterator_impl; @@ -1524,7 +1524,7 @@ namespace kiwano template class string_convert { - enum : std::size_t { BUFFER_INCREASE = 8, BUFFER_MAX = 16 }; + enum : size_t { BUFFER_INCREASE = 8, BUFFER_MAX = 16 }; public: using byte_string = ::kiwano::core::basic_string; @@ -1549,7 +1549,7 @@ public: virtual ~string_convert() { } - std::size_t converted() const noexcept { return conv_num_; } + size_t converted() const noexcept { return conv_num_; } state_type state() const { return state_; } @@ -1577,7 +1577,7 @@ public: state_ = state_type{}; wbuf.append(BUFFER_INCREASE, (_Elem) '\0'); - for (conv_num_ = 0; first != last; conv_num_ = static_cast(first - first_save)) + for (conv_num_ = 0; first != last; conv_num_ = static_cast(first - first_save)) { _Elem* dest = &*wbuf.begin(); _Elem* dnext; @@ -1589,7 +1589,7 @@ public: { if (dest < dnext) { - wstr.append(dest, static_cast(dnext - dest)); + wstr.append(dest, static_cast(dnext - dest)); } else if (wbuf.size() < BUFFER_MAX) { @@ -1645,7 +1645,7 @@ public: state_ = state_type{}; bbuf.append(BUFFER_INCREASE, '\0'); - for (conv_num_ = 0; first != last; conv_num_ = static_cast(first - first_save)) + for (conv_num_ = 0; first != last; conv_num_ = static_cast(first - first_save)) { char* dest = &*bbuf.begin(); char* dnext; @@ -1657,7 +1657,7 @@ public: { if (dest < dnext) { - bstr.append(dest, (std::size_t)(dnext - dest)); + bstr.append(dest, (size_t)(dnext - dest)); } else if (bbuf.size() < BUFFER_MAX) { @@ -1693,11 +1693,11 @@ private: const codecvt_type* cvt_; std::locale loc_; state_type state_; - std::size_t conv_num_; + size_t conv_num_; }; class chs_codecvt - : public std::codecvt_byname + : public std::codecvt_byname { public: chs_codecvt() : codecvt_byname("chs") {} @@ -1732,7 +1732,7 @@ namespace std template<> struct hash<::kiwano::core::string> { - inline std::size_t operator()(const ::kiwano::core::string& key) const + inline size_t operator()(const ::kiwano::core::string& key) const { return key.hash(); } @@ -1741,7 +1741,7 @@ namespace std template<> struct hash<::kiwano::core::wstring> { - inline std::size_t operator()(const ::kiwano::core::wstring& key) const + inline size_t operator()(const ::kiwano::core::wstring& key) const { return key.hash(); } diff --git a/src/kiwano/core/vector.hpp b/src/kiwano/core/vector.hpp index ccfb668a..8d3c0825 100644 --- a/src/kiwano/core/vector.hpp +++ b/src/kiwano/core/vector.hpp @@ -51,7 +51,7 @@ class vector { public: using value_type = _Ty; - using size_type = std::size_t; + using size_type = size_t; using iterator = value_type * ; using const_iterator = const value_type*; using reference = value_type & ; @@ -217,7 +217,7 @@ namespace __vector_details struct vector_memory_manager<_Ty, _Alloc, false> { using value_type = _Ty; - using size_type = std::size_t; + using size_type = size_t; using allocator_type = typename _Alloc; static void copy_data(value_type* dest, const value_type* src, size_type count) { if (src == dest) return; ::memcpy(dest, src, size_type(count) * sizeof(value_type)); } @@ -246,7 +246,7 @@ namespace __vector_details struct vector_memory_manager<_Ty, _Alloc, true> { using value_type = _Ty; - using size_type = std::size_t; + using size_type = size_t; using allocator_type = typename _Alloc; static void copy_data(value_type* dest, const value_type* src, size_type count) { if (src == dest) return; while (count--) (*dest++) = (*src++); } diff --git a/src/kiwano/math/Matrix.hpp b/src/kiwano/math/Matrix.hpp index bdba1898..28218570 100644 --- a/src/kiwano/math/Matrix.hpp +++ b/src/kiwano/math/Matrix.hpp @@ -91,12 +91,12 @@ namespace kiwano #pragma warning (pop) - inline value_type operator [](std::uint32_t index) const + inline value_type operator [](uint32_t index) const { return m[index]; } - inline value_type& operator [](std::uint32_t index) + inline value_type& operator [](uint32_t index) { return m[index]; } @@ -291,7 +291,7 @@ namespace kiwano , rhs(rhs) {} - inline _Ty operator [](std::uint32_t index) const + inline _Ty operator [](uint32_t index) const { switch (index) { diff --git a/src/kiwano/platform/Application.cpp b/src/kiwano/platform/Application.cpp index 9095b186..b88b3694 100644 --- a/src/kiwano/platform/Application.cpp +++ b/src/kiwano/platform/Application.cpp @@ -43,7 +43,7 @@ namespace kiwano Queue functions_to_perform_; } - Config::Config(String const& title, std::uint32_t width, std::uint32_t height, std::uint32_t icon) + Config::Config(String const& title, uint32_t width, uint32_t height, uint32_t icon) : debug(false) { window.title = title; diff --git a/src/kiwano/platform/Application.h b/src/kiwano/platform/Application.h index 9fc7a0e0..8322aac9 100644 --- a/src/kiwano/platform/Application.h +++ b/src/kiwano/platform/Application.h @@ -36,9 +36,9 @@ namespace kiwano Config( String const& title = L"Kiwano Game", - std::uint32_t width = 640, - std::uint32_t height = 480, - std::uint32_t icon = 0 + uint32_t width = 640, + uint32_t height = 480, + uint32_t icon = 0 ); Config( diff --git a/src/kiwano/renderer/Color.cpp b/src/kiwano/renderer/Color.cpp index 2e7a8a13..1ee7b1fa 100644 --- a/src/kiwano/renderer/Color.cpp +++ b/src/kiwano/renderer/Color.cpp @@ -24,13 +24,13 @@ namespace kiwano { namespace { - const std::uint32_t RED_SHIFT = 16; - const std::uint32_t GREEN_SHIFT = 8; - const std::uint32_t BLUE_SHIFT = 0; + const uint32_t RED_SHIFT = 16; + const uint32_t GREEN_SHIFT = 8; + const uint32_t BLUE_SHIFT = 0; - const std::uint32_t RED_MASK = 0xff << RED_SHIFT; - const std::uint32_t GREEN_MASK = 0xff << GREEN_SHIFT; - const std::uint32_t BLUE_MASK = 0xff << BLUE_SHIFT; + const uint32_t RED_MASK = 0xff << RED_SHIFT; + const uint32_t GREEN_MASK = 0xff << GREEN_SHIFT; + const uint32_t BLUE_MASK = 0xff << BLUE_SHIFT; } Color::Color() @@ -57,7 +57,7 @@ namespace kiwano { } - Color::Color(std::uint32_t rgb) + Color::Color(uint32_t rgb) : r(((rgb & RED_MASK) >> RED_SHIFT) / 255.f) , g(((rgb & GREEN_MASK) >> GREEN_SHIFT) / 255.f) , b(((rgb & BLUE_MASK) >> BLUE_SHIFT) / 255.f) @@ -65,7 +65,7 @@ namespace kiwano { } - Color::Color(std::uint32_t rgb, float alpha) + Color::Color(uint32_t rgb, float alpha) : r(((rgb & RED_MASK) >> RED_SHIFT) / 255.f) , g(((rgb & GREEN_MASK) >> GREEN_SHIFT) / 255.f) , b(((rgb & BLUE_MASK) >> BLUE_SHIFT) / 255.f) diff --git a/src/kiwano/renderer/Color.h b/src/kiwano/renderer/Color.h index 9abc9e25..94388912 100644 --- a/src/kiwano/renderer/Color.h +++ b/src/kiwano/renderer/Color.h @@ -29,7 +29,7 @@ namespace kiwano // 使用枚举表示颜色: Color blue = Color::Blue; // 使用 RGB 表示一个颜色: Color red(1.0f, 0.0f, 0.0f); // 使用 RGBA 表示一个带透明度的颜色: Color not_black(1.0f, 1.0f, 1.0f, 0.5f); - // 使用一个 std::uint32_t 类型的值表示 RGB: Color black(0x000000); + // 使用一个 uint32_t 类型的值表示 RGB: Color black(0x000000); // class KGE_API Color { @@ -50,11 +50,11 @@ namespace kiwano ); Color( - std::uint32_t rgb + uint32_t rgb ); Color( - std::uint32_t rgb, + uint32_t rgb, float alpha ); @@ -69,7 +69,7 @@ namespace kiwano } public: - enum Value : std::uint32_t + enum Value : uint32_t { Black = 0x000000, Blue = 0x0000FF, diff --git a/src/kiwano/renderer/Font.cpp b/src/kiwano/renderer/Font.cpp index 2f04b097..4a1508dc 100644 --- a/src/kiwano/renderer/Font.cpp +++ b/src/kiwano/renderer/Font.cpp @@ -22,7 +22,7 @@ namespace kiwano { - Font::Font(String const& family, float size, std::uint32_t weight, bool italic) + Font::Font(String const& family, float size, uint32_t weight, bool italic) : family(family) , size(size) , weight(weight) @@ -31,7 +31,7 @@ namespace kiwano { } - Font::Font(FontCollection collection, String const& family, float size, std::uint32_t weight, bool italic) + Font::Font(FontCollection collection, String const& family, float size, uint32_t weight, bool italic) : family(family) , size(size) , weight(weight) diff --git a/src/kiwano/renderer/Font.h b/src/kiwano/renderer/Font.h index cb74ab2b..16876b28 100644 --- a/src/kiwano/renderer/Font.h +++ b/src/kiwano/renderer/Font.h @@ -26,7 +26,7 @@ namespace kiwano // 字体粗细值 struct FontWeight { - enum Value : std::uint32_t + enum Value : uint32_t { Thin = 100U, ExtraLight = 200U, @@ -46,24 +46,24 @@ namespace kiwano public: String family; // 字体族 float size; // 字号 - std::uint32_t weight; // 粗细值 + uint32_t weight; // 粗细值 bool italic; // 是否斜体 FontCollection collection; // 字体集 public: Font( - String const& family = L"", - float size = 18, - std::uint32_t weight = FontWeight::Normal, - bool italic = false + String const& family = L"", + float size = 18, + uint32_t weight = FontWeight::Normal, + bool italic = false ); Font( - FontCollection collection, - String const& family = L"", - float size = 18, - std::uint32_t weight = FontWeight::Normal, - bool italic = false + FontCollection collection, + String const& family = L"", + float size = 18, + uint32_t weight = FontWeight::Normal, + bool italic = false ); }; } diff --git a/src/kiwano/renderer/Geometry.cpp b/src/kiwano/renderer/Geometry.cpp index 4faf2344..41bd7619 100644 --- a/src/kiwano/renderer/Geometry.cpp +++ b/src/kiwano/renderer/Geometry.cpp @@ -124,7 +124,7 @@ namespace kiwano sink.Init(); sink.OpenSink(); - for (std::size_t i = 0; i < geos.size() - 1; i++) + for (size_t i = 0; i < geos.size() - 1; i++) { CombineMode mode = (modes.size() == 1) ? modes[0] : modes[i]; const Matrix3x2& matrix = (matrixs.size() == 1) ? matrixs[0] : matrixs[i]; @@ -252,12 +252,12 @@ namespace kiwano sink_->AddLines( reinterpret_cast(&points[0]), - static_cast(points.size()) + static_cast(points.size()) ); return (*this); } - GeometrySink& kiwano::GeometrySink::AddLines(const Point* points, std::size_t count) + GeometrySink& kiwano::GeometrySink::AddLines(const Point* points, size_t count) { if (!sink_) BeginPath(); diff --git a/src/kiwano/renderer/Geometry.h b/src/kiwano/renderer/Geometry.h index ef9600c1..d166c297 100644 --- a/src/kiwano/renderer/Geometry.h +++ b/src/kiwano/renderer/Geometry.h @@ -157,7 +157,7 @@ namespace kiwano // 添加多条线段 GeometrySink& AddLines( const Point* points, - std::size_t count + size_t count ); // 添加一条三次方贝塞尔曲线 diff --git a/src/kiwano/renderer/GifImage.cpp b/src/kiwano/renderer/GifImage.cpp index cd171679..d2dffb9b 100644 --- a/src/kiwano/renderer/GifImage.cpp +++ b/src/kiwano/renderer/GifImage.cpp @@ -95,8 +95,8 @@ namespace kiwano if (SUCCEEDED(hr)) { - std::uint32_t width = 0; - std::uint32_t height = 0; + uint32_t width = 0; + uint32_t height = 0; PROPVARIANT prop_val; ::PropVariantInit(&prop_val); @@ -154,11 +154,11 @@ namespace kiwano if (pixel_asp_ratio > 1.f) { width_in_pixels_ = width; - height_in_pixels_ = static_cast(height / pixel_asp_ratio); + height_in_pixels_ = static_cast(height / pixel_asp_ratio); } else { - width_in_pixels_ = static_cast(width * pixel_asp_ratio); + width_in_pixels_ = static_cast(width * pixel_asp_ratio); height_in_pixels_ = height; } } diff --git a/src/kiwano/renderer/GifImage.h b/src/kiwano/renderer/GifImage.h index 5a7e0b27..e199f005 100644 --- a/src/kiwano/renderer/GifImage.h +++ b/src/kiwano/renderer/GifImage.h @@ -40,11 +40,11 @@ namespace kiwano bool IsValid() const; - inline std::uint32_t GetWidthInPixels() const { return width_in_pixels_; } + inline uint32_t GetWidthInPixels() const { return width_in_pixels_; } - inline std::uint32_t GetHeightInPixels() const { return height_in_pixels_; } + inline uint32_t GetHeightInPixels() const { return height_in_pixels_; } - inline std::uint32_t GetFramesCount() const { return frames_count_; } + inline uint32_t GetFramesCount() const { return frames_count_; } public: enum class DisposalType @@ -73,9 +73,9 @@ namespace kiwano HRESULT GetGlobalMetadata(); protected: - std::uint32_t frames_count_; - std::uint32_t width_in_pixels_; - std::uint32_t height_in_pixels_; + uint32_t frames_count_; + uint32_t width_in_pixels_; + uint32_t height_in_pixels_; ComPtr decoder_; }; diff --git a/src/kiwano/renderer/Renderer.cpp b/src/kiwano/renderer/Renderer.cpp index da1124c0..537f5f80 100644 --- a/src/kiwano/renderer/Renderer.cpp +++ b/src/kiwano/renderer/Renderer.cpp @@ -202,8 +202,8 @@ namespace kiwano { case WM_SIZE: { - std::uint32_t width = LOWORD(lparam); - std::uint32_t height = HIWORD(lparam); + uint32_t width = LOWORD(lparam); + uint32_t height = HIWORD(lparam); ResizeTarget(width, height); break; @@ -415,7 +415,7 @@ namespace kiwano } } - void Renderer::CreateGifImageFrame(GifImage::Frame& frame, GifImage const& gif, std::size_t frame_index) + void Renderer::CreateGifImageFrame(GifImage::Frame& frame, GifImage const& gif, size_t frame_index) { HRESULT hr = S_OK; if (!d2d_res_) @@ -538,7 +538,7 @@ namespace kiwano if (SUCCEEDED(hr)) { - std::uint32_t udelay = 0; + uint32_t udelay = 0; hr = UIntMult(prop_val.uiVal, 10, &udelay); if (SUCCEEDED(hr)) { @@ -609,7 +609,7 @@ namespace kiwano if (SUCCEEDED(hr)) { LPVOID collection_key = nullptr; - std::uint32_t collection_key_size = 0; + uint32_t collection_key_size = 0; hr = font_collection_loader_->AddFilePaths(full_paths, &collection_key, &collection_key_size); @@ -647,7 +647,7 @@ namespace kiwano if (SUCCEEDED(hr)) { LPVOID collection_key = nullptr; - std::uint32_t collection_key_size = 0; + uint32_t collection_key_size = 0; hr = res_font_collection_loader_->AddResources(res_arr, &collection_key, &collection_key_size); @@ -997,7 +997,7 @@ namespace kiwano clear_color_ = color; } - void Renderer::ResizeTarget(std::uint32_t width, std::uint32_t height) + void Renderer::ResizeTarget(uint32_t width, uint32_t height) { HRESULT hr = S_OK; if (!d3d_res_) diff --git a/src/kiwano/renderer/Renderer.h b/src/kiwano/renderer/Renderer.h index df37253a..7a6e6a79 100644 --- a/src/kiwano/renderer/Renderer.h +++ b/src/kiwano/renderer/Renderer.h @@ -96,7 +96,7 @@ namespace kiwano void CreateGifImageFrame( GifImage::Frame& frame, GifImage const& gif, - std::size_t frame_index + size_t frame_index ); void CreateFontCollection( @@ -206,7 +206,7 @@ namespace kiwano HRESULT HandleDeviceLost(); - void ResizeTarget(std::uint32_t width, std::uint32_t height); + void ResizeTarget(uint32_t width, uint32_t height); private: bool vsync_; diff --git a/src/kiwano/renderer/TextLayout.cpp b/src/kiwano/renderer/TextLayout.cpp index d868d48b..41495bfd 100644 --- a/src/kiwano/renderer/TextLayout.cpp +++ b/src/kiwano/renderer/TextLayout.cpp @@ -145,7 +145,7 @@ namespace kiwano ThrowIfFailed(hr); } - std::uint32_t TextLayout::GetLineCount() + uint32_t TextLayout::GetLineCount() { if (text_layout_) { diff --git a/src/kiwano/renderer/TextLayout.h b/src/kiwano/renderer/TextLayout.h index 32b06b7f..2a5e6d83 100644 --- a/src/kiwano/renderer/TextLayout.h +++ b/src/kiwano/renderer/TextLayout.h @@ -56,7 +56,7 @@ namespace kiwano void Update(String const& text, TextStyle const& style); - std::uint32_t GetLineCount(); + uint32_t GetLineCount(); Size GetLayoutSize() const; diff --git a/src/kiwano/renderer/Texture.cpp b/src/kiwano/renderer/Texture.cpp index 6d9b88b1..42481fa6 100644 --- a/src/kiwano/renderer/Texture.cpp +++ b/src/kiwano/renderer/Texture.cpp @@ -98,7 +98,7 @@ namespace kiwano return Size{}; } - std::uint32_t Texture::GetWidthInPixels() const + uint32_t Texture::GetWidthInPixels() const { if (bitmap_) { @@ -107,7 +107,7 @@ namespace kiwano return 0; } - std::uint32_t Texture::GetHeightInPixels() const + uint32_t Texture::GetHeightInPixels() const { if (bitmap_) { @@ -116,14 +116,14 @@ namespace kiwano return 0; } - math::Vec2T Texture::GetSizeInPixels() const + math::Vec2T Texture::GetSizeInPixels() const { if (bitmap_) { auto bitmap_size = bitmap_->GetPixelSize(); - return math::Vec2T{ bitmap_size.width, bitmap_size.height }; + return math::Vec2T{ bitmap_size.width, bitmap_size.height }; } - return math::Vec2T{}; + return math::Vec2T{}; } InterpolationMode Texture::GetBitmapInterpolationMode() const @@ -146,13 +146,13 @@ namespace kiwano if (IsValid() && copy_from.IsValid()) { HRESULT hr = bitmap_->CopyFromBitmap( - &D2D1::Point2U(std::uint32_t(dest_point.x), std::uint32_t(dest_point.y)), + &D2D1::Point2U(uint32_t(dest_point.x), uint32_t(dest_point.y)), copy_from.GetBitmap().get(), &D2D1::RectU( - std::uint32_t(src_rect.GetLeft()), - std::uint32_t(src_rect.GetTop()), - std::uint32_t(src_rect.GetRight()), - std::uint32_t(src_rect.GetBottom())) + uint32_t(src_rect.GetLeft()), + uint32_t(src_rect.GetTop()), + uint32_t(src_rect.GetRight()), + uint32_t(src_rect.GetBottom())) ); ThrowIfFailed(hr); diff --git a/src/kiwano/renderer/Texture.h b/src/kiwano/renderer/Texture.h index e81c7d4e..0054ae3a 100644 --- a/src/kiwano/renderer/Texture.h +++ b/src/kiwano/renderer/Texture.h @@ -77,13 +77,13 @@ namespace kiwano Size GetSize() const; // 获取像素宽度 - std::uint32_t GetWidthInPixels() const; + uint32_t GetWidthInPixels() const; // 获取像素高度 - std::uint32_t GetHeightInPixels() const; + uint32_t GetHeightInPixels() const; // 获取像素大小 - math::Vec2T GetSizeInPixels() const; + math::Vec2T GetSizeInPixels() const; // 获取像素插值方式 InterpolationMode GetBitmapInterpolationMode() const; diff --git a/src/kiwano/renderer/TextureCache.cpp b/src/kiwano/renderer/TextureCache.cpp index 3f2bc3e6..d69bb537 100644 --- a/src/kiwano/renderer/TextureCache.cpp +++ b/src/kiwano/renderer/TextureCache.cpp @@ -25,7 +25,7 @@ namespace kiwano { template - _Ty CreateOrGetCache(_CacheTy& cache, _PathTy const& path, std::size_t hash) + _Ty CreateOrGetCache(_CacheTy& cache, _PathTy const& path, size_t hash) { auto iter = cache.find(hash); if (iter != cache.end()) @@ -42,7 +42,7 @@ namespace kiwano } template - void RemoveCache(_CacheTy& cache, std::size_t hash) + void RemoveCache(_CacheTy& cache, size_t hash) { auto iter = cache.find(hash); if (iter != cache.end()) diff --git a/src/kiwano/renderer/TextureCache.h b/src/kiwano/renderer/TextureCache.h index 1c1db38b..d5fc996c 100644 --- a/src/kiwano/renderer/TextureCache.h +++ b/src/kiwano/renderer/TextureCache.h @@ -48,10 +48,10 @@ namespace kiwano virtual ~TextureCache(); protected: - using TextureMap = UnorderedMap; + using TextureMap = UnorderedMap; TextureMap texture_cache_; - using GifImageMap = UnorderedMap; + using GifImageMap = UnorderedMap; GifImageMap gif_texture_cache_; }; } diff --git a/src/kiwano/renderer/win32/D3D10DeviceResources.cpp b/src/kiwano/renderer/win32/D3D10DeviceResources.cpp index cfc5e43c..604d43ee 100644 --- a/src/kiwano/renderer/win32/D3D10DeviceResources.cpp +++ b/src/kiwano/renderer/win32/D3D10DeviceResources.cpp @@ -29,7 +29,7 @@ namespace kiwano namespace DX { - HRESULT CreateD3DDevice(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, std::uint32_t flags, ID3D10Device1 **device) + HRESULT CreateD3DDevice(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, uint32_t flags, ID3D10Device1 **device) { HRESULT hr = S_OK; @@ -42,7 +42,7 @@ namespace kiwano D3D10_FEATURE_LEVEL_9_1, }; - for (std::uint32_t level = 0; level < ARRAYSIZE(levels); level++) + for (uint32_t level = 0; level < ARRAYSIZE(levels); level++) { hr = D3D10CreateDevice1( adapter, @@ -215,7 +215,7 @@ namespace kiwano // This flag adds support for surfaces with a different color channel ordering // than the API default. It is required for compatibility with Direct2D. - std::uint32_t creation_flags = D3D10_CREATE_DEVICE_BGRA_SUPPORT; + uint32_t creation_flags = D3D10_CREATE_DEVICE_BGRA_SUPPORT; #if defined(KGE_DEBUG) && defined(KGE_ENABLE_DX_DEBUG) if (DX::SdkLayersAvailable()) @@ -383,8 +383,8 @@ namespace kiwano tex_desc.BindFlags = D3D10_BIND_DEPTH_STENCIL; tex_desc.CPUAccessFlags = 0; tex_desc.Format = DXGI_FORMAT_D16_UNORM; - tex_desc.Width = static_cast(output_size_.x); - tex_desc.Height = static_cast(output_size_.y); + tex_desc.Width = static_cast(output_size_.x); + tex_desc.Height = static_cast(output_size_.y); tex_desc.MipLevels = 1; tex_desc.MiscFlags = 0; tex_desc.SampleDesc.Count = 1; @@ -415,8 +415,8 @@ namespace kiwano { // Set a new viewport based on the new dimensions D3D10_VIEWPORT viewport; - viewport.Width = static_cast(output_size_.x); - viewport.Height = static_cast(output_size_.y); + viewport.Width = static_cast(output_size_.x); + viewport.Height = static_cast(output_size_.y); viewport.TopLeftX = 0; viewport.TopLeftY = 0; viewport.MinDepth = 0; diff --git a/src/kiwano/renderer/win32/D3D11DeviceResources.cpp b/src/kiwano/renderer/win32/D3D11DeviceResources.cpp index cd56ee6e..b2cf19b7 100644 --- a/src/kiwano/renderer/win32/D3D11DeviceResources.cpp +++ b/src/kiwano/renderer/win32/D3D11DeviceResources.cpp @@ -207,7 +207,7 @@ namespace kiwano // This flag adds support for surfaces with a different color channel ordering // than the API default. It is required for compatibility with Direct2D. - std::uint32_t creation_flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; + uint32_t creation_flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; #if defined(KGE_DEBUG) && defined(KGE_ENABLE_DX_DEBUG) if (DX::SdkLayersAvailable()) @@ -408,8 +408,8 @@ namespace kiwano CD3D11_TEXTURE2D_DESC tex_desc( DXGI_FORMAT_D24_UNORM_S8_UINT, - static_cast(output_size_.x), - static_cast(output_size_.y), + static_cast(output_size_.x), + static_cast(output_size_.y), 1, // This depth stencil view has only one texture. 1, // Use a single mipmap level. D3D11_BIND_DEPTH_STENCIL diff --git a/src/kiwano/renderer/win32/FontCollectionLoader.cpp b/src/kiwano/renderer/win32/FontCollectionLoader.cpp index b3fb9977..32788fba 100644 --- a/src/kiwano/renderer/win32/FontCollectionLoader.cpp +++ b/src/kiwano/renderer/win32/FontCollectionLoader.cpp @@ -40,7 +40,7 @@ namespace kiwano STDMETHOD(AddFilePaths)( Vector const& filePaths, _Out_ LPVOID* pCollectionKey, - _Out_ std::uint32_t* pCollectionKeySize + _Out_ uint32_t* pCollectionKeySize ); // IUnknown methods @@ -52,7 +52,7 @@ namespace kiwano virtual HRESULT STDMETHODCALLTYPE CreateEnumeratorFromKey( IDWriteFactory* pFactory, void const* collectionKey, - std::uint32_t collectionKeySize, + uint32_t collectionKeySize, _Out_ IDWriteFontFileEnumerator** fontFileEnumerator ); @@ -61,7 +61,7 @@ namespace kiwano typedef Vector FileCollection; Vector filePaths_; - Vector collectionKeys_; + Vector collectionKeys_; }; HRESULT IFontCollectionLoader::Create(_Out_ IFontCollectionLoader** ppCollectionLoader) @@ -90,7 +90,7 @@ namespace kiwano STDMETHODIMP FontCollectionLoader::AddFilePaths( Vector const& filePaths, _Out_ LPVOID* pCollectionKey, - _Out_ std::uint32_t* pCollectionKeySize + _Out_ uint32_t* pCollectionKeySize ) { if (!pCollectionKey || !pCollectionKeySize) @@ -100,7 +100,7 @@ namespace kiwano try { - std::size_t collectionKey = filePaths_.size(); + size_t collectionKey = filePaths_.size(); collectionKeys_.push_back(collectionKey); filePaths_.push_back(filePaths); @@ -150,13 +150,13 @@ namespace kiwano HRESULT STDMETHODCALLTYPE FontCollectionLoader::CreateEnumeratorFromKey( IDWriteFactory* pFactory, void const* collectionKey, - std::uint32_t collectionKeySize, + uint32_t collectionKeySize, _Out_ IDWriteFontFileEnumerator** fontFileEnumerator ) { HRESULT hr = S_OK; - if (collectionKey == NULL || collectionKeySize % sizeof(std::uint32_t) != 0) + if (collectionKey == NULL || collectionKeySize % sizeof(uint32_t) != 0) hr = E_INVALIDARG; if (SUCCEEDED(hr)) @@ -166,7 +166,7 @@ namespace kiwano if (SUCCEEDED(hr)) { - const std::uint32_t fileIndex = *static_cast(collectionKey); + const uint32_t fileIndex = *static_cast(collectionKey); hr = pEnumerator->SetFilePaths(filePaths_[fileIndex]); } @@ -220,7 +220,7 @@ namespace kiwano IDWriteFactory* pFactory_; IDWriteFontFile* currentFile_; Vector filePaths_; - std::uint32_t nextIndex_; + uint32_t nextIndex_; }; HRESULT IFontFileEnumerator::Create(_Out_ IFontFileEnumerator** ppEnumerator, IDWriteFactory* pFactory) @@ -372,7 +372,7 @@ namespace kiwano STDMETHOD(AddResources)( Vector const& resources, _Out_ LPVOID* pCollectionKey, - _Out_ std::uint32_t* pCollectionKeySize + _Out_ uint32_t* pCollectionKeySize ); // IUnknown methods @@ -384,7 +384,7 @@ namespace kiwano virtual HRESULT STDMETHODCALLTYPE CreateEnumeratorFromKey( IDWriteFactory* pFactory, void const* collectionKey, - std::uint32_t collectionKeySize, + uint32_t collectionKeySize, _Out_ IDWriteFontFileEnumerator** fontFileEnumerator ); @@ -394,7 +394,7 @@ namespace kiwano typedef Vector ResourceCollection; Vector resources_; - Vector collectionKeys_; + Vector collectionKeys_; }; HRESULT IResourceFontCollectionLoader::Create(_Out_ IResourceFontCollectionLoader** ppCollectionLoader, IDWriteFontFileLoader* pFileLoader) @@ -423,7 +423,7 @@ namespace kiwano STDMETHODIMP ResourceFontCollectionLoader::AddResources( Vector const& resources, _Out_ LPVOID* pCollectionKey, - _Out_ std::uint32_t* pCollectionKeySize + _Out_ uint32_t* pCollectionKeySize ) { if (!pCollectionKey || !pCollectionKeySize) @@ -433,7 +433,7 @@ namespace kiwano try { - std::size_t collectionKey = resources_.size(); + size_t collectionKey = resources_.size(); collectionKeys_.push_back(collectionKey); resources_.push_back(resources); @@ -483,7 +483,7 @@ namespace kiwano HRESULT STDMETHODCALLTYPE ResourceFontCollectionLoader::CreateEnumeratorFromKey( IDWriteFactory* pFactory, void const* collectionKey, - std::uint32_t collectionKeySize, + uint32_t collectionKeySize, _Out_ IDWriteFontFileEnumerator** fontFileEnumerator ) { @@ -499,7 +499,7 @@ namespace kiwano if (SUCCEEDED(hr)) { - const std::uint32_t resourceIndex = *static_cast(collectionKey); + const uint32_t resourceIndex = *static_cast(collectionKey); hr = pEnumerator->SetResources(resources_[resourceIndex]); } @@ -536,7 +536,7 @@ namespace kiwano // IDWriteFontFileLoader methods virtual HRESULT STDMETHODCALLTYPE CreateStreamFromKey( void const* fontFileReferenceKey, - std::uint32_t fontFileReferenceKeySize, + uint32_t fontFileReferenceKeySize, _Out_ IDWriteFontFileStream** fontFileStream ); @@ -597,7 +597,7 @@ namespace kiwano HRESULT STDMETHODCALLTYPE ResourceFontFileLoader::CreateStreamFromKey( void const* fontFileReferenceKey, - std::uint32_t fontFileReferenceKeySize, + uint32_t fontFileReferenceKeySize, _Out_ IDWriteFontFileStream** fontFileStream ) { @@ -668,7 +668,7 @@ namespace kiwano IDWriteFontFile* currentFile_; IDWriteFontFileLoader* pLoader_; Vector resources_; - std::uint32_t nextIndex_; + uint32_t nextIndex_; }; HRESULT IResourceFontFileEnumerator::Create(_Out_ IResourceFontFileEnumerator** ppEnumerator, IDWriteFactory* pFactory, IDWriteFontFileLoader* pFileLoader) @@ -948,7 +948,7 @@ namespace kiwano if (fileOffset <= resourceSize_ && fragmentSize <= resourceSize_ - fileOffset) { - *fragmentStart = static_cast(resourcePtr_) + static_cast(fileOffset); + *fragmentStart = static_cast(resourcePtr_) + static_cast(fileOffset); *fragmentContext = NULL; return S_OK; } diff --git a/src/kiwano/renderer/win32/FontCollectionLoader.h b/src/kiwano/renderer/win32/FontCollectionLoader.h index 3b3c2a94..77236a49 100644 --- a/src/kiwano/renderer/win32/FontCollectionLoader.h +++ b/src/kiwano/renderer/win32/FontCollectionLoader.h @@ -34,7 +34,7 @@ namespace kiwano STDMETHOD(AddFilePaths)( Vector const& filePaths, _Out_ LPVOID * pCollectionKey, - _Out_ std::uint32_t * pCollectionKeySize + _Out_ uint32_t * pCollectionKeySize ) PURE; }; @@ -66,7 +66,7 @@ namespace kiwano STDMETHOD(AddResources)( Vector const& resources, _Out_ LPVOID * pCollectionKey, - _Out_ std::uint32_t * pCollectionKeySize + _Out_ uint32_t * pCollectionKeySize ) PURE; }; diff --git a/src/kiwano/ui/Menu.cpp b/src/kiwano/ui/Menu.cpp index a6327b66..d18531d6 100644 --- a/src/kiwano/ui/Menu.cpp +++ b/src/kiwano/ui/Menu.cpp @@ -41,7 +41,7 @@ namespace kiwano return enabled_; } - std::size_t Menu::GetButtonCount() const + size_t Menu::GetButtonCount() const { return buttons_.size(); } diff --git a/src/kiwano/ui/Menu.h b/src/kiwano/ui/Menu.h index 1ebe74c7..609610a7 100644 --- a/src/kiwano/ui/Menu.h +++ b/src/kiwano/ui/Menu.h @@ -38,7 +38,7 @@ namespace kiwano bool IsEnable() const; // 获取菜单中的按钮数量 - std::size_t GetButtonCount() const; + size_t GetButtonCount() const; // 设置菜单启用或禁用 void SetEnabled( diff --git a/src/kiwano/utils/ResourceCache.cpp b/src/kiwano/utils/ResourceCache.cpp index 728ff1ca..b87e13ea 100644 --- a/src/kiwano/utils/ResourceCache.cpp +++ b/src/kiwano/utils/ResourceCache.cpp @@ -198,7 +198,7 @@ namespace kiwano return false; } - std::size_t ResourceCache::AddFrameSequence(String const& id, Vector const& files) + size_t ResourceCache::AddFrameSequence(String const& id, Vector const& files) { if (files.empty()) return 0; @@ -226,7 +226,7 @@ namespace kiwano return 0; } - std::size_t ResourceCache::AddFrameSequence(String const & id, String const& file_path, int cols, int rows, float padding_x, float padding_y) + size_t ResourceCache::AddFrameSequence(String const & id, String const& file_path, int cols, int rows, float padding_x, float padding_y) { if (cols <= 0 || rows <= 0) return 0; @@ -264,7 +264,7 @@ namespace kiwano return AddFrameSequence(id, fs); } - std::size_t ResourceCache::AddFrameSequence(String const & id, FrameSequencePtr frames) + size_t ResourceCache::AddFrameSequence(String const & id, FrameSequencePtr frames) { if (frames) { diff --git a/src/kiwano/utils/ResourceCache.h b/src/kiwano/utils/ResourceCache.h index cb28ae7b..c6967f25 100644 --- a/src/kiwano/utils/ResourceCache.h +++ b/src/kiwano/utils/ResourceCache.h @@ -53,14 +53,14 @@ namespace kiwano bool AddFrame(String const& id, FramePtr frame); // 添加序列帧 - std::size_t AddFrameSequence(String const& id, Vector const& files); + size_t AddFrameSequence(String const& id, Vector const& files); // 添加序列帧 // 按行列数裁剪图片 - std::size_t AddFrameSequence(String const& id, String const& file_path, int cols, int rows = 1, float padding_x = 0, float padding_y = 0); + size_t AddFrameSequence(String const& id, String const& file_path, int cols, int rows = 1, float padding_x = 0, float padding_y = 0); // 添加序列帧 - std::size_t AddFrameSequence(String const& id, FrameSequencePtr frames); + size_t AddFrameSequence(String const& id, FrameSequencePtr frames); // 添加对象 bool AddObjectBase(String const& id, ObjectBasePtr obj);