#ifndef WINDOW_H #define WINDOW_H #include "aliases/aliases.h" #include #include #include #include typedef struct point point_t; typedef struct line line_t; typedef struct triangle triangle_t; typedef struct rect rect_t; typedef struct window window_t; struct point { i32 x; i32 y; }; struct line { point_t p0; point_t p1; }; struct triangle { point_t p0; point_t p1; point_t p2; }; struct rect { point_t topleft; i32 w; i32 h; }; struct window { u32 id; u64 x; u64 y; u64 width; u64 height; const char *title; SDL_Window *window; SDL_Renderer *renderer; }; typedef struct colour colour_t; struct colour { union { u32 abgr; SDL_Color colour; }; }; bool init_window(window_t *wnd, const char *title, u32 width, u32 height, i32 x, i32 y); void cleanup_window(window_t *wnd); void clear_window(const window_t *wnd, colour_t colour); void swap_buffers(const window_t *wnd); void draw_point(const window_t *wnd, point_t p, colour_t colour); void draw_line(const window_t *wnd, const line_t *ln, colour_t colour); void draw_triangle(const window_t *wnd, triangle_t triangle, colour_t colour); void fill_triangle(const window_t *wnd, triangle_t triangle, colour_t colour); void draw_rect(const window_t *wnd, rect_t rect, colour_t colour); void fill_rect(const window_t *wnd, rect_t rect, colour_t colour); #endif // !WINDOW_H