Calamity Engine 1.0.0
A cross-platform 2D game engine written in C++ and SDL3.
Loading...
Searching...
No Matches
Tips & Tricks

Tracy

Tracy is a real-time profiler. It's pretty useful if you're trying to find performance issues in your code.

To use it, simply configure your app with the -DTRACY_ENABLED=ON option, then open the tracy client and connect to your app.

For more information regarding tracy usage, please take a look at it's documentation (which is a PDF file :)).

Emscripten games

You may have noticed that the template project and the examples all use a separate loop() function, which you don't need at all if you are only targeting native platforms! (In fact, it's a lot easier to not use a separate loop function).

However, if you want your game to compile to Emscripten, you need a separate loop function and you need SOME way to pass the Engine service and the Graphics service to it (you also need to register it with Emscripten). This is the way it's done in the template project and in every example:

// at the top of the file
static Engine engine = Engine("game name goes here");
static Graphics* graphics = nullptr;
void loop() {
engine.update();
engine.render(*graphics);
}
// in the main function
#ifdef EMSCRIPTEN
emscripten_set_main_loop(loop, 0, 1);
#else
while (!input.shouldQuit) {
loop();
}
engine.exit();
delete graphics;
#endif
Definition engine.hpp:35
void render(Graphics &graphics)
Definition engine.cpp:118
void update()
Definition engine.cpp:70
void exit()
Definition engine.cpp:102
Definition graphics.hpp:26