This commit is contained in:
Nomango 2019-10-12 11:26:41 +08:00
parent 15a9a98a20
commit ee2854b3fe
61 changed files with 264 additions and 264 deletions

View File

@ -141,7 +141,7 @@ namespace kiwano
buffer.pAudioData = wave_buffer.data; buffer.pAudioData = wave_buffer.data;
buffer.Flags = XAUDIO2_END_OF_STREAM; buffer.Flags = XAUDIO2_END_OF_STREAM;
buffer.AudioBytes = wave_buffer.size; buffer.AudioBytes = wave_buffer.size;
buffer.LoopCount = static_cast<std::uint32_t>(loop_count); buffer.LoopCount = static_cast<uint32_t>(loop_count);
HRESULT hr = voice_->SubmitSourceBuffer(&buffer); HRESULT hr = voice_->SubmitSourceBuffer(&buffer);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
@ -214,7 +214,7 @@ namespace kiwano
XAUDIO2_VOICE_STATE state; XAUDIO2_VOICE_STATE state;
voice_->GetState(&state); voice_->GetState(&state);
std::uint32_t buffers_queued = state.BuffersQueued; uint32_t buffers_queued = state.BuffersQueued;
if (buffers_queued && playing_) if (buffers_queued && playing_)
return true; return true;

View File

@ -34,7 +34,7 @@ namespace kiwano
ClearCache(); ClearCache();
} }
std::size_t SoundPlayer::Load(String const& file_path) size_t SoundPlayer::Load(String const& file_path)
{ {
int hash_code = static_cast<int>(file_path.hash()); int hash_code = static_cast<int>(file_path.hash());
if (sound_cache_.end() != sound_cache_.find(hash_code)) if (sound_cache_.end() != sound_cache_.find(hash_code))
@ -54,9 +54,9 @@ namespace kiwano
return 0; return 0;
} }
std::size_t SoundPlayer::Load(Resource const& res) size_t SoundPlayer::Load(Resource const& res)
{ {
std::size_t hash_code = static_cast<std::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))
return hash_code; return hash_code;
@ -74,35 +74,35 @@ namespace kiwano
return 0; 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); auto iter = sound_cache_.find(id);
if (sound_cache_.end() != iter) if (sound_cache_.end() != iter)
iter->second->Play(loop_count); iter->second->Play(loop_count);
} }
void SoundPlayer::Pause(std::size_t id) void SoundPlayer::Pause(size_t id)
{ {
auto iter = sound_cache_.find(id); auto iter = sound_cache_.find(id);
if (sound_cache_.end() != iter) if (sound_cache_.end() != iter)
iter->second->Pause(); iter->second->Pause();
} }
void SoundPlayer::Resume(std::size_t id) void SoundPlayer::Resume(size_t id)
{ {
auto iter = sound_cache_.find(id); auto iter = sound_cache_.find(id);
if (sound_cache_.end() != iter) if (sound_cache_.end() != iter)
iter->second->Resume(); iter->second->Resume();
} }
void SoundPlayer::Stop(std::size_t id) void SoundPlayer::Stop(size_t id)
{ {
auto iter = sound_cache_.find(id); auto iter = sound_cache_.find(id);
if (sound_cache_.end() != iter) if (sound_cache_.end() != iter)
iter->second->Stop(); iter->second->Stop();
} }
bool SoundPlayer::IsPlaying(std::size_t id) bool SoundPlayer::IsPlaying(size_t id)
{ {
auto iter = sound_cache_.find(id); auto iter = sound_cache_.find(id);
if (sound_cache_.end() != iter) if (sound_cache_.end() != iter)

View File

@ -39,39 +39,39 @@ namespace kiwano
~SoundPlayer(); ~SoundPlayer();
// 加载本地音频文件, 返回该资源的标识符 // 加载本地音频文件, 返回该资源的标识符
std::size_t Load( size_t Load(
String const& file_path String const& file_path
); );
// 加载音乐资源, 返回该资源的标识符 // 加载音乐资源, 返回该资源的标识符
std::size_t Load( size_t Load(
Resource const& res /* 音乐资源 */ Resource const& res /* 音乐资源 */
); );
// 播放音乐 // 播放音乐
void Play( void Play(
std::size_t id, /* ±êʶ·û */ size_t id, /* ±êʶ·û */
int loop_count = 0 /* 播放循环次数 (-1 为循环播放) */ int loop_count = 0 /* 播放循环次数 (-1 为循环播放) */
); );
// 暂停音乐 // 暂停音乐
void Pause( void Pause(
std::size_t id /* ±êʶ·û */ size_t id /* ±êʶ·û */
); );
// 继续播放音乐 // 继续播放音乐
void Resume( void Resume(
std::size_t id /* ±êʶ·û */ size_t id /* ±êʶ·û */
); );
// 停止音乐 // 停止音乐
void Stop( void Stop(
std::size_t id /* ±êʶ·û */ size_t id /* ±êʶ·û */
); );
// 获取音乐播放状态 // 获取音乐播放状态
bool IsPlaying( bool IsPlaying(
std::size_t id /* ±êʶ·û */ size_t id /* ±êʶ·û */
); );
// 获取音量 // 获取音量
@ -97,7 +97,7 @@ namespace kiwano
protected: protected:
float volume_; float volume_;
using SoundMap = Map<std::size_t, SoundPtr>; using SoundMap = Map<size_t, SoundPtr>;
SoundMap sound_cache_; SoundMap sound_cache_;
}; };
} }

View File

@ -103,7 +103,7 @@ namespace kiwano
stream = kiwano::modules::Shlwapi::Get().SHCreateMemStream( stream = kiwano::modules::Shlwapi::Get().SHCreateMemStream(
static_cast<const BYTE*>(data.buffer), static_cast<const BYTE*>(data.buffer),
static_cast<std::uint32_t>(data.size) static_cast<uint32_t>(data.size)
); );
if (stream == nullptr) if (stream == nullptr)
@ -185,7 +185,7 @@ namespace kiwano
// 获取 WAVEFORMAT 数据 // 获取 WAVEFORMAT 数据
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
std::uint32_t size = 0; uint32_t size = 0;
hr = modules::MediaFoundation::Get().MFCreateWaveFormatExFromMFMediaType( hr = modules::MediaFoundation::Get().MFCreateWaveFormatExFromMFMediaType(
uncompressed_type.get(), uncompressed_type.get(),
&wave_format_, &wave_format_,

View File

@ -35,7 +35,7 @@ namespace kiwano
struct Buffer struct Buffer
{ {
BYTE* data; BYTE* data;
std::uint32_t size; uint32_t size;
const WAVEFORMATEX* format; const WAVEFORMATEX* format;
}; };
@ -61,7 +61,7 @@ namespace kiwano
private: private:
BYTE* wave_data_; BYTE* wave_data_;
std::uint32_t wave_size_; uint32_t wave_size_;
WAVEFORMATEX* wave_format_; WAVEFORMATEX* wave_format_;
}; };
} }

View File

@ -119,7 +119,7 @@ namespace kiwano
Render(); 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) if (ImGui::GetCurrentContext() == NULL)
return; return;
@ -185,7 +185,7 @@ namespace kiwano
case WM_CHAR: case WM_CHAR:
{ {
// You can also use ToAscii()+GetKeyboardState() to retrieve characters. // You can also use ToAscii()+GetKeyboardState() to retrieve characters.
io.AddInputCharacter((std::uint32_t)wparam); io.AddInputCharacter((uint32_t)wparam);
break; break;
} }
case WM_SETCURSOR: case WM_SETCURSOR:
@ -198,7 +198,7 @@ namespace kiwano
} }
case WM_DEVICECHANGE: case WM_DEVICECHANGE:
{ {
if ((std::uint32_t)wparam == DBT_DEVNODES_CHANGED) if ((uint32_t)wparam == DBT_DEVNODES_CHANGED)
want_update_has_gamepad_ = true; want_update_has_gamepad_ = true;
break; break;
} }

View File

@ -54,7 +54,7 @@ namespace kiwano
void AfterRender() override; 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(); void UpdateMousePos();

View File

@ -34,10 +34,10 @@ namespace
using namespace kiwano; using namespace kiwano;
using namespace kiwano::network; 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; 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 // add data to the end of recv_buffer
// write data maybe called more than once in a single request // write data maybe called more than once in a single request

View File

@ -502,7 +502,7 @@ namespace kiwano
Vector<ActorPtr> Actor::GetChildren(String const& name) const Vector<ActorPtr> Actor::GetChildren(String const& name) const
{ {
Vector<ActorPtr> children; Vector<ActorPtr> children;
std::size_t hash_code = std::hash<String>{}(name); size_t hash_code = std::hash<String>{}(name);
for (Actor* child = children_.first_item().get(); child; child = child->next_item().get()) 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 ActorPtr Actor::GetChild(String const& name) const
{ {
std::size_t hash_code = std::hash<String>{}(name); size_t hash_code = std::hash<String>{}(name);
for (Actor* child = children_.first_item().get(); child; child = child->next_item().get()) for (Actor* child = children_.first_item().get(); child; child = child->next_item().get())
{ {
@ -568,7 +568,7 @@ namespace kiwano
return; return;
} }
std::size_t hash_code = std::hash<String>{}(child_name); size_t hash_code = std::hash<String>{}(child_name);
Actor* next; Actor* next;
for (Actor* child = children_.first_item().get(); child; child = next) for (Actor* child = children_.first_item().get(); child; child = next)

View File

@ -64,7 +64,7 @@ namespace kiwano
bool IsCascadeOpacityEnabled() const { return cascade_opacity_; } bool IsCascadeOpacityEnabled() const { return cascade_opacity_; }
// 获取名称的 Hash 值 // 获取名称的 Hash 值
std::size_t GetHashName() const { return hash_name_; } size_t GetHashName() const { return hash_name_; }
// 获取 Z 轴顺序 // 获取 Z 轴顺序
int GetZOrder() const { return z_order_; } int GetZOrder() const { return z_order_; }
@ -413,7 +413,7 @@ namespace kiwano
float displayed_opacity_; float displayed_opacity_;
Actor* parent_; Actor* parent_;
Stage* stage_; Stage* stage_;
std::size_t hash_name_; size_t hash_name_;
Point anchor_; Point anchor_;
Size size_; Size size_;
Children children_; Children children_;

View File

@ -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()); KGE_ASSERT(index < frames_.size());
return frames_[index]; return frames_[index];

View File

@ -47,7 +47,7 @@ namespace kiwano
); );
// 获取关键帧 // 获取关键帧
FramePtr GetFrame(std::size_t index) const; FramePtr GetFrame(size_t index) const;
// 获取关键帧 // 获取关键帧
Vector<FramePtr> const& GetFrames() const; Vector<FramePtr> const& GetFrames() const;

View File

@ -106,7 +106,7 @@ namespace kiwano
bool animating_; bool animating_;
int total_loop_count_; int total_loop_count_;
int loop_count_; int loop_count_;
std::size_t next_index_; size_t next_index_;
Duration frame_elapsed_; Duration frame_elapsed_;
LoopDoneCallback loop_cb_; LoopDoneCallback loop_cb_;
DoneCallback done_cb_; DoneCallback done_cb_;

View File

@ -112,7 +112,7 @@ namespace kiwano
} }
} }
void Text::SetFontWeight(std::uint32_t weight) void Text::SetFontWeight(uint32_t weight)
{ {
if (font_.weight != weight) if (font_.weight != weight)
{ {

View File

@ -92,7 +92,7 @@ namespace kiwano
// 设置字体粗细值(默认值为 FontWeight::Normal // 设置字体粗细值(默认值为 FontWeight::Normal
void SetFontWeight( void SetFontWeight(
std::uint32_t weight uint32_t weight
); );
// 设置文字颜色(默认值为 Color::White // 设置文字颜色(默认值为 Color::White

View File

@ -76,7 +76,7 @@ namespace kiwano
{ {
const auto& frames = frame_seq_->GetFrames(); const auto& frames = frame_seq_->GetFrames();
auto size = frames.size(); auto size = frames.size();
auto index = std::min(static_cast<std::size_t>(math::Floor(size * percent)), size - 1); auto index = std::min(static_cast<size_t>(math::Floor(size * percent)), size - 1);
sprite_target->SetFrame(frames[index]); sprite_target->SetFrame(frames[index]);
} }

View File

@ -51,7 +51,7 @@ namespace kiwano
return listener.get(); 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); EventListenerPtr listener = new EventListener(type, callback, name);
return AddListener(listener); 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()) 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()) 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; EventListenerPtr next;
for (auto listener = listeners_.first_item(); listener; listener = next) for (auto listener = listeners_.first_item(); listener; listener = next)

View File

@ -35,8 +35,8 @@ namespace kiwano
// 添加监听器 // 添加监听器
EventListener* AddListener( EventListener* AddListener(
std::uint32_t type, EventType type,
EventCallback callback, EventListener::Callback callback,
String const& name = L"" String const& name = L""
); );
@ -57,17 +57,17 @@ namespace kiwano
// 启动监听器 // 启动监听器
void StartListeners( void StartListeners(
std::uint32_t type uint32_t type
); );
// 停止监听器 // 停止监听器
void StopListeners( void StopListeners(
std::uint32_t type uint32_t type
); );
// 移除监听器 // 移除监听器
void RemoveListeners( void RemoveListeners(
std::uint32_t type uint32_t type
); );
virtual void Dispatch(Event& evt); virtual void Dispatch(Event& evt);

View File

@ -23,7 +23,7 @@
namespace kiwano 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) : type_(type)
, callback_(callback) , callback_(callback)
, running_(true) , running_(true)

View File

@ -26,8 +26,6 @@
namespace kiwano namespace kiwano
{ {
typedef Function<void(Event const&)> EventCallback;
class EventDispatcher; class EventDispatcher;
KGE_DECLARE_SMART_PTR(EventListener); KGE_DECLARE_SMART_PTR(EventListener);
@ -41,9 +39,11 @@ namespace kiwano
friend class intrusive_list<EventListenerPtr>; friend class intrusive_list<EventListenerPtr>;
public: public:
using Callback = Function<void(Event const&)>;
EventListener( EventListener(
std::uint32_t type, EventType type,
EventCallback const& callback, Callback const& callback,
String const& name = L"" String const& name = L""
); );
@ -57,7 +57,7 @@ namespace kiwano
protected: protected:
bool running_; bool running_;
std::uint32_t type_; EventType type_;
EventCallback callback_; Callback callback_;
}; };
} }

View File

@ -298,7 +298,7 @@ namespace kiwano
std::wostream& Logger::OutPrefix(std::wostream& out) std::wostream& Logger::OutPrefix(std::wostream& out)
{ {
std::time_t unix = std::time(nullptr); time_t unix = std::time(nullptr);
std::tm tmbuf; std::tm tmbuf;
localtime_s(&tmbuf, &unix); localtime_s(&tmbuf, &unix);
out << std::put_time(&tmbuf, L"[kiwano] %H:%M:%S"); out << std::put_time(&tmbuf, L"[kiwano] %H:%M:%S");

View File

@ -30,7 +30,7 @@ namespace kiwano
Vector<ObjectBase*> tracing_objects; Vector<ObjectBase*> tracing_objects;
} }
std::uint32_t ObjectBase::last_object_id = 0; uint32_t ObjectBase::last_object_id = 0;
ObjectBase::ObjectBase() ObjectBase::ObjectBase()
: tracing_leak_(false) : tracing_leak_(false)

View File

@ -48,7 +48,7 @@ namespace kiwano
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: public:
static bool IsTracingLeaks(); static bool IsTracingLeaks();
@ -71,7 +71,7 @@ namespace kiwano
void* user_data_; void* user_data_;
String* name_; String* name_;
const std::uint32_t id_; const uint32_t id_;
static std::uint32_t last_object_id; static uint32_t last_object_id;
}; };
} }

View File

@ -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) : id_(id)
, type_(type) , type_(type)
{ {
@ -76,7 +76,7 @@ namespace kiwano
} }
data_.buffer = static_cast<void*>(buffer); data_.buffer = static_cast<void*>(buffer);
data_.size = static_cast<std::uint32_t>(size); data_.size = static_cast<uint32_t>(size);
} while (0); } while (0);
return data_; return data_;

View File

@ -39,7 +39,7 @@ namespace kiwano
struct Data struct Data
{ {
void* buffer; void* buffer;
std::uint32_t size; uint32_t size;
inline Data() : buffer(nullptr), size(0) {} inline Data() : buffer(nullptr), size(0) {}
@ -49,19 +49,19 @@ namespace kiwano
Resource(); Resource();
Resource( Resource(
std::uint32_t id, /* ×ÊÔ´ ID */ uint32_t id, /* ×ÊÔ´ ID */
const wchar_t* type /* 资源类型 */ const wchar_t* type /* 资源类型 */
); );
// 获取二进制数据 // 获取二进制数据
Resource::Data GetData() const; 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_; } inline const wchar_t* GetType() const { return type_; }
private: private:
std::uint32_t id_; uint32_t id_;
const wchar_t* type_; const wchar_t* type_;
mutable Resource::Data data_; mutable Resource::Data data_;

View File

@ -33,14 +33,14 @@ namespace kiwano
{ {
MONITORINFOEX GetMoniterInfoEx(HWND hwnd); 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 ChangeFullScreenResolution(int width, int height, WCHAR* device_name);
void RestoreResolution(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) : title(title)
, width(width) , width(width)
, height(height) , height(height)
@ -114,11 +114,11 @@ namespace kiwano
// Save the device name // Save the device name
int len = lstrlenW(monitor_info_ex.szDevice); 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); lstrcpyW(device_name_, monitor_info_ex.szDevice);
std::uint32_t width = config.width; uint32_t width = config.width;
std::uint32_t height = config.height; uint32_t height = config.height;
int left = -1; int left = -1;
int top = -1; int top = -1;
@ -130,18 +130,18 @@ namespace kiwano
top = monitor_info_ex.rcMonitor.top; top = monitor_info_ex.rcMonitor.top;
left = monitor_info_ex.rcMonitor.left; left = monitor_info_ex.rcMonitor.left;
if (width > static_cast<std::uint32_t>(monitor_info_ex.rcWork.right - left)) if (width > static_cast<uint32_t>(monitor_info_ex.rcWork.right - left))
width = static_cast<std::uint32_t>(monitor_info_ex.rcWork.right - left); width = static_cast<uint32_t>(monitor_info_ex.rcWork.right - left);
if (height > static_cast<std::uint32_t>(monitor_info_ex.rcWork.bottom - top)) if (height > static_cast<uint32_t>(monitor_info_ex.rcWork.bottom - top))
height = static_cast<std::uint32_t>(monitor_info_ex.rcWork.bottom - top); height = static_cast<uint32_t>(monitor_info_ex.rcWork.bottom - top);
} }
else else
{ {
std::uint32_t screenw = monitor_info_ex.rcWork.right - monitor_info_ex.rcWork.left; 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 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( AdjustWindow(
width, width,
height, height,
@ -242,7 +242,7 @@ namespace kiwano
return static_cast<float>(height_); return static_cast<float>(height_);
} }
void Window::SetIcon(std::uint32_t icon_resource) void Window::SetIcon(uint32_t icon_resource)
{ {
if (handle_) if (handle_)
{ {
@ -301,10 +301,10 @@ namespace kiwano
MONITORINFOEX info = GetMoniterInfoEx(handle_); MONITORINFOEX info = GetMoniterInfoEx(handle_);
std::uint32_t screenw = info.rcWork.right - info.rcWork.left; uint32_t screenw = info.rcWork.right - info.rcWork.left;
std::uint32_t screenh = info.rcWork.bottom - info.rcWork.top; 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); AdjustWindow(width, height, GetWindowStyle(), &win_width, &win_height);
int left = screenw > win_width ? ((screenw - win_width) / 2) : 0; int left = screenw > win_width ? ((screenw - win_width) / 2) : 0;
@ -402,7 +402,7 @@ namespace kiwano
return monitor_info; 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; RECT rc;
::SetRect(&rc, 0, 0, (int)width, (int)height); ::SetRect(&rc, 0, 0, (int)width, (int)height);
@ -413,8 +413,8 @@ namespace kiwano
MONITORINFOEX info = GetMoniterInfoEx(NULL); MONITORINFOEX info = GetMoniterInfoEx(NULL);
std::uint32_t screenw = info.rcWork.right - info.rcWork.left; uint32_t screenw = info.rcWork.right - info.rcWork.left;
std::uint32_t screenh = info.rcWork.bottom - info.rcWork.top; uint32_t screenh = info.rcWork.bottom - info.rcWork.top;
if (*win_width > screenw) if (*win_width > screenw)
*win_width = screenw; *win_width = screenw;

View File

@ -42,17 +42,17 @@ namespace kiwano
struct WindowConfig struct WindowConfig
{ {
String title; // 标题 String title; // 标题
std::uint32_t width; // 宽度 uint32_t width; // 宽度
std::uint32_t height; // 高度 uint32_t height; // 高度
std::uint32_t icon; // 图标资源 ID uint32_t icon; // 图标资源 ID
bool resizable; // 窗口大小可拉伸 bool resizable; // 窗口大小可拉伸
bool fullscreen; // 全屏模式 bool fullscreen; // 全屏模式
WindowConfig( WindowConfig(
String const& title = L"Kiwano Game", String const& title = L"Kiwano Game",
std::uint32_t width = 640, uint32_t width = 640,
std::uint32_t height = 480, uint32_t height = 480,
std::uint32_t icon = 0, uint32_t icon = 0,
bool resizable = false, bool resizable = false,
bool fullscreen = false bool fullscreen = false
); );
@ -82,7 +82,7 @@ namespace kiwano
void SetTitle(String const& title); void SetTitle(String const& title);
// 设置窗口图标 // 设置窗口图标
void SetIcon(std::uint32_t icon_resource); void SetIcon(uint32_t icon_resource);
// 重设窗口大小 // 重设窗口大小
void Resize(int width, int height); void Resize(int width, int height);
@ -121,7 +121,7 @@ namespace kiwano
HWND handle_; HWND handle_;
int width_; int width_;
int height_; int height_;
WCHAR* device_name_; wchar_t* device_name_;
CursorType mouse_cursor_; CursorType mouse_cursor_;
}; };
} }

View File

@ -359,8 +359,8 @@ namespace kiwano
Duration Duration::Parse(const String& str) Duration Duration::Parse(const String& str)
{ {
bool negative = false; bool negative = false;
std::size_t len = str.length(); size_t len = str.length();
std::size_t pos = 0; size_t pos = 0;
Duration ret; Duration ret;
if (!std::regex_match(str.c_str(), duration_regex)) if (!std::regex_match(str.c_str(), duration_regex))
@ -381,7 +381,7 @@ namespace kiwano
while (pos < len) while (pos < len)
{ {
// ÊýÖµ // ÊýÖµ
std::size_t i = pos; size_t i = pos;
for (; i < len; ++i) for (; i < len; ++i)
{ {
wchar_t ch = str[i]; wchar_t ch = str[i];

View File

@ -355,7 +355,7 @@ namespace __json_detail
struct primitive_iterator struct primitive_iterator
{ {
using difference_type = std::ptrdiff_t; using difference_type = ptrdiff_t;
inline primitive_iterator(difference_type it = 0) : it_(it) {} inline primitive_iterator(difference_type it = 0) : it_(it) {}
@ -403,7 +403,7 @@ namespace __json_detail
using object_type = typename _BasicJsonTy::object_type; using object_type = typename _BasicJsonTy::object_type;
using value_type = _BasicJsonTy; using value_type = _BasicJsonTy;
using difference_type = std::ptrdiff_t; using difference_type = ptrdiff_t;
using iterator_category = std::bidirectional_iterator_tag; using iterator_category = std::bidirectional_iterator_tag;
using pointer = value_type*; using pointer = value_type*;
using reference = value_type&; using reference = value_type&;
@ -731,11 +731,11 @@ namespace __json_detail
using char_traits = std::char_traits<char_type>; using char_traits = std::char_traits<char_type>;
virtual void write(const _CharTy ch) = 0; 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) virtual void write(const _CharTy* str)
{ {
const auto size = char_traits::length(str); const auto size = char_traits::length(str);
write(str, static_cast<std::uint32_t>(size)); write(str, static_cast<uint32_t>(size));
} }
}; };
@ -754,7 +754,7 @@ namespace __json_detail
str_.push_back(ch); 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_type>(size)); str_.append(str, static_cast<size_type>(size));
} }
@ -778,7 +778,7 @@ namespace __json_detail
stream_.put(ch); 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_type>(size)); stream_.write(str, static_cast<size_type>(size));
} }
@ -815,8 +815,8 @@ namespace __json_detail
void dump( void dump(
const _BasicJsonTy& json, const _BasicJsonTy& json,
const bool pretty_print, const bool pretty_print,
const std::uint32_t indent_step, const uint32_t indent_step,
const std::uint32_t current_indent = 0) const uint32_t current_indent = 0)
{ {
switch (json.type()) switch (json.type())
{ {
@ -842,7 +842,7 @@ namespace __json_detail
auto iter = object.cbegin(); auto iter = object.cbegin();
const auto size = object.size(); 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(indent_string.c_str(), new_indent);
out->write('\"'); out->write('\"');
@ -865,7 +865,7 @@ namespace __json_detail
auto iter = object.cbegin(); auto iter = object.cbegin();
const auto size = object.size(); 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('\"');
out->write(iter->first.c_str()); out->write(iter->first.c_str());
@ -905,7 +905,7 @@ namespace __json_detail
auto iter = vector.cbegin(); auto iter = vector.cbegin();
const auto size = vector.size(); 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); out->write(indent_string.c_str(), new_indent);
dump(*iter, true, indent_step, new_indent); dump(*iter, true, indent_step, new_indent);
@ -925,7 +925,7 @@ namespace __json_detail
auto iter = vector.cbegin(); auto iter = vector.cbegin();
const auto size = vector.size(); 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); dump(*iter, false, indent_step, current_indent);
// not last element // not last element
@ -1015,7 +1015,7 @@ namespace __json_detail
if (len) if (len)
{ {
number_buffer[0] = '\0'; 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 else
{ {
@ -1204,7 +1204,7 @@ namespace __json_detail
private: private:
const char_type* str; const char_type* str;
std::uint32_t index; uint32_t index;
}; };
} // end of namespace __json_detail } // end of namespace __json_detail
@ -1338,7 +1338,7 @@ namespace __json_detail
token_type scan_literal(const char_type* text, token_type result) 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)) if (text[i] != char_traits::to_char_type(current))
{ {
@ -1613,10 +1613,10 @@ namespace __json_detail
read_next(); read_next();
} }
std::uint32_t exponent = static_cast<std::uint32_t>(current - '0'); uint32_t exponent = static_cast<uint32_t>(current - '0');
while (std::isdigit(read_next())) while (std::isdigit(read_next()))
{ {
exponent = (exponent * 10) + static_cast<std::uint32_t>(current - '0'); exponent = (exponent * 10) + static_cast<uint32_t>(current - '0');
} }
float_type power = 1; float_type power = 1;
@ -1858,8 +1858,8 @@ class basic_json
public: public:
template <typename _Ty> template <typename _Ty>
using allocator_type = _Allocator<_Ty>; using allocator_type = _Allocator<_Ty>;
using size_type = std::size_t; using size_type = size_t;
using difference_type = std::ptrdiff_t; using difference_type = ptrdiff_t;
using string_type = _StringTy; using string_type = _StringTy;
using char_type = typename _StringTy::value_type; using char_type = typename _StringTy::value_type;
using integer_type = _IntegerTy; using integer_type = _IntegerTy;
@ -2544,7 +2544,7 @@ public:
out.width(0); out.width(0);
__json_detail::stream_output_adapter<char_type> adapter(out); __json_detail::stream_output_adapter<char_type> adapter(out);
__json_detail::json_serializer<basic_json>(&adapter, out.fill()).dump(json, pretty_print, static_cast<std::uint32_t>(indentation)); __json_detail::json_serializer<basic_json>(&adapter, out.fill()).dump(json, pretty_print, static_cast<uint32_t>(indentation));
return out; return out;
} }
@ -2565,7 +2565,7 @@ public:
{ {
if (indent >= 0) if (indent >= 0)
{ {
__json_detail::json_serializer<basic_json>(adapter, indent_char).dump(*this, true, static_cast<std::uint32_t>(indent)); __json_detail::json_serializer<basic_json>(adapter, indent_char).dump(*this, true, static_cast<uint32_t>(indent));
} }
else else
{ {

View File

@ -78,7 +78,7 @@ namespace std
template<> template<>
struct hash<::kiwano::Json> 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()); return hash<::kiwano::Json::string_type>{}(json.dump());
} }

View File

@ -219,7 +219,7 @@ public:
{ {
} }
function(::std::nullptr_t) function(std::nullptr_t)
: callable_(nullptr) : callable_(nullptr)
{ {
} }

View File

@ -40,7 +40,7 @@ public:
intrusive_ptr() noexcept {} intrusive_ptr() noexcept {}
intrusive_ptr(nullptr_t) noexcept {} intrusive_ptr(std::nullptr_t) noexcept {}
intrusive_ptr(pointer_type p) noexcept : ptr_(p) intrusive_ptr(pointer_type p) noexcept : ptr_(p)
{ {
@ -132,7 +132,7 @@ public:
return *this; return *this;
} }
inline intrusive_ptr& operator =(nullptr_t) noexcept inline intrusive_ptr& operator =(std::nullptr_t) noexcept
{ {
if (nullptr != ptr_) if (nullptr != ptr_)
intrusive_ptr{}.swap(*this); intrusive_ptr{}.swap(*this);
@ -186,25 +186,25 @@ inline bool operator!=(_Ty* lhs, intrusive_ptr<_Ty, manager_type> const& rhs) no
} }
template <class _Ty, class manager_type> template <class _Ty, class manager_type>
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<bool>(lhs); return !static_cast<bool>(lhs);
} }
template <class _Ty, class manager_type> template <class _Ty, class manager_type>
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<bool>(lhs); return static_cast<bool>(lhs);
} }
template <class _Ty, class manager_type> template <class _Ty, class manager_type>
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<bool>(rhs); return !static_cast<bool>(rhs);
} }
template <class _Ty, class manager_type> template <class _Ty, class manager_type>
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<bool>(rhs); return static_cast<bool>(rhs);
} }

View File

@ -95,7 +95,7 @@ public:
public: public:
using value_type = _CharTy; using value_type = _CharTy;
using char_type = value_type; using char_type = value_type;
using size_type = std::size_t; using size_type = size_t;
using reference = value_type &; using reference = value_type &;
using const_reference = const value_type &; using const_reference = const value_type &;
using iterator = iterator_impl<value_type>; using iterator = iterator_impl<value_type>;
@ -1524,7 +1524,7 @@ namespace kiwano
template <typename _Codecvt, typename _Elem = wchar_t> template <typename _Codecvt, typename _Elem = wchar_t>
class string_convert class string_convert
{ {
enum : std::size_t { BUFFER_INCREASE = 8, BUFFER_MAX = 16 }; enum : size_t { BUFFER_INCREASE = 8, BUFFER_MAX = 16 };
public: public:
using byte_string = ::kiwano::core::basic_string<char>; using byte_string = ::kiwano::core::basic_string<char>;
@ -1549,7 +1549,7 @@ public:
virtual ~string_convert() { } 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_; } state_type state() const { return state_; }
@ -1577,7 +1577,7 @@ public:
state_ = state_type{}; state_ = state_type{};
wbuf.append(BUFFER_INCREASE, (_Elem) '\0'); wbuf.append(BUFFER_INCREASE, (_Elem) '\0');
for (conv_num_ = 0; first != last; conv_num_ = static_cast<std::size_t>(first - first_save)) for (conv_num_ = 0; first != last; conv_num_ = static_cast<size_t>(first - first_save))
{ {
_Elem* dest = &*wbuf.begin(); _Elem* dest = &*wbuf.begin();
_Elem* dnext; _Elem* dnext;
@ -1589,7 +1589,7 @@ public:
{ {
if (dest < dnext) if (dest < dnext)
{ {
wstr.append(dest, static_cast<std::size_t>(dnext - dest)); wstr.append(dest, static_cast<size_t>(dnext - dest));
} }
else if (wbuf.size() < BUFFER_MAX) else if (wbuf.size() < BUFFER_MAX)
{ {
@ -1645,7 +1645,7 @@ public:
state_ = state_type{}; state_ = state_type{};
bbuf.append(BUFFER_INCREASE, '\0'); bbuf.append(BUFFER_INCREASE, '\0');
for (conv_num_ = 0; first != last; conv_num_ = static_cast<std::size_t>(first - first_save)) for (conv_num_ = 0; first != last; conv_num_ = static_cast<size_t>(first - first_save))
{ {
char* dest = &*bbuf.begin(); char* dest = &*bbuf.begin();
char* dnext; char* dnext;
@ -1657,7 +1657,7 @@ public:
{ {
if (dest < dnext) if (dest < dnext)
{ {
bstr.append(dest, (std::size_t)(dnext - dest)); bstr.append(dest, (size_t)(dnext - dest));
} }
else if (bbuf.size() < BUFFER_MAX) else if (bbuf.size() < BUFFER_MAX)
{ {
@ -1693,11 +1693,11 @@ private:
const codecvt_type* cvt_; const codecvt_type* cvt_;
std::locale loc_; std::locale loc_;
state_type state_; state_type state_;
std::size_t conv_num_; size_t conv_num_;
}; };
class chs_codecvt class chs_codecvt
: public std::codecvt_byname<wchar_t, char, std::mbstate_t> : public std::codecvt_byname<wchar_t, char, mbstate_t>
{ {
public: public:
chs_codecvt() : codecvt_byname("chs") {} chs_codecvt() : codecvt_byname("chs") {}
@ -1732,7 +1732,7 @@ namespace std
template<> template<>
struct hash<::kiwano::core::string> 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(); return key.hash();
} }
@ -1741,7 +1741,7 @@ namespace std
template<> template<>
struct hash<::kiwano::core::wstring> 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(); return key.hash();
} }

View File

@ -51,7 +51,7 @@ class vector
{ {
public: public:
using value_type = _Ty; using value_type = _Ty;
using size_type = std::size_t; using size_type = size_t;
using iterator = value_type * ; using iterator = value_type * ;
using const_iterator = const value_type*; using const_iterator = const value_type*;
using reference = value_type & ; using reference = value_type & ;
@ -217,7 +217,7 @@ namespace __vector_details
struct vector_memory_manager<_Ty, _Alloc, false> struct vector_memory_manager<_Ty, _Alloc, false>
{ {
using value_type = _Ty; using value_type = _Ty;
using size_type = std::size_t; using size_type = size_t;
using allocator_type = typename _Alloc; 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)); } 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> struct vector_memory_manager<_Ty, _Alloc, true>
{ {
using value_type = _Ty; using value_type = _Ty;
using size_type = std::size_t; using size_type = size_t;
using allocator_type = typename _Alloc; 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++); } static void copy_data(value_type* dest, const value_type* src, size_type count) { if (src == dest) return; while (count--) (*dest++) = (*src++); }

View File

@ -91,12 +91,12 @@ namespace kiwano
#pragma warning (pop) #pragma warning (pop)
inline value_type operator [](std::uint32_t index) const inline value_type operator [](uint32_t index) const
{ {
return m[index]; return m[index];
} }
inline value_type& operator [](std::uint32_t index) inline value_type& operator [](uint32_t index)
{ {
return m[index]; return m[index];
} }
@ -291,7 +291,7 @@ namespace kiwano
, rhs(rhs) , rhs(rhs)
{} {}
inline _Ty operator [](std::uint32_t index) const inline _Ty operator [](uint32_t index) const
{ {
switch (index) switch (index)
{ {

View File

@ -43,7 +43,7 @@ namespace kiwano
Queue<FunctionToPerform> functions_to_perform_; Queue<FunctionToPerform> 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) : debug(false)
{ {
window.title = title; window.title = title;

View File

@ -36,9 +36,9 @@ namespace kiwano
Config( Config(
String const& title = L"Kiwano Game", String const& title = L"Kiwano Game",
std::uint32_t width = 640, uint32_t width = 640,
std::uint32_t height = 480, uint32_t height = 480,
std::uint32_t icon = 0 uint32_t icon = 0
); );
Config( Config(

View File

@ -24,13 +24,13 @@ namespace kiwano
{ {
namespace namespace
{ {
const std::uint32_t RED_SHIFT = 16; const uint32_t RED_SHIFT = 16;
const std::uint32_t GREEN_SHIFT = 8; const uint32_t GREEN_SHIFT = 8;
const std::uint32_t BLUE_SHIFT = 0; const uint32_t BLUE_SHIFT = 0;
const std::uint32_t RED_MASK = 0xff << RED_SHIFT; const uint32_t RED_MASK = 0xff << RED_SHIFT;
const std::uint32_t GREEN_MASK = 0xff << GREEN_SHIFT; const uint32_t GREEN_MASK = 0xff << GREEN_SHIFT;
const std::uint32_t BLUE_MASK = 0xff << BLUE_SHIFT; const uint32_t BLUE_MASK = 0xff << BLUE_SHIFT;
} }
Color::Color() 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) : r(((rgb & RED_MASK) >> RED_SHIFT) / 255.f)
, g(((rgb & GREEN_MASK) >> GREEN_SHIFT) / 255.f) , g(((rgb & GREEN_MASK) >> GREEN_SHIFT) / 255.f)
, b(((rgb & BLUE_MASK) >> BLUE_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) : r(((rgb & RED_MASK) >> RED_SHIFT) / 255.f)
, g(((rgb & GREEN_MASK) >> GREEN_SHIFT) / 255.f) , g(((rgb & GREEN_MASK) >> GREEN_SHIFT) / 255.f)
, b(((rgb & BLUE_MASK) >> BLUE_SHIFT) / 255.f) , b(((rgb & BLUE_MASK) >> BLUE_SHIFT) / 255.f)

View File

@ -29,7 +29,7 @@ namespace kiwano
// 使用枚举表示颜色: Color blue = Color::Blue; // 使用枚举表示颜色: Color blue = Color::Blue;
// 使用 RGB 表示一个颜色: Color red(1.0f, 0.0f, 0.0f); // 使用 RGB 表示一个颜色: Color red(1.0f, 0.0f, 0.0f);
// 使用 RGBA 表示一个带透明度的颜色: Color not_black(1.0f, 1.0f, 1.0f, 0.5f); // 使用 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 class KGE_API Color
{ {
@ -50,11 +50,11 @@ namespace kiwano
); );
Color( Color(
std::uint32_t rgb uint32_t rgb
); );
Color( Color(
std::uint32_t rgb, uint32_t rgb,
float alpha float alpha
); );
@ -69,7 +69,7 @@ namespace kiwano
} }
public: public:
enum Value : std::uint32_t enum Value : uint32_t
{ {
Black = 0x000000, Black = 0x000000,
Blue = 0x0000FF, Blue = 0x0000FF,

View File

@ -22,7 +22,7 @@
namespace kiwano 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) : family(family)
, size(size) , size(size)
, weight(weight) , 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) : family(family)
, size(size) , size(size)
, weight(weight) , weight(weight)

View File

@ -26,7 +26,7 @@ namespace kiwano
// 字体粗细值 // 字体粗细值
struct FontWeight struct FontWeight
{ {
enum Value : std::uint32_t enum Value : uint32_t
{ {
Thin = 100U, Thin = 100U,
ExtraLight = 200U, ExtraLight = 200U,
@ -46,7 +46,7 @@ namespace kiwano
public: public:
String family; // 字体族 String family; // 字体族
float size; // 字号 float size; // 字号
std::uint32_t weight; // ´Öϸֵ uint32_t weight; // ´Öϸֵ
bool italic; // 是否斜体 bool italic; // 是否斜体
FontCollection collection; // 字体集 FontCollection collection; // 字体集
@ -54,7 +54,7 @@ namespace kiwano
Font( Font(
String const& family = L"", String const& family = L"",
float size = 18, float size = 18,
std::uint32_t weight = FontWeight::Normal, uint32_t weight = FontWeight::Normal,
bool italic = false bool italic = false
); );
@ -62,7 +62,7 @@ namespace kiwano
FontCollection collection, FontCollection collection,
String const& family = L"", String const& family = L"",
float size = 18, float size = 18,
std::uint32_t weight = FontWeight::Normal, uint32_t weight = FontWeight::Normal,
bool italic = false bool italic = false
); );
}; };

View File

@ -124,7 +124,7 @@ namespace kiwano
sink.Init(); sink.Init();
sink.OpenSink(); 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]; CombineMode mode = (modes.size() == 1) ? modes[0] : modes[i];
const Matrix3x2& matrix = (matrixs.size() == 1) ? matrixs[0] : matrixs[i]; const Matrix3x2& matrix = (matrixs.size() == 1) ? matrixs[0] : matrixs[i];
@ -252,12 +252,12 @@ namespace kiwano
sink_->AddLines( sink_->AddLines(
reinterpret_cast<const D2D_POINT_2F*>(&points[0]), reinterpret_cast<const D2D_POINT_2F*>(&points[0]),
static_cast<std::uint32_t>(points.size()) static_cast<uint32_t>(points.size())
); );
return (*this); 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(); if (!sink_) BeginPath();

View File

@ -157,7 +157,7 @@ namespace kiwano
// 添加多条线段 // 添加多条线段
GeometrySink& AddLines( GeometrySink& AddLines(
const Point* points, const Point* points,
std::size_t count size_t count
); );
// 添加一条三次方贝塞尔曲线 // 添加一条三次方贝塞尔曲线

View File

@ -95,8 +95,8 @@ namespace kiwano
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
std::uint32_t width = 0; uint32_t width = 0;
std::uint32_t height = 0; uint32_t height = 0;
PROPVARIANT prop_val; PROPVARIANT prop_val;
::PropVariantInit(&prop_val); ::PropVariantInit(&prop_val);
@ -154,11 +154,11 @@ namespace kiwano
if (pixel_asp_ratio > 1.f) if (pixel_asp_ratio > 1.f)
{ {
width_in_pixels_ = width; width_in_pixels_ = width;
height_in_pixels_ = static_cast<std::uint32_t>(height / pixel_asp_ratio); height_in_pixels_ = static_cast<uint32_t>(height / pixel_asp_ratio);
} }
else else
{ {
width_in_pixels_ = static_cast<std::uint32_t>(width * pixel_asp_ratio); width_in_pixels_ = static_cast<uint32_t>(width * pixel_asp_ratio);
height_in_pixels_ = height; height_in_pixels_ = height;
} }
} }

View File

@ -40,11 +40,11 @@ namespace kiwano
bool IsValid() const; 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: public:
enum class DisposalType enum class DisposalType
@ -73,9 +73,9 @@ namespace kiwano
HRESULT GetGlobalMetadata(); HRESULT GetGlobalMetadata();
protected: protected:
std::uint32_t frames_count_; uint32_t frames_count_;
std::uint32_t width_in_pixels_; uint32_t width_in_pixels_;
std::uint32_t height_in_pixels_; uint32_t height_in_pixels_;
ComPtr<IWICBitmapDecoder> decoder_; ComPtr<IWICBitmapDecoder> decoder_;
}; };

View File

@ -202,8 +202,8 @@ namespace kiwano
{ {
case WM_SIZE: case WM_SIZE:
{ {
std::uint32_t width = LOWORD(lparam); uint32_t width = LOWORD(lparam);
std::uint32_t height = HIWORD(lparam); uint32_t height = HIWORD(lparam);
ResizeTarget(width, height); ResizeTarget(width, height);
break; 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; HRESULT hr = S_OK;
if (!d2d_res_) if (!d2d_res_)
@ -538,7 +538,7 @@ namespace kiwano
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
std::uint32_t udelay = 0; uint32_t udelay = 0;
hr = UIntMult(prop_val.uiVal, 10, &udelay); hr = UIntMult(prop_val.uiVal, 10, &udelay);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
@ -609,7 +609,7 @@ namespace kiwano
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
LPVOID collection_key = nullptr; 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); hr = font_collection_loader_->AddFilePaths(full_paths, &collection_key, &collection_key_size);
@ -647,7 +647,7 @@ namespace kiwano
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
LPVOID collection_key = nullptr; 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); hr = res_font_collection_loader_->AddResources(res_arr, &collection_key, &collection_key_size);
@ -997,7 +997,7 @@ namespace kiwano
clear_color_ = color; 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; HRESULT hr = S_OK;
if (!d3d_res_) if (!d3d_res_)

View File

@ -96,7 +96,7 @@ namespace kiwano
void CreateGifImageFrame( void CreateGifImageFrame(
GifImage::Frame& frame, GifImage::Frame& frame,
GifImage const& gif, GifImage const& gif,
std::size_t frame_index size_t frame_index
); );
void CreateFontCollection( void CreateFontCollection(
@ -206,7 +206,7 @@ namespace kiwano
HRESULT HandleDeviceLost(); HRESULT HandleDeviceLost();
void ResizeTarget(std::uint32_t width, std::uint32_t height); void ResizeTarget(uint32_t width, uint32_t height);
private: private:
bool vsync_; bool vsync_;

View File

@ -145,7 +145,7 @@ namespace kiwano
ThrowIfFailed(hr); ThrowIfFailed(hr);
} }
std::uint32_t TextLayout::GetLineCount() uint32_t TextLayout::GetLineCount()
{ {
if (text_layout_) if (text_layout_)
{ {

View File

@ -56,7 +56,7 @@ namespace kiwano
void Update(String const& text, TextStyle const& style); void Update(String const& text, TextStyle const& style);
std::uint32_t GetLineCount(); uint32_t GetLineCount();
Size GetLayoutSize() const; Size GetLayoutSize() const;

View File

@ -98,7 +98,7 @@ namespace kiwano
return Size{}; return Size{};
} }
std::uint32_t Texture::GetWidthInPixels() const uint32_t Texture::GetWidthInPixels() const
{ {
if (bitmap_) if (bitmap_)
{ {
@ -107,7 +107,7 @@ namespace kiwano
return 0; return 0;
} }
std::uint32_t Texture::GetHeightInPixels() const uint32_t Texture::GetHeightInPixels() const
{ {
if (bitmap_) if (bitmap_)
{ {
@ -116,14 +116,14 @@ namespace kiwano
return 0; return 0;
} }
math::Vec2T<std::uint32_t> Texture::GetSizeInPixels() const math::Vec2T<uint32_t> Texture::GetSizeInPixels() const
{ {
if (bitmap_) if (bitmap_)
{ {
auto bitmap_size = bitmap_->GetPixelSize(); auto bitmap_size = bitmap_->GetPixelSize();
return math::Vec2T<std::uint32_t>{ bitmap_size.width, bitmap_size.height }; return math::Vec2T<uint32_t>{ bitmap_size.width, bitmap_size.height };
} }
return math::Vec2T<std::uint32_t>{}; return math::Vec2T<uint32_t>{};
} }
InterpolationMode Texture::GetBitmapInterpolationMode() const InterpolationMode Texture::GetBitmapInterpolationMode() const
@ -146,13 +146,13 @@ namespace kiwano
if (IsValid() && copy_from.IsValid()) if (IsValid() && copy_from.IsValid())
{ {
HRESULT hr = bitmap_->CopyFromBitmap( 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(), copy_from.GetBitmap().get(),
&D2D1::RectU( &D2D1::RectU(
std::uint32_t(src_rect.GetLeft()), uint32_t(src_rect.GetLeft()),
std::uint32_t(src_rect.GetTop()), uint32_t(src_rect.GetTop()),
std::uint32_t(src_rect.GetRight()), uint32_t(src_rect.GetRight()),
std::uint32_t(src_rect.GetBottom())) uint32_t(src_rect.GetBottom()))
); );
ThrowIfFailed(hr); ThrowIfFailed(hr);

View File

@ -77,13 +77,13 @@ namespace kiwano
Size GetSize() const; Size GetSize() const;
// 获取像素宽度 // 获取像素宽度
std::uint32_t GetWidthInPixels() const; uint32_t GetWidthInPixels() const;
// 获取像素高度 // 获取像素高度
std::uint32_t GetHeightInPixels() const; uint32_t GetHeightInPixels() const;
// 获取像素大小 // 获取像素大小
math::Vec2T<std::uint32_t> GetSizeInPixels() const; math::Vec2T<uint32_t> GetSizeInPixels() const;
// 获取像素插值方式 // 获取像素插值方式
InterpolationMode GetBitmapInterpolationMode() const; InterpolationMode GetBitmapInterpolationMode() const;

View File

@ -25,7 +25,7 @@
namespace kiwano namespace kiwano
{ {
template <typename _Ty, typename _PathTy, typename _CacheTy> template <typename _Ty, typename _PathTy, typename _CacheTy>
_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); auto iter = cache.find(hash);
if (iter != cache.end()) if (iter != cache.end())
@ -42,7 +42,7 @@ namespace kiwano
} }
template <typename _CacheTy> template <typename _CacheTy>
void RemoveCache(_CacheTy& cache, std::size_t hash) void RemoveCache(_CacheTy& cache, size_t hash)
{ {
auto iter = cache.find(hash); auto iter = cache.find(hash);
if (iter != cache.end()) if (iter != cache.end())

View File

@ -48,10 +48,10 @@ namespace kiwano
virtual ~TextureCache(); virtual ~TextureCache();
protected: protected:
using TextureMap = UnorderedMap<std::size_t, Texture>; using TextureMap = UnorderedMap<size_t, Texture>;
TextureMap texture_cache_; TextureMap texture_cache_;
using GifImageMap = UnorderedMap<std::size_t, GifImage>; using GifImageMap = UnorderedMap<size_t, GifImage>;
GifImageMap gif_texture_cache_; GifImageMap gif_texture_cache_;
}; };
} }

View File

@ -29,7 +29,7 @@ namespace kiwano
namespace DX 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; HRESULT hr = S_OK;
@ -42,7 +42,7 @@ namespace kiwano
D3D10_FEATURE_LEVEL_9_1, 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( hr = D3D10CreateDevice1(
adapter, adapter,
@ -215,7 +215,7 @@ namespace kiwano
// This flag adds support for surfaces with a different color channel ordering // This flag adds support for surfaces with a different color channel ordering
// than the API default. It is required for compatibility with Direct2D. // 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 defined(KGE_DEBUG) && defined(KGE_ENABLE_DX_DEBUG)
if (DX::SdkLayersAvailable()) if (DX::SdkLayersAvailable())
@ -383,8 +383,8 @@ namespace kiwano
tex_desc.BindFlags = D3D10_BIND_DEPTH_STENCIL; tex_desc.BindFlags = D3D10_BIND_DEPTH_STENCIL;
tex_desc.CPUAccessFlags = 0; tex_desc.CPUAccessFlags = 0;
tex_desc.Format = DXGI_FORMAT_D16_UNORM; tex_desc.Format = DXGI_FORMAT_D16_UNORM;
tex_desc.Width = static_cast<std::uint32_t>(output_size_.x); tex_desc.Width = static_cast<uint32_t>(output_size_.x);
tex_desc.Height = static_cast<std::uint32_t>(output_size_.y); tex_desc.Height = static_cast<uint32_t>(output_size_.y);
tex_desc.MipLevels = 1; tex_desc.MipLevels = 1;
tex_desc.MiscFlags = 0; tex_desc.MiscFlags = 0;
tex_desc.SampleDesc.Count = 1; tex_desc.SampleDesc.Count = 1;
@ -415,8 +415,8 @@ namespace kiwano
{ {
// Set a new viewport based on the new dimensions // Set a new viewport based on the new dimensions
D3D10_VIEWPORT viewport; D3D10_VIEWPORT viewport;
viewport.Width = static_cast<std::uint32_t>(output_size_.x); viewport.Width = static_cast<uint32_t>(output_size_.x);
viewport.Height = static_cast<std::uint32_t>(output_size_.y); viewport.Height = static_cast<uint32_t>(output_size_.y);
viewport.TopLeftX = 0; viewport.TopLeftX = 0;
viewport.TopLeftY = 0; viewport.TopLeftY = 0;
viewport.MinDepth = 0; viewport.MinDepth = 0;

View File

@ -207,7 +207,7 @@ namespace kiwano
// This flag adds support for surfaces with a different color channel ordering // This flag adds support for surfaces with a different color channel ordering
// than the API default. It is required for compatibility with Direct2D. // 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 defined(KGE_DEBUG) && defined(KGE_ENABLE_DX_DEBUG)
if (DX::SdkLayersAvailable()) if (DX::SdkLayersAvailable())
@ -408,8 +408,8 @@ namespace kiwano
CD3D11_TEXTURE2D_DESC tex_desc( CD3D11_TEXTURE2D_DESC tex_desc(
DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_D24_UNORM_S8_UINT,
static_cast<std::uint32_t>(output_size_.x), static_cast<uint32_t>(output_size_.x),
static_cast<std::uint32_t>(output_size_.y), static_cast<uint32_t>(output_size_.y),
1, // This depth stencil view has only one texture. 1, // This depth stencil view has only one texture.
1, // Use a single mipmap level. 1, // Use a single mipmap level.
D3D11_BIND_DEPTH_STENCIL D3D11_BIND_DEPTH_STENCIL

View File

@ -40,7 +40,7 @@ namespace kiwano
STDMETHOD(AddFilePaths)( STDMETHOD(AddFilePaths)(
Vector<String> const& filePaths, Vector<String> const& filePaths,
_Out_ LPVOID* pCollectionKey, _Out_ LPVOID* pCollectionKey,
_Out_ std::uint32_t* pCollectionKeySize _Out_ uint32_t* pCollectionKeySize
); );
// IUnknown methods // IUnknown methods
@ -52,7 +52,7 @@ namespace kiwano
virtual HRESULT STDMETHODCALLTYPE CreateEnumeratorFromKey( virtual HRESULT STDMETHODCALLTYPE CreateEnumeratorFromKey(
IDWriteFactory* pFactory, IDWriteFactory* pFactory,
void const* collectionKey, void const* collectionKey,
std::uint32_t collectionKeySize, uint32_t collectionKeySize,
_Out_ IDWriteFontFileEnumerator** fontFileEnumerator _Out_ IDWriteFontFileEnumerator** fontFileEnumerator
); );
@ -61,7 +61,7 @@ namespace kiwano
typedef Vector<String> FileCollection; typedef Vector<String> FileCollection;
Vector<FileCollection> filePaths_; Vector<FileCollection> filePaths_;
Vector<std::size_t> collectionKeys_; Vector<size_t> collectionKeys_;
}; };
HRESULT IFontCollectionLoader::Create(_Out_ IFontCollectionLoader** ppCollectionLoader) HRESULT IFontCollectionLoader::Create(_Out_ IFontCollectionLoader** ppCollectionLoader)
@ -90,7 +90,7 @@ namespace kiwano
STDMETHODIMP FontCollectionLoader::AddFilePaths( STDMETHODIMP FontCollectionLoader::AddFilePaths(
Vector<String> const& filePaths, Vector<String> const& filePaths,
_Out_ LPVOID* pCollectionKey, _Out_ LPVOID* pCollectionKey,
_Out_ std::uint32_t* pCollectionKeySize _Out_ uint32_t* pCollectionKeySize
) )
{ {
if (!pCollectionKey || !pCollectionKeySize) if (!pCollectionKey || !pCollectionKeySize)
@ -100,7 +100,7 @@ namespace kiwano
try try
{ {
std::size_t collectionKey = filePaths_.size(); size_t collectionKey = filePaths_.size();
collectionKeys_.push_back(collectionKey); collectionKeys_.push_back(collectionKey);
filePaths_.push_back(filePaths); filePaths_.push_back(filePaths);
@ -150,13 +150,13 @@ namespace kiwano
HRESULT STDMETHODCALLTYPE FontCollectionLoader::CreateEnumeratorFromKey( HRESULT STDMETHODCALLTYPE FontCollectionLoader::CreateEnumeratorFromKey(
IDWriteFactory* pFactory, IDWriteFactory* pFactory,
void const* collectionKey, void const* collectionKey,
std::uint32_t collectionKeySize, uint32_t collectionKeySize,
_Out_ IDWriteFontFileEnumerator** fontFileEnumerator _Out_ IDWriteFontFileEnumerator** fontFileEnumerator
) )
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (collectionKey == NULL || collectionKeySize % sizeof(std::uint32_t) != 0) if (collectionKey == NULL || collectionKeySize % sizeof(uint32_t) != 0)
hr = E_INVALIDARG; hr = E_INVALIDARG;
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
@ -166,7 +166,7 @@ namespace kiwano
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
const std::uint32_t fileIndex = *static_cast<std::uint32_t const*>(collectionKey); const uint32_t fileIndex = *static_cast<uint32_t const*>(collectionKey);
hr = pEnumerator->SetFilePaths(filePaths_[fileIndex]); hr = pEnumerator->SetFilePaths(filePaths_[fileIndex]);
} }
@ -220,7 +220,7 @@ namespace kiwano
IDWriteFactory* pFactory_; IDWriteFactory* pFactory_;
IDWriteFontFile* currentFile_; IDWriteFontFile* currentFile_;
Vector<String> filePaths_; Vector<String> filePaths_;
std::uint32_t nextIndex_; uint32_t nextIndex_;
}; };
HRESULT IFontFileEnumerator::Create(_Out_ IFontFileEnumerator** ppEnumerator, IDWriteFactory* pFactory) HRESULT IFontFileEnumerator::Create(_Out_ IFontFileEnumerator** ppEnumerator, IDWriteFactory* pFactory)
@ -372,7 +372,7 @@ namespace kiwano
STDMETHOD(AddResources)( STDMETHOD(AddResources)(
Vector<Resource> const& resources, Vector<Resource> const& resources,
_Out_ LPVOID* pCollectionKey, _Out_ LPVOID* pCollectionKey,
_Out_ std::uint32_t* pCollectionKeySize _Out_ uint32_t* pCollectionKeySize
); );
// IUnknown methods // IUnknown methods
@ -384,7 +384,7 @@ namespace kiwano
virtual HRESULT STDMETHODCALLTYPE CreateEnumeratorFromKey( virtual HRESULT STDMETHODCALLTYPE CreateEnumeratorFromKey(
IDWriteFactory* pFactory, IDWriteFactory* pFactory,
void const* collectionKey, void const* collectionKey,
std::uint32_t collectionKeySize, uint32_t collectionKeySize,
_Out_ IDWriteFontFileEnumerator** fontFileEnumerator _Out_ IDWriteFontFileEnumerator** fontFileEnumerator
); );
@ -394,7 +394,7 @@ namespace kiwano
typedef Vector<Resource> ResourceCollection; typedef Vector<Resource> ResourceCollection;
Vector<ResourceCollection> resources_; Vector<ResourceCollection> resources_;
Vector<std::size_t> collectionKeys_; Vector<size_t> collectionKeys_;
}; };
HRESULT IResourceFontCollectionLoader::Create(_Out_ IResourceFontCollectionLoader** ppCollectionLoader, IDWriteFontFileLoader* pFileLoader) HRESULT IResourceFontCollectionLoader::Create(_Out_ IResourceFontCollectionLoader** ppCollectionLoader, IDWriteFontFileLoader* pFileLoader)
@ -423,7 +423,7 @@ namespace kiwano
STDMETHODIMP ResourceFontCollectionLoader::AddResources( STDMETHODIMP ResourceFontCollectionLoader::AddResources(
Vector<Resource> const& resources, Vector<Resource> const& resources,
_Out_ LPVOID* pCollectionKey, _Out_ LPVOID* pCollectionKey,
_Out_ std::uint32_t* pCollectionKeySize _Out_ uint32_t* pCollectionKeySize
) )
{ {
if (!pCollectionKey || !pCollectionKeySize) if (!pCollectionKey || !pCollectionKeySize)
@ -433,7 +433,7 @@ namespace kiwano
try try
{ {
std::size_t collectionKey = resources_.size(); size_t collectionKey = resources_.size();
collectionKeys_.push_back(collectionKey); collectionKeys_.push_back(collectionKey);
resources_.push_back(resources); resources_.push_back(resources);
@ -483,7 +483,7 @@ namespace kiwano
HRESULT STDMETHODCALLTYPE ResourceFontCollectionLoader::CreateEnumeratorFromKey( HRESULT STDMETHODCALLTYPE ResourceFontCollectionLoader::CreateEnumeratorFromKey(
IDWriteFactory* pFactory, IDWriteFactory* pFactory,
void const* collectionKey, void const* collectionKey,
std::uint32_t collectionKeySize, uint32_t collectionKeySize,
_Out_ IDWriteFontFileEnumerator** fontFileEnumerator _Out_ IDWriteFontFileEnumerator** fontFileEnumerator
) )
{ {
@ -499,7 +499,7 @@ namespace kiwano
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
const std::uint32_t resourceIndex = *static_cast<const std::uint32_t*>(collectionKey); const uint32_t resourceIndex = *static_cast<const uint32_t*>(collectionKey);
hr = pEnumerator->SetResources(resources_[resourceIndex]); hr = pEnumerator->SetResources(resources_[resourceIndex]);
} }
@ -536,7 +536,7 @@ namespace kiwano
// IDWriteFontFileLoader methods // IDWriteFontFileLoader methods
virtual HRESULT STDMETHODCALLTYPE CreateStreamFromKey( virtual HRESULT STDMETHODCALLTYPE CreateStreamFromKey(
void const* fontFileReferenceKey, void const* fontFileReferenceKey,
std::uint32_t fontFileReferenceKeySize, uint32_t fontFileReferenceKeySize,
_Out_ IDWriteFontFileStream** fontFileStream _Out_ IDWriteFontFileStream** fontFileStream
); );
@ -597,7 +597,7 @@ namespace kiwano
HRESULT STDMETHODCALLTYPE ResourceFontFileLoader::CreateStreamFromKey( HRESULT STDMETHODCALLTYPE ResourceFontFileLoader::CreateStreamFromKey(
void const* fontFileReferenceKey, void const* fontFileReferenceKey,
std::uint32_t fontFileReferenceKeySize, uint32_t fontFileReferenceKeySize,
_Out_ IDWriteFontFileStream** fontFileStream _Out_ IDWriteFontFileStream** fontFileStream
) )
{ {
@ -668,7 +668,7 @@ namespace kiwano
IDWriteFontFile* currentFile_; IDWriteFontFile* currentFile_;
IDWriteFontFileLoader* pLoader_; IDWriteFontFileLoader* pLoader_;
Vector<Resource> resources_; Vector<Resource> resources_;
std::uint32_t nextIndex_; uint32_t nextIndex_;
}; };
HRESULT IResourceFontFileEnumerator::Create(_Out_ IResourceFontFileEnumerator** ppEnumerator, IDWriteFactory* pFactory, IDWriteFontFileLoader* pFileLoader) HRESULT IResourceFontFileEnumerator::Create(_Out_ IResourceFontFileEnumerator** ppEnumerator, IDWriteFactory* pFactory, IDWriteFontFileLoader* pFileLoader)
@ -948,7 +948,7 @@ namespace kiwano
if (fileOffset <= resourceSize_ && if (fileOffset <= resourceSize_ &&
fragmentSize <= resourceSize_ - fileOffset) fragmentSize <= resourceSize_ - fileOffset)
{ {
*fragmentStart = static_cast<BYTE const*>(resourcePtr_) + static_cast<std::uint32_t>(fileOffset); *fragmentStart = static_cast<BYTE const*>(resourcePtr_) + static_cast<uint32_t>(fileOffset);
*fragmentContext = NULL; *fragmentContext = NULL;
return S_OK; return S_OK;
} }

View File

@ -34,7 +34,7 @@ namespace kiwano
STDMETHOD(AddFilePaths)( STDMETHOD(AddFilePaths)(
Vector<String> const& filePaths, Vector<String> const& filePaths,
_Out_ LPVOID * pCollectionKey, _Out_ LPVOID * pCollectionKey,
_Out_ std::uint32_t * pCollectionKeySize _Out_ uint32_t * pCollectionKeySize
) PURE; ) PURE;
}; };
@ -66,7 +66,7 @@ namespace kiwano
STDMETHOD(AddResources)( STDMETHOD(AddResources)(
Vector<Resource> const& resources, Vector<Resource> const& resources,
_Out_ LPVOID * pCollectionKey, _Out_ LPVOID * pCollectionKey,
_Out_ std::uint32_t * pCollectionKeySize _Out_ uint32_t * pCollectionKeySize
) PURE; ) PURE;
}; };

View File

@ -41,7 +41,7 @@ namespace kiwano
return enabled_; return enabled_;
} }
std::size_t Menu::GetButtonCount() const size_t Menu::GetButtonCount() const
{ {
return buttons_.size(); return buttons_.size();
} }

View File

@ -38,7 +38,7 @@ namespace kiwano
bool IsEnable() const; bool IsEnable() const;
// 获取菜单中的按钮数量 // 获取菜单中的按钮数量
std::size_t GetButtonCount() const; size_t GetButtonCount() const;
// 设置菜单启用或禁用 // 设置菜单启用或禁用
void SetEnabled( void SetEnabled(

View File

@ -198,7 +198,7 @@ namespace kiwano
return false; return false;
} }
std::size_t ResourceCache::AddFrameSequence(String const& id, Vector<String> const& files) size_t ResourceCache::AddFrameSequence(String const& id, Vector<String> const& files)
{ {
if (files.empty()) if (files.empty())
return 0; return 0;
@ -226,7 +226,7 @@ namespace kiwano
return 0; 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) if (cols <= 0 || rows <= 0)
return 0; return 0;
@ -264,7 +264,7 @@ namespace kiwano
return AddFrameSequence(id, fs); 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) if (frames)
{ {

View File

@ -53,14 +53,14 @@ namespace kiwano
bool AddFrame(String const& id, FramePtr frame); bool AddFrame(String const& id, FramePtr frame);
// 添加序列帧 // 添加序列帧
std::size_t AddFrameSequence(String const& id, Vector<String> const& files); size_t AddFrameSequence(String const& id, Vector<String> 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); bool AddObjectBase(String const& id, ObjectBasePtr obj);