Trace Engine
A Raycaster Engine in C
Loading...
Searching...
No Matches
graphics.h
Go to the documentation of this file.
1#ifndef _H_GRAPHICS
2#define _H_GRAPHICS
3
5
9typedef struct {
10 unsigned char r;
11 unsigned char g;
12 unsigned char b;
13} rgb_t;
14
15// A few colors, useful for testing or drawing directly
16
17#define COLOR_BLACK (rgb_t) { 0, 0, 0 }
18#define COLOR_BLUE (rgb_t) { 0, 0, 255}
19#define COLOR_GREEN (rgb_t) { 0, 255, 0 }
20#define COLOR_CYAN (rgb_t) { 0, 255, 255}
21#define COLOR_RED (rgb_t) {255, 0, 0 }
22#define COLOR_MAGENTA (rgb_t) {255, 0, 255}
23#define COLOR_YELLOW (rgb_t) {255, 255, 0 }
24#define COLOR_WHITE (rgb_t) {255, 255, 255}
25
27#define BACKGROUND_COLOR COLOR_BLACK
28
36
41
45void set_actual_resolution(const resolutions_t new_resolution);
46
52void set_background_color(const rgb_t color);
53
57void render_screen(void);
58
64void draw_square(const trc_world_position_t position, const trc_world_position_t size, const int border, const rgb_t color);
65
69void draw_point(const trc_world_position_t position, const int size, const rgb_t color);
70
74void draw_line(const trc_world_position_t start_point, const trc_world_position_t end_point, const int thickness, const rgb_t color);
75
76#endif
resolutions_t
Definition graphics.h:31
@ LOW_RESOLUTION
Definition graphics.h:32
@ MID_RESOLUTION
Definition graphics.h:33
@ HIGH_RESOLUTION
Definition graphics.h:34
void render_screen(void)
Definition graphics.c:27
void set_actual_resolution(const resolutions_t new_resolution)
Definition graphics.c:17
void draw_line(const trc_world_position_t start_point, const trc_world_position_t end_point, const int thickness, const rgb_t color)
Definition graphics.c:71
resolutions_t get_actual_resolution(void)
Definition graphics.c:12
void set_background_color(const rgb_t color)
Definition graphics.c:22
void draw_square(const trc_world_position_t position, const trc_world_position_t size, const int border, const rgb_t color)
Definition graphics.c:49
void draw_point(const trc_world_position_t position, const int size, const rgb_t color)
Definition graphics.c:61
Definition graphics.h:9
unsigned char g
Definition graphics.h:11
unsigned char b
Definition graphics.h:12
unsigned char r
Definition graphics.h:10
Definition trc_world_position.h:7