Core Native GBA 0.0.17
create your own game-engine with just lua for nitendo game boy advance console.
Loading...
Searching...
No Matches
draw_color.c
Go to the documentation of this file.
1#include "zeebo.h"
2
3static uint8_t flush_mode;
4static color_t tint = {0xFF00};
5static color_t clear = {0x0FFF};
6
7color_t draw_color = {0x00FF};
8uint8_t draw_mode;
9
10void draw_cmd_color(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
11{
12 if (draw_mode != 3) {
13 tint.c16.color.r = r>>3;
14 tint.c16.color.g = g>>3;
15 tint.c16.color.b = b>>3;
16 } else {
17 clear.c16.color.r = r>>3;
18 clear.c16.color.g = g>>3;
19 clear.c16.color.b = b>>3;
20 }
21
22 if (flush_mode) {
23 static const uint32_t *end = (uint32_t *) (0x06000000 + (240 * 160 * 2));
24 static uint16_t old_clear = 0;
25 if (old_clear != clear.pixel) {
28 uint32_t *i = (uint32_t *) 0x06000000;
29 while (i < end) {
30 *i++ = draw_color.pixel2;
31 }
32 old_clear = clear.pixel;
33 }
34 } else {
37 }
38}
39
40void draw_cmd_mode(uint8_t drawmode, uint8_t flushmode, uint8_t change_mode, uint8_t change_flush)
41{
42 if (change_mode) {
43 draw_mode = drawmode;
44 }
45 if (change_flush) {
46 flush_mode = flushmode;
47 if (flushmode) {
50 } else {
53 }
54 }
55}
uint8_t draw_mode
Definition draw_color.c:8
color_t draw_color
Definition draw_color.c:7
static color_t clear
Definition draw_color.c:5
static uint8_t flush_mode
Definition draw_color.c:3
void draw_cmd_color(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
Definition draw_color.c:10
void draw_cmd_mode(uint8_t drawmode, uint8_t flushmode, uint8_t change_mode, uint8_t change_flush)
Definition draw_color.c:40
static color_t tint
Definition draw_color.c:4
uint16_t arr[2]
Definition zeebo.h:13
struct color_t::@0 c16
uint16_t pixel
Definition zeebo.h:11
uint32_t pixel2
Definition zeebo.h:12