diff options
Diffstat (limited to 'src/win/native')
| -rw-r--r-- | src/win/native/cursor.cpp | 12 | ||||
| -rw-r--r-- | src/win/native/native_window.cpp | 7 | ||||
| -rw-r--r-- | src/win/native/ui_application.cpp | 5 |
3 files changed, 14 insertions, 10 deletions
diff --git a/src/win/native/cursor.cpp b/src/win/native/cursor.cpp index 8c0e393b..a0f9dd6c 100644 --- a/src/win/native/cursor.cpp +++ b/src/win/native/cursor.cpp @@ -1,7 +1,7 @@ #include "cru/win/native/cursor.hpp" #include "cru/common/format.hpp" -#include "cru/platform/debug.hpp" +#include "cru/common/logger.hpp" #include "cru/win/native/exception.hpp" #include <stdexcept> @@ -15,17 +15,17 @@ WinCursor::WinCursor(HCURSOR handle, bool auto_delete) { WinCursor::~WinCursor() { if (auto_delete_) { if (!::DestroyCursor(handle_)) { - DebugMessage( - util::Format(L"Failed to destroy a cursor. Last error code: {}", - ::GetLastError())); // This is not a fetal error but - // might still need notice. + // This is not a fetal error but might still need notice. + log::Warn(L"Failed to destroy a cursor. Last error code: {}", + ::GetLastError()); } } } namespace { WinCursor* LoadWinCursor(const wchar_t* name) { - const auto handle = static_cast<HCURSOR>(::LoadImageW(NULL, name, IMAGE_CURSOR, SM_CYCURSOR, SM_CYCURSOR, LR_SHARED)); + const auto handle = static_cast<HCURSOR>(::LoadImageW( + NULL, name, IMAGE_CURSOR, SM_CYCURSOR, SM_CYCURSOR, LR_SHARED)); if (handle == NULL) { throw Win32Error(::GetLastError(), "Failed to get system cursor."); } diff --git a/src/win/native/native_window.cpp b/src/win/native/native_window.cpp index 6a02c2fc..149d9158 100644 --- a/src/win/native/native_window.cpp +++ b/src/win/native/native_window.cpp @@ -1,7 +1,7 @@ #include "cru/win/native/native_window.hpp" #include "cru/common/format.hpp" -#include "cru/platform/debug.hpp" +#include "cru/common/logger.hpp" #include "cru/win/graph/direct/graph_factory.hpp" #include "cru/win/native/cursor.hpp" #include "cru/win/native/exception.hpp" @@ -169,12 +169,11 @@ void WinNativeWindow::SetCursor(std::shared_ptr<Cursor> cursor) { WinCursor* c = static_cast<WinCursor*>(cursor.get()); auto outputError = [] { - DebugMessage(util::Format(util::Format( - L"Failed to set cursor. Last error code: {}.", ::GetLastError()))); + log::Debug(L"Failed to set cursor. Last error code: {}.", ::GetLastError()); }; if (!::SetClassLongPtrW(hwnd_, GCLP_HCURSOR, - reinterpret_cast<LONG_PTR>(c->GetHandle()))) { + reinterpret_cast<LONG_PTR>(c->GetHandle()))) { outputError(); return; } diff --git a/src/win/native/ui_application.cpp b/src/win/native/ui_application.cpp index fdc0aace..c2d3ac2c 100644 --- a/src/win/native/ui_application.cpp +++ b/src/win/native/ui_application.cpp @@ -1,5 +1,7 @@ #include "cru/win/native/ui_application.hpp" +#include "../debug_logger.hpp" +#include "cru/common/logger.hpp" #include "cru/win/graph/direct/graph_factory.hpp" #include "cru/win/native/exception.hpp" #include "cru/win/native/god_window.hpp" @@ -38,6 +40,9 @@ WinUiApplication::WinUiApplication(HINSTANCE h_instance) : h_instance_(h_instance) { assert(instance == nullptr); + log::Logger::GetInstance()->AddSource( + new ::cru::platform::win::WinDebugLoggerSource()); + if (!::IsWindows8OrGreater()) throw std::runtime_error("Must run on Windows 8 or later."); |
