aboutsummaryrefslogtreecommitdiffstats
path: root/src/renderer.h
blob: e6637efe37853051eb457aa642555e907199d37f (plain)
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
#ifndef RENDERER_H
#define RENDERER_H

#include "gba/gba.h"

// Draws a pixel to the given (x, y) position on the framebuffer. All drawing
// functions use paletted colors (clr: 0-15).
void draw_pixel(size_t x, size_t y, u8 clr);

// Draw a line between (x0, y0) and (x1, y1).
void draw_line(size_t x0, size_t y0, size_t x1, size_t y1, u8 clr);

// Draw a rectangle between (x0, y0) and (x1, y1) (x0 <= x1 && y0 <= y1).
void draw_rect(size_t x0, size_t y0, size_t x1, size_t y1, u8 clr);

// Draw a filled rectangle between (x0, y0) and (x1, y1) (x0 <= x1 and y0 <= y1).
void draw_filled_rect(size_t x0, size_t y0, size_t x1, size_t y1, u8 clr);

// Fills the framebuffer with the given color.
void screen_fill(u8 clr);

// Draws a chr sprite (16 * u8). The first 8 bytes correspond to ch0 and the
// last 8 to ch1. If clr is 0 the regular 4bit color will be used, from clr 1-14
// the given color will overwrite the existing one. Color 15 will "clear" the
// sprite instead.
void draw_chr(size_t x, size_t y, u8 *sprite, u8 clr, u8 flip_x, u8 flip_y);

// Draws a 1bpp icn sprite in the given color.
void draw_icn(size_t x, size_t y, u8 *sprite, u8 clr, u8 flip_x, u8 flip_y);

// Copies data and performs page flipping if needed.
// To be called exactly once at the beginning of the VBlank.
void flip_buffer(void);

// Initializes the renderer.
void renderer_init(void);

#endif // RENDERER__H