-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrenderer.h
42 lines (36 loc) · 1.29 KB
/
renderer.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
#ifndef RENDERER_H
#define RENDERER_H
#include <stdlib.h>
#include <stdint.h>
#include "vector2.h"
#include "color.h"
typedef struct graphics {
uint32_t width;
uint32_t height;
uint32_t pitch;
uint32_t bpp;
uint8_t *mem;
uint8_t *fb;
} graphics_t;
typedef struct cvertex {
vector2_t pos;
color_t color;
} cvertex_t;
graphics_t *graphics_create(size_t width, size_t height, size_t depth);
void graphics_blank(const graphics_t *device);
void graphics_background_color(const graphics_t *device, const color_t *color);
void graphics_draw(const graphics_t *device,
const cvertex_t *vertices, size_t len);
void graphics_draw_rectangle(const graphics_t *device, const color_t *color,
const vector2_t *pos, const vector2_t *hw);
void graphics_draw_rectangle_outline(const graphics_t *device,
const color_t *color, const vector2_t *pos, const vector2_t *hw);
void graphics_draw_rectangle_dither(const graphics_t *device,
const color_t *color, const vector2_t *pos, const vector2_t *hw);
void graphics_draw_image(const graphics_t *device, const vector2_t *pos,
const unsigned char *image, const color_t *tint);
void graphics_draw_line(const graphics_t *device,
const cvertex_t *v1, const cvertex_t *v2);
void graphics_redraw(const graphics_t *device);
void graphics_flush(graphics_t *device);
#endif