]> git.lizzy.rs Git - nothing.git/blob - src/game/camera.h
Merge pull request #1165 from zhiayang/901
[nothing.git] / src / game / camera.h
1 #ifndef CAMERA_H_
2 #define CAMERA_H_
3
4 #include <stdbool.h>
5
6 #include "color.h"
7 #include "game/sprite_font.h"
8 #include "math/vec.h"
9 #include "math/rect.h"
10 #include "math/triangle.h"
11
12 typedef struct {
13     bool debug_mode;
14     bool blackwhite_mode;
15     Vec2f position;
16     float scale;
17     SDL_Renderer *renderer;
18     Sprite_font *font;
19 } Camera;
20
21 Camera create_camera(SDL_Renderer *renderer,
22                      Sprite_font *font);
23
24 int camera_clear_background(const Camera *camera,
25                             Color color);
26
27 int camera_fill_rect(const Camera *camera,
28                      Rect rect,
29                      Color color);
30
31 int camera_draw_rect(const Camera *camera,
32                      Rect rect,
33                      Color color);
34
35 int camera_draw_rect_screen(const Camera *camera,
36                             Rect rect,
37                             Color color);
38
39 int camera_draw_thicc_rect_screen(const Camera *camera,
40                                   Rect rect,
41                                   Color color,
42                                   float thiccness);
43
44 int camera_draw_line(const Camera *camera,
45                      Vec2f begin, Vec2f end,
46                      Color color);
47
48 int camera_draw_triangle(Camera *camera,
49                          Triangle t,
50                          Color color);
51
52 int camera_fill_triangle(const Camera *camera,
53                          Triangle t,
54                          Color color);
55
56 int camera_render_text(const Camera *camera,
57                        const char *text,
58                        Vec2f size,
59                        Color color,
60                        Vec2f position);
61
62 int camera_render_text_screen(const Camera *camera,
63                               const char *text,
64                               Vec2f size,
65                               Color color,
66                               Vec2f position);
67
68 int camera_render_debug_text(const Camera *camera,
69                              const char *text,
70                              Vec2f position);
71
72 int camera_render_debug_rect(const Camera *camera,
73                              Rect rect,
74                              Color color);
75
76 void camera_center_at(Camera *camera, Vec2f position);
77 void camera_scale(Camera *came, float scale);
78
79 void camera_toggle_debug_mode(Camera *camera);
80 void camera_disable_debug_mode(Camera *camera);
81
82 int camera_is_point_visible(const Camera *camera, Vec2f p);
83 int camera_is_text_visible(const Camera *camera,
84                            Vec2f size,
85                            Vec2f position,
86                            const char *text);
87
88 Rect camera_view_port(const Camera *camera);
89
90 Rect camera_view_port_screen(const Camera *camera);
91
92 Vec2f camera_map_screen(const Camera *camera,
93                         Sint32 x, Sint32 y);
94
95 Vec2f camera_point(const Camera *camera, const Vec2f p);
96 Rect camera_rect(const Camera *camera, const Rect rect);
97
98 int camera_fill_rect_screen(const Camera *camera,
99                             Rect rect,
100                             Color color);
101
102 const Sprite_font *camera_font(const Camera *camera);
103
104 #endif  // CAMERA_H_