Trace Engine
A Raycaster Engine in C
Loading...
Searching...
No Matches
graphics.h File Reference

Go to the source code of this file.

Data Structures

struct  rgb_t
 

Macros

#define COLOR_BLACK   (rgb_t) { 0, 0, 0 }
 
#define COLOR_BLUE   (rgb_t) { 0, 0, 255}
 
#define COLOR_GREEN   (rgb_t) { 0, 255, 0 }
 
#define COLOR_CYAN   (rgb_t) { 0, 255, 255}
 
#define COLOR_RED   (rgb_t) {255, 0, 0 }
 
#define COLOR_MAGENTA   (rgb_t) {255, 0, 255}
 
#define COLOR_YELLOW   (rgb_t) {255, 255, 0 }
 
#define COLOR_WHITE   (rgb_t) {255, 255, 255}
 
#define BACKGROUND_COLOR   COLOR_BLACK
 

Enumerations

enum  resolutions_t { LOW_RESOLUTION = 1 , MID_RESOLUTION = 2 , HIGH_RESOLUTION = 4 }
 

Functions

resolutions_t get_actual_resolution (void)
 
void set_actual_resolution (const resolutions_t new_resolution)
 
void set_background_color (const rgb_t color)
 
void render_screen (void)
 
void draw_square (const trc_world_position_t position, const trc_world_position_t size, const int border, const rgb_t color)
 
void draw_point (const trc_world_position_t position, const int size, const rgb_t color)
 
void draw_line (const trc_world_position_t start_point, const trc_world_position_t end_point, const int thickness, const rgb_t color)
 

Macro Definition Documentation

◆ BACKGROUND_COLOR

#define BACKGROUND_COLOR   COLOR_BLACK

Color of the background (it's always block by the walls, anyway)

◆ COLOR_BLACK

#define COLOR_BLACK   (rgb_t) { 0, 0, 0 }

◆ COLOR_BLUE

#define COLOR_BLUE   (rgb_t) { 0, 0, 255}

◆ COLOR_CYAN

#define COLOR_CYAN   (rgb_t) { 0, 255, 255}

◆ COLOR_GREEN

#define COLOR_GREEN   (rgb_t) { 0, 255, 0 }

◆ COLOR_MAGENTA

#define COLOR_MAGENTA   (rgb_t) {255, 0, 255}

◆ COLOR_RED

#define COLOR_RED   (rgb_t) {255, 0, 0 }

◆ COLOR_WHITE

#define COLOR_WHITE   (rgb_t) {255, 255, 255}

◆ COLOR_YELLOW

#define COLOR_YELLOW   (rgb_t) {255, 255, 0 }

Enumeration Type Documentation

◆ resolutions_t

Fixed resolution levels

Enumerator
LOW_RESOLUTION 
MID_RESOLUTION 
HIGH_RESOLUTION 

Function Documentation

◆ draw_line()

void draw_line ( const trc_world_position_t  start_point,
const trc_world_position_t  end_point,
const int  thickness,
const rgb_t  color 
)

Draw a line of the given thickness from the given start point to the given end point with the given color

◆ draw_point()

void draw_point ( const trc_world_position_t  position,
const int  size,
const rgb_t  color 
)

Draw a point of the given size in the given position with the given color

◆ draw_square()

void draw_square ( const trc_world_position_t  position,
const trc_world_position_t  size,
const int  border,
const rgb_t  color 
)

Draw a point of the given size (plus the border) in the given position with the given color

Note
If you wan't a full square, pass a border of 0

◆ get_actual_resolution()

resolutions_t get_actual_resolution ( void  )

Returns the current selected resolution

◆ render_screen()

void render_screen ( void  )

Draw the objects in the window

◆ set_actual_resolution()

void set_actual_resolution ( const resolutions_t  new_resolution)

Updates the current resolution to the given new one

◆ set_background_color()

void set_background_color ( const rgb_t  color)

Change the color of the screen when called glClear()

Parameters
colorThe color to change to