diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-09 03:11:56 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-09 03:11:56 +0200 |
| commit | acdace16824b741948b02da0bcc7d0d059c7f683 (patch) | |
| tree | 1ffd35712af0a9412477e678310a82ba3988ccf3 /main | |
| parent | 542bc1c103f129c2f648dbe77affb485cfdf93ab (diff) | |
a
Diffstat (limited to 'main')
| -rw-r--r-- | main/debug.cpp | 14 | ||||
| -rw-r--r-- | main/main.cpp | 7 |
2 files changed, 14 insertions, 7 deletions
diff --git a/main/debug.cpp b/main/debug.cpp index c7eeaebf..d312bd5f 100644 --- a/main/debug.cpp +++ b/main/debug.cpp @@ -15,7 +15,7 @@ using GL::DebugOutput; void app::debug_callback(GL::DebugOutput::Source src, GL::DebugOutput::Type type, UnsignedInt id, Severity severity, Containers::StringView str) const { - static thread_local Magnum::Timeline t{}; + static thread_local auto t = progn(auto t = Magnum::Timeline{}; t.start(); return t; ); [[maybe_unused]] volatile auto _type = type; [[maybe_unused]] volatile auto _id = id; @@ -27,14 +27,16 @@ void app::debug_callback(GL::DebugOutput::Source src, GL::DebugOutput::Type type if (!std::strncmp(str.data(), prefix.data(), prefix.size()-1)) str = str.exceptPrefix(prefix.size()-1); + printf("%12.2f ", (double)t.previousFrameTime() * 1000); + switch (severity) { using enum GL::DebugOutput::Severity; - case Notification: std::fputs("[DEBUG] ", stdout); break; - case Low: std::fputs("[INFO ] ", stdout); break; - case Medium: std::fputs("[NOTICE] ", stdout); break; - case High: std::fputs("[ERROR] ", stdout); break; - default: std::fputs("[?????] ", stdout); break; + case Notification: std::fputs("DEBUG ", stdout); break; + case Low: std::fputs("INFO ", stdout); break; + case Medium: std::fputs("NOTICE ", stdout); break; + case High: std::fputs("ERROR ", stdout); break; + default: std::fputs("????? ", stdout); break; } std::puts(str.data()); diff --git a/main/main.cpp b/main/main.cpp index 2696dc79..523d16c0 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1,4 +1,6 @@ #include "app.hpp" +#include "tile-defs.hpp" +#include <Magnum/Math/Vector3.h> #include <Magnum/GL/DefaultFramebuffer.h> #include <Magnum/GL/Renderer.h> #include <Magnum/Trade/AbstractImporter.h> @@ -54,8 +56,11 @@ void app::draw_chunk(chunk& c) void app::draw_wireframe() { + constexpr auto X = TILE_SIZE[0], Y = TILE_SIZE[1]; + constexpr float N = TILE_MAX_DIM/2.f; + const Vector3 center {(float)(X*N), (float)(Y*N), 0}; _shader.set_tint({1.f, 1.f, 0, 1.f}); - _wireframe_quad.draw(_shader, {{10, 10, 0}, {TILE_SIZE[0], TILE_SIZE[1]}}); + _wireframe_quad.draw(_shader, {center, {TILE_SIZE[0], TILE_SIZE[1]}}); _shader.set_tint({1, 1, 1, 1}); } |
