Skip to content

Code_common

lemmiix edited this page Nov 5, 2025 · 2 revisions

Common documentation

common

#define WINDOW_WIDTH 800

Definition for the window width.


#define WINDOW_HEIGHT 600

Definition for the window height.


#define FONT "terminal-f4.ttf"

Definition for the font that is used.


#define MOVEMENT_SPEED 200.0f

Definition for the speed at which all moving objects are orienting themselves around.


extern float delta_time;

Definition for the delta time that is used by all moving objects to be consistent at each framerate.


extern SDL_Renderer* renderer;

Definition for the renderer that is used to draw objects on.


extern SDL_Window* window;

Definition for the window that is being created for the game.


SDL_Point get_player_pos();

This makes the player position available globally.
@return An SDL_Point with X and Y coordinate of the player centroid


SDL_Point get_mouse_pos();

This makes the mouse position available globally.
@return An SDL_Point with X and Y coordinate of the mouse tip


float get_player_rot();

This makes the player rotation available globally.
@return the current rotation of the player, relative to the normal facing direction (right) as radians


typedef enum gamestate {
	RUNNING,
	PAUSED,
	GAME_OVER,
	QUIT,
} Game_state;

This enum lists all available modes the game can be in.

Quicknav

Go back to wiki home

Code documentation:
doc_code

Architecture documentation:
doc_arch

Project license

Clone this wiki locally