-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDisplay.h
54 lines (42 loc) · 1.18 KB
/
Display.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef DISPLAY_H
#define DISPLAY_H
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <SDL.h>
#undef main // To maae C++ work fine
#define FPS 60
#define FRAME_TARGET_TIME (1000 / FPS)
enum cull_method {
CULL_NONE,
CULL_BACKFACE
};
enum render_method {
RENDER_WIRE,
RENDER_WIRE_VERTEX,
RENDER_FILL_TRIANGLE,
RENDER_FILL_TRIANGLE_WIRE,
RENDER_TEXTURED,
RENDER_TEXTURED_WIRE
};
bool initialize_window(void);
int get_window_width(void);
int get_window_height(void);
void set_render_method(int method);
void set_cull_method(int method);
bool should_cull_backface(void);
bool should_render_textured_triangles(void);
bool should_render_wireframe(void);
bool should_render_filled_triangles(void);
bool should_render_wire_vertex(void);
void draw_grid(void);
void draw_pixel(int x, int y, uint32_t color);
void draw_line(int x0, int y0, int x1, int y1, uint32_t color);
void draw_rect(int x, int y, int width, int height, uint32_t color);
void render_color_buffer(void);
void clear_color_buffer(uint32_t color);
void clear_z_buffer(void);
float get_zbuffer_at(int x, int y);
void update_zbuffer_at(int x, int y, float value);
void destroy_window(void);
#endif