diff --git a/headers/enduro2d/core/debug.hpp b/headers/enduro2d/core/debug.hpp index 248b6f2f..f92cb4d8 100644 --- a/headers/enduro2d/core/debug.hpp +++ b/headers/enduro2d/core/debug.hpp @@ -41,19 +41,19 @@ namespace e2d level min_level() const noexcept; template < typename... Args > - void log(level lvl, str_view fmt, Args&&... args); + debug& log(level lvl, str_view fmt, Args&&... args); template < typename... Args > - void trace(str_view fmt, Args&&... args); + debug& trace(str_view fmt, Args&&... args); template < typename... Args > - void warning(str_view fmt, Args&&... args); + debug& warning(str_view fmt, Args&&... args); template < typename... Args > - void error(str_view fmt, Args&&... args); + debug& error(str_view fmt, Args&&... args); template < typename... Args > - void fatal(str_view fmt, Args&&... args); + debug& fatal(str_view fmt, Args&&... args); private: mutable std::mutex mutex_; level min_level_ = level::trace; @@ -100,7 +100,7 @@ namespace e2d } template < typename... Args > - void debug::log(level lvl, str_view fmt, Args&&... args) { + debug& debug::log(level lvl, str_view fmt, Args&&... args) { std::lock_guard guard(mutex_); if ( lvl >= min_level_ && !sinks_.empty() ) { str text = strings::rformat(fmt, std::forward(args)...); @@ -110,25 +110,26 @@ namespace e2d } } } + return *this; } template < typename... Args > - void debug::trace(str_view fmt, Args&&... args) { - log(level::trace, fmt, std::forward(args)...); + debug& debug::trace(str_view fmt, Args&&... args) { + return log(level::trace, fmt, std::forward(args)...); } template < typename... Args > - void debug::warning(str_view fmt, Args&&... args) { - log(level::warning, fmt, std::forward(args)...); + debug& debug::warning(str_view fmt, Args&&... args) { + return log(level::warning, fmt, std::forward(args)...); } template < typename... Args > - void debug::error(str_view fmt, Args&&... args) { - log(level::error, fmt, std::forward(args)...); + debug& debug::error(str_view fmt, Args&&... args) { + return log(level::error, fmt, std::forward(args)...); } template < typename... Args > - void debug::fatal(str_view fmt, Args&&... args) { - log(level::fatal, fmt, std::forward(args)...); + debug& debug::fatal(str_view fmt, Args&&... args) { + return log(level::fatal, fmt, std::forward(args)...); } } diff --git a/samples/sources/sample_00/sample_00.cpp b/samples/sources/sample_00/sample_00.cpp index 1c48d50a..ed56df53 100644 --- a/samples/sources/sample_00/sample_00.cpp +++ b/samples/sources/sample_00/sample_00.cpp @@ -14,15 +14,13 @@ int main() { window& w = modules::initialize( v2u{640, 480}, "Enduro2D", false, false); - for ( std::size_t i = 0; i < 2; ++i ) { - w.swap_buffers(); - window::poll_events(); - std::this_thread::sleep_for(time::to_chrono(make_seconds(2))); - w.toggle_fullscreen(!w.fullscreen()); - } + the() + .trace("SAMPLE: window real size: %0", w.real_size()) + .trace("SAMPLE: window virtual size: %0", w.virtual_size()) + .trace("SAMPLE: window framebuffer size: %0", w.framebuffer_size()); - auto current_time = time::now_s(); - while ( !w.should_close() && current_time + make_seconds(5) < time::now_s() ) { + auto closing_time = time::now_s() + make_seconds(5); + while ( !w.should_close() && time::now_s() < closing_time ) { w.swap_buffers(); window::poll_events(); } diff --git a/sources/enduro2d/core/window_impl/window_glfw.cpp b/sources/enduro2d/core/window_impl/window_glfw.cpp index d920d9f0..80564ee9 100644 --- a/sources/enduro2d/core/window_impl/window_glfw.cpp +++ b/sources/enduro2d/core/window_impl/window_glfw.cpp @@ -112,6 +112,8 @@ namespace e2d glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); + glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE); + glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_FALSE); v2i real_size = fullscreen ? make_vec2(video_mode->width, video_mode->height) : virtual_size.cast_to();