summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--main/draw.cpp3
-rw-r--r--src/chunk.cpp28
-rw-r--r--src/log.cpp27
-rw-r--r--src/log.hpp9
4 files changed, 41 insertions, 26 deletions
diff --git a/main/draw.cpp b/main/draw.cpp
index 1de1bd50..c7ca97f3 100644
--- a/main/draw.cpp
+++ b/main/draw.cpp
@@ -5,6 +5,7 @@
#include "src/anim-atlas.hpp"
#include "main/clickable.hpp"
#include "src/light.hpp"
+#include "src/log.hpp"
#include <Corrade/Containers/GrowableArray.h>
#include <Corrade/Containers/ArrayView.h>
#include <Magnum/GL/DefaultFramebuffer.h>
@@ -250,7 +251,7 @@ void main_impl::do_update()
#endif
}
#ifndef FM_NO_DEBUG
- else if (dt_expected.has_focus && dt_expected.do_sleep) [[unlikely]]
+ else if (dt_expected.has_focus && dt_expected.do_sleep && is_log_verbose()) [[unlikely]]
{
if (good_frames)
{
diff --git a/src/chunk.cpp b/src/chunk.cpp
index a3c03b81..26b8779f 100644
--- a/src/chunk.cpp
+++ b/src/chunk.cpp
@@ -2,10 +2,11 @@
#include "object.hpp"
#include "world.hpp"
#include "tile-iterator.hpp"
+#include "log.hpp"
#include "RTree.h"
#include <algorithm>
-#include <Corrade/Containers/GrowableArray.h>
-#include <Magnum/GL/Context.h>
+#include <cr/GrowableArray.h>
+#include <cr/Optional.h>
namespace floormat {
@@ -15,29 +16,6 @@ constexpr auto object_id_lessp = [](const auto& a, const auto& b) { return a->id
size_t _reload_no_ = 0; // NOLINT
-[[maybe_unused]]
-bool is_log_quiet()
-{
- using GLCCF = GL::Implementation::ContextConfigurationFlag;
- auto flags = GL::Context::current().configurationFlags();
- return !!(flags & GLCCF::QuietLog);
-}
-
-bool is_log_verbose()
-{
- using GLCCF = GL::Implementation::ContextConfigurationFlag;
- auto flags = GL::Context::current().configurationFlags();
- return !!(flags & GLCCF::VerboseLog);
-}
-
-[[maybe_unused]]
-bool is_log_standard()
-{
- using GLCCF = GL::Implementation::ContextConfigurationFlag;
- auto flags = GL::Context::current().configurationFlags();
- return !(flags & (GLCCF::VerboseLog|GLCCF::QuietLog));
-}
-
} // namespace
bool chunk::empty(bool force) const noexcept
diff --git a/src/log.cpp b/src/log.cpp
new file mode 100644
index 00000000..c0b0ea60
--- /dev/null
+++ b/src/log.cpp
@@ -0,0 +1,27 @@
+#include "log.hpp"
+#include <mg/Context.h>
+
+namespace floormat {
+
+bool is_log_quiet()
+{
+ using GLCCF = GL::Implementation::ContextConfigurationFlag;
+ auto flags = GL::Context::current().configurationFlags();
+ return !!(flags & GLCCF::QuietLog);
+}
+
+bool is_log_verbose()
+{
+ using GLCCF = GL::Implementation::ContextConfigurationFlag;
+ auto flags = GL::Context::current().configurationFlags();
+ return !!(flags & GLCCF::VerboseLog);
+}
+
+bool is_log_standard()
+{
+ using GLCCF = GL::Implementation::ContextConfigurationFlag;
+ auto flags = GL::Context::current().configurationFlags();
+ return !(flags & (GLCCF::VerboseLog|GLCCF::QuietLog));
+}
+
+} // namespace floormat
diff --git a/src/log.hpp b/src/log.hpp
new file mode 100644
index 00000000..d620cf64
--- /dev/null
+++ b/src/log.hpp
@@ -0,0 +1,9 @@
+#pragma once
+
+namespace floormat {
+
+bool is_log_quiet();
+bool is_log_verbose();
+bool is_log_standard();
+
+} // namespace floormat