add flag to toggle tracy (disabled for now)

This commit is contained in:
2026-02-24 20:39:48 +01:00
parent d88b66c058
commit 349d614611
20 changed files with 153 additions and 24 deletions

View File

@ -1,11 +1,11 @@
#ifndef __CAMERA_HPP_ #ifndef __CAMERA_HPP_
#define __CAMERA_HPP_ #define __CAMERA_HPP_
#include "config.hpp"
#include <raylib.h> #include <raylib.h>
#include <raymath.h> #include <raymath.h>
#include "config.hpp"
class OrbitCamera3D { class OrbitCamera3D {
friend class Renderer; friend class Renderer;

View File

@ -4,6 +4,7 @@
#include <raylib.h> #include <raylib.h>
// #define WEB // Disables multithreading // #define WEB // Disables multithreading
// #define TRACY // Enable tracy profiling support
// Window // Window
constexpr int INITIAL_WIDTH = 800; constexpr int INITIAL_WIDTH = 800;

View File

@ -1,6 +1,7 @@
#ifndef __INPUT_HPP_ #ifndef __INPUT_HPP_
#define __INPUT_HPP_ #define __INPUT_HPP_
#include "config.hpp"
#include "state.hpp" #include "state.hpp"
class InputHandler { class InputHandler {

View File

@ -1,6 +1,8 @@
#ifndef __OCTREE_HPP_ #ifndef __OCTREE_HPP_
#define __OCTREE_HPP_ #define __OCTREE_HPP_
#include "config.hpp"
#include <raylib.h> #include <raylib.h>
#include <raymath.h> #include <raymath.h>
#include <vector> #include <vector>

View File

@ -1,6 +1,9 @@
#ifndef __PHYSICS_HPP_ #ifndef __PHYSICS_HPP_
#define __PHYSICS_HPP_ #define __PHYSICS_HPP_
#include "config.hpp"
#include "octree.hpp"
#include <atomic> #include <atomic>
#include <condition_variable> #include <condition_variable>
#include <cstddef> #include <cstddef>
@ -9,17 +12,18 @@
#include <raylib.h> #include <raylib.h>
#include <raymath.h> #include <raymath.h>
#include <thread> #include <thread>
#include <tracy/Tracy.hpp>
#include <variant> #include <variant>
#include <vector> #include <vector>
#include "octree.hpp"
#ifndef WEB #ifndef WEB
#define BS_THREAD_POOL_NATIVE_EXTENSIONS #define BS_THREAD_POOL_NATIVE_EXTENSIONS
#include <BS_thread_pool.hpp> #include <BS_thread_pool.hpp>
#endif #endif
#ifdef TRACY
#include <tracy/Tracy.hpp>
#endif
class Mass { class Mass {
public: public:
Vector3 position; Vector3 position;
@ -116,10 +120,18 @@ class ThreadedPhysics {
using Command = std::variant<AddMass, AddSpring, ClearGraph>; using Command = std::variant<AddMass, AddSpring, ClearGraph>;
struct PhysicsState { struct PhysicsState {
#ifdef TRACY
TracyLockable(std::mutex, command_mtx); TracyLockable(std::mutex, command_mtx);
#else
std::mutex command_mtx;
#endif
std::queue<Command> pending_commands; std::queue<Command> pending_commands;
#ifdef TRACY
TracyLockable(std::mutex, data_mtx); TracyLockable(std::mutex, data_mtx);
#else
std::mutex data_mtx;
#endif
std::condition_variable_any data_ready_cnd; std::condition_variable_any data_ready_cnd;
std::condition_variable_any data_consumed_cnd; std::condition_variable_any data_consumed_cnd;
unsigned int ups = 0; unsigned int ups = 0;

View File

@ -1,11 +1,12 @@
#ifndef __PRESETS_HPP_ #ifndef __PRESETS_HPP_
#define __PRESETS_HPP_ #define __PRESETS_HPP_
#include "config.hpp"
#include "puzzle.hpp"
#include <functional> #include <functional>
#include <vector> #include <vector>
#include "puzzle.hpp"
using StateGenerator = std::function<State(void)>; using StateGenerator = std::function<State(void)>;
inline auto state_simple_1r() -> State { inline auto state_simple_1r() -> State {

View File

@ -1,6 +1,8 @@
#ifndef __PUZZLE_HPP_ #ifndef __PUZZLE_HPP_
#define __PUZZLE_HPP_ #define __PUZZLE_HPP_
#include "config.hpp"
#include <array> #include <array>
#include <cstddef> #include <cstddef>
#include <format> #include <format>

View File

@ -1,14 +1,14 @@
#ifndef __RENDERER_HPP_ #ifndef __RENDERER_HPP_
#define __RENDERER_HPP_ #define __RENDERER_HPP_
#include <raylib.h>
#include <raymath.h>
#include "camera.hpp" #include "camera.hpp"
#include "config.hpp" #include "config.hpp"
#include "input.hpp" #include "input.hpp"
#include "state.hpp" #include "state.hpp"
#include <raylib.h>
#include <raymath.h>
class Renderer { class Renderer {
private: private:
const StateManager &state; const StateManager &state;

View File

@ -1,6 +1,7 @@
#ifndef __STATE_HPP_ #ifndef __STATE_HPP_
#define __STATE_HPP_ #define __STATE_HPP_
#include "config.hpp"
#include "physics.hpp" #include "physics.hpp"
#include "presets.hpp" #include "presets.hpp"
#include "puzzle.hpp" #include "puzzle.hpp"

View File

@ -1,6 +1,10 @@
#ifndef __TRACY_HPP_ #ifndef __TRACY_HPP_
#define __TRACY_HPP_ #define __TRACY_HPP_
#include "config.hpp"
#ifdef TRACY
#include <cstddef> #include <cstddef>
void *operator new(std::size_t count); void *operator new(std::size_t count);
@ -8,3 +12,5 @@ void operator delete(void *ptr) noexcept;
void operator delete(void *ptr, std::size_t count) noexcept; void operator delete(void *ptr, std::size_t count) noexcept;
#endif #endif
#endif

View File

@ -1,6 +1,8 @@
#ifndef __UTIL_HPP_ #ifndef __UTIL_HPP_
#define __UTIL_HPP_ #define __UTIL_HPP_
#include "config.hpp"
#include <iostream> #include <iostream>
#include <raylib.h> #include <raylib.h>
#include <raymath.h> #include <raymath.h>

View File

@ -1,10 +1,14 @@
#include "camera.hpp" #include "camera.hpp"
#include "config.hpp" #include "config.hpp"
#include "tracy.hpp"
#include <raylib.h> #include <raylib.h>
#include <raymath.h> #include <raymath.h>
#ifdef TRACY
#include "tracy.hpp"
#include <tracy/Tracy.hpp>
#endif
auto OrbitCamera3D::HandleCameraInput() -> Vector2 { auto OrbitCamera3D::HandleCameraInput() -> Vector2 {
Vector2 mouse = GetMousePosition(); Vector2 mouse = GetMousePosition();
if (mouse.x >= GetScreenWidth() / 2.0 && mouse.y >= MENU_HEIGHT) { if (mouse.x >= GetScreenWidth() / 2.0 && mouse.y >= MENU_HEIGHT) {

View File

@ -1,10 +1,14 @@
#include "input.hpp" #include "input.hpp"
#include "config.hpp" #include "config.hpp"
#include "tracy.hpp"
#include <algorithm> #include <algorithm>
#include <raylib.h> #include <raylib.h>
#ifdef TRACY
#include "tracy.hpp"
#include <tracy/Tracy.hpp>
#endif
auto InputHandler::HandleMouseHover() -> void { auto InputHandler::HandleMouseHover() -> void {
const int board_width = GetScreenWidth() / 2.0 - 2 * BOARD_PADDING; const int board_width = GetScreenWidth() / 2.0 - 2 * BOARD_PADDING;
const int board_height = GetScreenHeight() - MENU_HEIGHT - 2 * BOARD_PADDING; const int board_height = GetScreenHeight() - MENU_HEIGHT - 2 * BOARD_PADDING;

View File

@ -1,14 +1,17 @@
#include <mutex> #include <mutex>
#include <raylib.h> #include <raylib.h>
#include <raymath.h> #include <raymath.h>
#include <tracy/Tracy.hpp>
#include "config.hpp" #include "config.hpp"
#include "input.hpp" #include "input.hpp"
#include "physics.hpp" #include "physics.hpp"
#include "renderer.hpp" #include "renderer.hpp"
#include "state.hpp" #include "state.hpp"
#ifdef TRACY
#include "tracy.hpp" #include "tracy.hpp"
#include <tracy/Tracy.hpp>
#endif
// TODO: Klotski state file loading // TODO: Klotski state file loading
// - File should contain a single state per line, multiple lines possible // - File should contain a single state per line, multiple lines possible
@ -20,8 +23,6 @@
// - Click states to display them in the board // - Click states to display them in the board
// - Find shortest path to any winning state and mark it in the graph // - Find shortest path to any winning state and mark it in the graph
// - Also mark the next move along the path on the board // - Also mark the next move along the path on the board
// TODO: Do I have a huge memory leak or is the memory just not reclaimed from
// the C++ runtime?
auto main(int argc, char *argv[]) -> int { auto main(int argc, char *argv[]) -> int {
// if (argc < 2) { // if (argc < 2) {
@ -50,7 +51,9 @@ auto main(int argc, char *argv[]) -> int {
// Game loop // Game loop
while (!WindowShouldClose()) { while (!WindowShouldClose()) {
#ifdef TRACY
FrameMarkStart("MainThread"); FrameMarkStart("MainThread");
#endif
// Input update // Input update
state.previous_state = state.current_state; state.previous_state = state.current_state;
@ -58,9 +61,15 @@ auto main(int argc, char *argv[]) -> int {
state.UpdateGraph(); // Add state added after user input state.UpdateGraph(); // Add state added after user input
// Read positions from physics thread // Read positions from physics thread
#ifdef TRACY
FrameMarkStart("MainThreadConsumeLock"); FrameMarkStart("MainThreadConsumeLock");
#endif
{ {
#ifdef TRACY
std::unique_lock<LockableBase(std::mutex)> lock(physics.state.data_mtx); std::unique_lock<LockableBase(std::mutex)> lock(physics.state.data_mtx);
#else
std::unique_lock<std::mutex> lock(physics.state.data_mtx);
#endif
ups = physics.state.ups; ups = physics.state.ups;
@ -77,7 +86,9 @@ auto main(int argc, char *argv[]) -> int {
physics.state.data_consumed_cnd.notify_all(); physics.state.data_consumed_cnd.notify_all();
} }
} }
#ifdef TRACY
FrameMarkEnd("MainThreadConsumeLock"); FrameMarkEnd("MainThreadConsumeLock");
#endif
// Update the camera after the physics, so target lock is smooth // Update the camera after the physics, so target lock is smooth
std::size_t current_index = state.CurrentMassIndex(); std::size_t current_index = state.CurrentMassIndex();
@ -92,7 +103,10 @@ auto main(int argc, char *argv[]) -> int {
renderer.DrawKlotski(); renderer.DrawKlotski();
renderer.DrawMenu(masses, springs); renderer.DrawMenu(masses, springs);
renderer.DrawTextures(ups); renderer.DrawTextures(ups);
#ifdef TRACY
FrameMark;
FrameMarkEnd("MainThread"); FrameMarkEnd("MainThread");
#endif
} }
CloseWindow(); CloseWindow();

View File

@ -1,11 +1,15 @@
#include "octree.hpp" #include "octree.hpp"
#include "config.hpp" #include "config.hpp"
#include "tracy.hpp"
#include "util.hpp" #include "util.hpp"
#include <iostream> #include <iostream>
#include <raymath.h> #include <raymath.h>
#ifdef TRACY
#include "tracy.hpp"
#include <tracy/Tracy.hpp>
#endif
auto OctreeNode::ChildCount() const -> int { auto OctreeNode::ChildCount() const -> int {
int child_count = 0; int child_count = 0;
for (int child : children) { for (int child : children) {

View File

@ -1,20 +1,21 @@
#include "physics.hpp" #include "physics.hpp"
#include "config.hpp" #include "config.hpp"
#include "tracy.hpp"
#include <BS_thread_pool.hpp> #include <BS_thread_pool.hpp>
#include <algorithm> #include <algorithm>
#include <cfloat> #include <cfloat>
#include <chrono> #include <chrono>
#include <cstddef> #include <cstddef>
#include <mutex>
#include <ratio>
#include <raylib.h> #include <raylib.h>
#include <raymath.h> #include <raymath.h>
#include <tracy/Tracy.hpp>
#include <utility> #include <utility>
#include <vector> #include <vector>
#ifdef TRACY
#include "tracy.hpp"
#include <tracy/Tracy.hpp>
#endif
auto Mass::ClearForce() -> void { force = Vector3Zero(); } auto Mass::ClearForce() -> void { force = Vector3Zero(); }
auto Mass::CalculateVelocity(const float delta_time) -> void { auto Mass::CalculateVelocity(const float delta_time) -> void {
@ -94,7 +95,9 @@ auto MassSpringSystem::Clear() -> void {
} }
auto MassSpringSystem::ClearForces() -> void { auto MassSpringSystem::ClearForces() -> void {
#ifdef TRACY
ZoneScoped; ZoneScoped;
#endif
for (auto &mass : masses) { for (auto &mass : masses) {
mass.ClearForce(); mass.ClearForce();
@ -102,7 +105,9 @@ auto MassSpringSystem::ClearForces() -> void {
} }
auto MassSpringSystem::CalculateSpringForces() -> void { auto MassSpringSystem::CalculateSpringForces() -> void {
#ifdef TRACY
ZoneScoped; ZoneScoped;
#endif
for (const auto spring : springs) { for (const auto spring : springs) {
Mass &a = masses.at(spring.a); Mass &a = masses.at(spring.a);
@ -116,7 +121,9 @@ auto MassSpringSystem::SetThreadName(std::size_t idx) -> void {
} }
auto MassSpringSystem::BuildOctree() -> void { auto MassSpringSystem::BuildOctree() -> void {
#ifdef TRACY
ZoneScoped; ZoneScoped;
#endif
octree.nodes.clear(); octree.nodes.clear();
octree.nodes.reserve(masses.size() * 2); octree.nodes.reserve(masses.size() * 2);
@ -151,7 +158,9 @@ auto MassSpringSystem::BuildOctree() -> void {
} }
auto MassSpringSystem::CalculateRepulsionForces() -> void { auto MassSpringSystem::CalculateRepulsionForces() -> void {
#ifdef TRACY
ZoneScoped; ZoneScoped;
#endif
BuildOctree(); BuildOctree();
@ -173,7 +182,9 @@ auto MassSpringSystem::CalculateRepulsionForces() -> void {
} }
auto MassSpringSystem::VerletUpdate(float delta_time) -> void { auto MassSpringSystem::VerletUpdate(float delta_time) -> void {
#ifdef TRACY
ZoneScoped; ZoneScoped;
#endif
for (auto &mass : masses) { for (auto &mass : masses) {
mass.VerletUpdate(delta_time); mass.VerletUpdate(delta_time);
@ -198,7 +209,9 @@ auto ThreadedPhysics::PhysicsThread(ThreadedPhysics::PhysicsState &state)
unsigned int updates = 0; unsigned int updates = 0;
while (state.running.load()) { while (state.running.load()) {
#ifdef TRACY
FrameMarkStart("PhysicsThread"); FrameMarkStart("PhysicsThread");
#endif
// Time tracking // Time tracking
std::chrono::time_point now = std::chrono::high_resolution_clock::now(); std::chrono::time_point now = std::chrono::high_resolution_clock::now();
@ -209,7 +222,11 @@ auto ThreadedPhysics::PhysicsThread(ThreadedPhysics::PhysicsState &state)
// Handle queued commands // Handle queued commands
{ {
#ifdef TRACY
std::lock_guard<LockableBase(std::mutex)> lock(state.command_mtx); std::lock_guard<LockableBase(std::mutex)> lock(state.command_mtx);
#else
std::lock_guard<std::mutex> lock(state.command_mtx);
#endif
while (!state.pending_commands.empty()) { while (!state.pending_commands.empty()) {
Command &cmd = state.pending_commands.front(); Command &cmd = state.pending_commands.front();
cmd.visit(visitor); cmd.visit(visitor);
@ -234,9 +251,15 @@ auto ThreadedPhysics::PhysicsThread(ThreadedPhysics::PhysicsState &state)
} }
// Publish the positions for the renderer (copy) // Publish the positions for the renderer (copy)
#ifdef TRACY
FrameMarkStart("PhysicsThreadProduceLock"); FrameMarkStart("PhysicsThreadProduceLock");
#endif
{ {
#ifdef TRACY
std::unique_lock<LockableBase(std::mutex)> lock(state.data_mtx); std::unique_lock<LockableBase(std::mutex)> lock(state.data_mtx);
#else
std::unique_lock<std::mutex> lock(state.data_mtx);
#endif
state.data_consumed_cnd.wait( state.data_consumed_cnd.wait(
lock, [&] { return state.data_consumed || !state.running.load(); }); lock, [&] { return state.data_consumed || !state.running.load(); });
if (!state.running.load()) { if (!state.running.load()) {
@ -268,29 +291,43 @@ auto ThreadedPhysics::PhysicsThread(ThreadedPhysics::PhysicsState &state)
} }
// Notify the rendering thread that new data is available // Notify the rendering thread that new data is available
state.data_ready_cnd.notify_all(); state.data_ready_cnd.notify_all();
#ifdef TRACY
FrameMarkEnd("PhysicsThreadProduceLock"); FrameMarkEnd("PhysicsThreadProduceLock");
FrameMarkEnd("PhysicsThread"); FrameMarkEnd("PhysicsThread");
#endif
} }
} }
auto ThreadedPhysics::AddMassCmd() -> void { auto ThreadedPhysics::AddMassCmd() -> void {
{ {
#ifdef TRACY
std::lock_guard<LockableBase(std::mutex)> lock(state.command_mtx); std::lock_guard<LockableBase(std::mutex)> lock(state.command_mtx);
#else
std::lock_guard<std::mutex> lock(state.command_mtx);
#endif
state.pending_commands.push(AddMass{}); state.pending_commands.push(AddMass{});
} }
} }
auto ThreadedPhysics::AddSpringCmd(std::size_t a, std::size_t b) -> void { auto ThreadedPhysics::AddSpringCmd(std::size_t a, std::size_t b) -> void {
{ {
#ifdef TRACY
std::lock_guard<LockableBase(std::mutex)> lock(state.command_mtx); std::lock_guard<LockableBase(std::mutex)> lock(state.command_mtx);
#else
std::lock_guard<std::mutex> lock(state.command_mtx);
#endif
state.pending_commands.push(AddSpring{a, b}); state.pending_commands.push(AddSpring{a, b});
} }
} }
auto ThreadedPhysics::ClearCmd() -> void { auto ThreadedPhysics::ClearCmd() -> void {
{ {
#ifdef TRACY
std::lock_guard<LockableBase(std::mutex)> lock(state.command_mtx); std::lock_guard<LockableBase(std::mutex)> lock(state.command_mtx);
#else
std::lock_guard<std::mutex> lock(state.command_mtx);
#endif
state.pending_commands.push(ClearGraph{}); state.pending_commands.push(ClearGraph{});
} }
} }
@ -299,7 +336,11 @@ auto ThreadedPhysics::AddMassSpringsCmd(
std::size_t num_masses, std::size_t num_masses,
const std::vector<std::pair<std::size_t, std::size_t>> &springs) -> void { const std::vector<std::pair<std::size_t, std::size_t>> &springs) -> void {
{ {
#ifdef TRACY
std::lock_guard<LockableBase(std::mutex)> lock(state.command_mtx); std::lock_guard<LockableBase(std::mutex)> lock(state.command_mtx);
#else
std::lock_guard<std::mutex> lock(state.command_mtx);
#endif
for (std::size_t i = 0; i < num_masses; ++i) { for (std::size_t i = 0; i < num_masses; ++i) {
state.pending_commands.push(AddMass{}); state.pending_commands.push(AddMass{});
} }

View File

@ -1,8 +1,13 @@
#include "puzzle.hpp" #include "puzzle.hpp"
#include "tracy.hpp" #include "config.hpp"
#include <unordered_set> #include <unordered_set>
#ifdef TRACY
#include "tracy.hpp"
#include <tracy/Tracy.hpp>
#endif
auto Block::Hash() const -> int { auto Block::Hash() const -> int {
std::string s = std::format("{},{},{},{}", x, y, width, height); std::string s = std::format("{},{},{},{}", x, y, width, height);
return std::hash<std::string>{}(s); return std::hash<std::string>{}(s);
@ -267,6 +272,10 @@ auto State::GetNextStates() const -> std::vector<State> {
auto State::Closure() const auto State::Closure() const
-> std::pair<std::vector<State>, -> std::pair<std::vector<State>,
std::vector<std::pair<std::size_t, std::size_t>>> { std::vector<std::pair<std::size_t, std::size_t>>> {
#ifdef TRACY
ZoneScoped;
#endif
std::vector<State> states; std::vector<State> states;
std::vector<std::pair<std::size_t, std::size_t>> links; std::vector<std::pair<std::size_t, std::size_t>> links;

View File

@ -1,14 +1,17 @@
#include "renderer.hpp" #include "renderer.hpp"
#include "config.hpp" #include "config.hpp"
#include "puzzle.hpp" #include "puzzle.hpp"
#include "tracy.hpp"
#include <algorithm> #include <algorithm>
#include <format> #include <format>
#include <raylib.h> #include <raylib.h>
#include <raymath.h> #include <raymath.h>
#include <rlgl.h> #include <rlgl.h>
#ifdef TRACY
#include "tracy.hpp"
#include <tracy/Tracy.hpp> #include <tracy/Tracy.hpp>
#endif
#ifdef BATCHING #ifdef BATCHING
#include <cstring> #include <cstring>
@ -59,11 +62,15 @@ auto Renderer::ReallocateGraphInstancingIfNecessary(std::size_t size) -> void {
auto Renderer::DrawMassSprings( auto Renderer::DrawMassSprings(
const std::vector<Vector3> &masses, const std::vector<Vector3> &masses,
const std::vector<std::pair<std::size_t, std::size_t>> &springs) -> void { const std::vector<std::pair<std::size_t, std::size_t>> &springs) -> void {
#ifdef TRACY
ZoneScoped; ZoneScoped;
#endif
// Prepare cube instancing // Prepare cube instancing
{ {
#ifdef TRACY
ZoneNamedN(prepare_masses, "PrepareMasses", true); ZoneNamedN(prepare_masses, "PrepareMasses", true);
#endif
if (masses.size() < DRAW_VERTICES_LIMIT) { if (masses.size() < DRAW_VERTICES_LIMIT) {
if (transforms == nullptr) { if (transforms == nullptr) {
AllocateGraphInstancing(masses.size()); AllocateGraphInstancing(masses.size());
@ -85,7 +92,9 @@ auto Renderer::DrawMassSprings(
// Draw springs (batched) // Draw springs (batched)
{ {
#ifdef TRACY
ZoneNamedN(draw_springs, "DrawSprings", true); ZoneNamedN(draw_springs, "DrawSprings", true);
#endif
rlBegin(RL_LINES); rlBegin(RL_LINES);
for (const auto &[from, to] : springs) { for (const auto &[from, to] : springs) {
if (masses.size() > from && masses.size() > to) { if (masses.size() > from && masses.size() > to) {
@ -101,7 +110,9 @@ auto Renderer::DrawMassSprings(
// Draw masses (instanced) // Draw masses (instanced)
{ {
#ifdef TRACY
ZoneNamedN(draw_masses, "DrawMasses", true); ZoneNamedN(draw_masses, "DrawMasses", true);
#endif
if (masses.size() < DRAW_VERTICES_LIMIT) { if (masses.size() < DRAW_VERTICES_LIMIT) {
// NOTE: I don't know if drawing all this inside a shader would make it // NOTE: I don't know if drawing all this inside a shader would make it
// much faster... The amount of data sent to the GPU would be // much faster... The amount of data sent to the GPU would be
@ -171,7 +182,9 @@ auto Renderer::DrawMassSprings(
} }
auto Renderer::DrawKlotski() -> void { auto Renderer::DrawKlotski() -> void {
#ifdef TRACY
ZoneScoped; ZoneScoped;
#endif
BeginTextureMode(klotski_target); BeginTextureMode(klotski_target);
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
@ -262,7 +275,9 @@ auto Renderer::DrawKlotski() -> void {
auto Renderer::DrawMenu( auto Renderer::DrawMenu(
const std::vector<Vector3> &masses, const std::vector<Vector3> &masses,
const std::vector<std::pair<std::size_t, std::size_t>> &springs) -> void { const std::vector<std::pair<std::size_t, std::size_t>> &springs) -> void {
#ifdef TRACY
ZoneScoped; ZoneScoped;
#endif
BeginTextureMode(menu_target); BeginTextureMode(menu_target);
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);

View File

@ -1,9 +1,14 @@
#include "state.hpp" #include "state.hpp"
#include "config.hpp"
#include "presets.hpp" #include "presets.hpp"
#include "tracy.hpp"
#include <raymath.h> #include <raymath.h>
#ifdef TRACY
#include "tracy.hpp"
#include <tracy/Tracy.hpp>
#endif
auto StateManager::LoadPreset(int preset) -> void { auto StateManager::LoadPreset(int preset) -> void {
current_preset = preset; current_preset = preset;
current_state = CurrentGenerator()(); current_state = CurrentGenerator()();

View File

@ -1,5 +1,8 @@
#include "tracy.hpp" #include "config.hpp"
#ifdef TRACY
#include "tracy.hpp"
#include <tracy/Tracy.hpp> #include <tracy/Tracy.hpp>
void *operator new(std::size_t count) { void *operator new(std::size_t count) {
@ -15,3 +18,5 @@ void operator delete(void *ptr, std::size_t count) noexcept {
TracyFreeS(ptr, 20); TracyFreeS(ptr, 20);
free(ptr); free(ptr);
} }
#endif