Operation Null Mind 0.4.1
A 2D roguelike top down shooter game made with SDL2
 
Loading...
Searching...
No Matches
debug.c File Reference

Debug visualization and information tools. More...

#include <debug.h>
#include <app.h>
#include <colliders.h>
#include <interactable.h>
#include <stdio.h>
#include <UI_text.h>
#include <camera.h>
#include <maps.h>
#include <player.h>

Macros

#define PLAYER_HITBOX_COLOR   0, 255, 0, 255
 Color constants for hitbox visualization.
 
#define WALL_HITBOX_COLOR   255, 255, 0, 255
 
#define ENEMY_HITBOX_COLOR   255, 0, 0, 255
 
#define ITEM_HITBOX_COLOR   0, 255, 255, 255
 
#define ENEMY_PROJECTILE_HITBOX_COLOR   255, 0, 255, 255
 
#define PLAYER_PROJECTILE_HITBOX_COLOR   0, 0, 255, 255
 

Functions

void Debug_RenderHitboxes ()
 [Render] Renders all active hitboxes when debug mode is enabled
 
void Debug_RenderFPSCount ()
 [Render] Renders the current FPS counter in the top-left corner
 
void Debug_RenderSpikeCount ()
 [Render] Renders a counter of frame spikes (frames exceeding target time)
 
void Debug_RenderCurrentChunk ()
 [Render] Renders information about the current chunk the player is in
 

Detailed Description

Debug visualization and information tools.

Provides functionality for rendering debug information like hitboxes, FPS counters, and other metrics when debug mode is enabled.

Author
Mango
Date
2025-03-01

Macro Definition Documentation

◆ ENEMY_HITBOX_COLOR

#define ENEMY_HITBOX_COLOR   255, 0, 0, 255

◆ ENEMY_PROJECTILE_HITBOX_COLOR

#define ENEMY_PROJECTILE_HITBOX_COLOR   255, 0, 255, 255

◆ ITEM_HITBOX_COLOR

#define ITEM_HITBOX_COLOR   0, 255, 255, 255

◆ PLAYER_HITBOX_COLOR

#define PLAYER_HITBOX_COLOR   0, 255, 0, 255

Color constants for hitbox visualization.

◆ PLAYER_PROJECTILE_HITBOX_COLOR

#define PLAYER_PROJECTILE_HITBOX_COLOR   0, 0, 255, 255

◆ WALL_HITBOX_COLOR

#define WALL_HITBOX_COLOR   255, 255, 0, 255

Function Documentation

◆ Debug_RenderCurrentChunk()

void Debug_RenderCurrentChunk ( )

[Render] Renders information about the current chunk the player is in

Renders information about the current chunk.

Shows the coordinates of the current chunk and the next chunk in the main path.

◆ Debug_RenderFPSCount()

void Debug_RenderFPSCount ( )

[Render] Renders the current FPS counter in the top-left corner

Renders the current FPS count.

Creates and updates a text element showing the current frames per second.

◆ Debug_RenderHitboxes()

void Debug_RenderHitboxes ( )

[Render] Renders all active hitboxes when debug mode is enabled

Renders the hitboxes of game objects.

Iterates through all registered colliders and draws their hitboxes with different colors based on their collision layer.

◆ Debug_RenderSpikeCount()

void Debug_RenderSpikeCount ( )

[Render] Renders a counter of frame spikes (frames exceeding target time)

Renders the current spike count.

Tracks and displays the number of frames that took longer than the target frame time (frames with fps below 30).