Make it so that DNEBUG is forced on release build, and that the UI stats counter will show that this is a debug build or not via NDEBUG.

master
Zed A. Shaw 3 months ago
parent cf9682ed70
commit 53a151511e
  1. 2
      Makefile
  2. 6
      constants.hpp
  3. 4
      main.cpp
  4. 3
      raycaster.cpp

@ -10,7 +10,7 @@ build:
meson compile -j 10 -C builddir meson compile -j 10 -C builddir
release_build: release_build:
meson --wipe builddir --buildtype release meson --wipe builddir -Dcpp_args=-DNDEBUG=1 --buildtype release
meson compile -j 10 -C builddir meson compile -j 10 -C builddir
debug_build: debug_build:

@ -6,3 +6,9 @@ constexpr const int RAY_VIEW_X=(1280 - RAY_VIEW_WIDTH);
constexpr const int RAY_VIEW_Y=0; constexpr const int RAY_VIEW_Y=0;
constexpr const int SCREEN_HEIGHT=720; constexpr const int SCREEN_HEIGHT=720;
constexpr const int SCREEN_WIDTH=1280; constexpr const int SCREEN_WIDTH=1280;
constexpr const bool VSYNC=false;
#ifdef NDEBUG
constexpr const bool DEBUG_BUILD=false;
#else
constexpr const bool DEBUG_BUILD=true;
#endif

@ -26,8 +26,8 @@ void draw_gui(sf::RenderWindow &window, sf::Text &text, Stats &stats) {
window.draw(rect); window.draw(rect);
text.setString( text.setString(
fmt::format("FPS\nmean:{:>8.5}\nsdev: {:>8.5}\nmin: {:>8.5}\nmax: {:>8.5}\ncount:{:<10}\n\nHit R to reset.", fmt::format("FPS\nmean:{:>8.5}\nsdev: {:>8.5}\nmin: {:>8.5}\nmax: {:>8.5}\ncount:{:<10}\n\nVSync? {}\nDebug? {}\n\nHit R to reset.",
stats.mean(), stats.stddev(), stats.min, stats.max, stats.n)); stats.mean(), stats.stddev(), stats.min, stats.max, stats.n, VSYNC, DEBUG_BUILD));
window.draw(text); window.draw(text);
} }

@ -1,6 +1,7 @@
#include "raycaster.hpp" #include "raycaster.hpp"
#include "texture.hpp" #include "texture.hpp"
#include <algorithm> #include <algorithm>
#include "constants.hpp"
using namespace fmt; using namespace fmt;
using std::make_unique; using std::make_unique;
@ -37,7 +38,7 @@ Raycaster::Raycaster(sf::RenderWindow& window, Matrix &map, int width, int heigh
spriteDistance($textures.NUM_SPRITES), spriteDistance($textures.NUM_SPRITES),
ZBuffer(width) ZBuffer(width)
{ {
// $window.setVerticalSyncEnabled(true); $window.setVerticalSyncEnabled(VSYNC);
$view_sprite.setPosition({0, 0}); $view_sprite.setPosition({0, 0});
$pixels = make_unique<RGBA[]>($width * $height); $pixels = make_unique<RGBA[]>($width * $height);
$textures.load_textures(); $textures.load_textures();

Loading…
Cancel
Save