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
3
static
uint8_t
flush_mode
;
4
static
color_t
tint
= {0xFF00};
5
static
color_t
clear
= {0x0FFF};
6
7
color_t
draw_color
= {0x00FF};
8
uint8_t
draw_mode
;
9
10
void
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
) {
26
draw_color
.
arr
[0] =
clear
.
pixel
;
27
draw_color
.
arr
[1] =
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
{
35
draw_color
.
arr
[0] =
tint
.
pixel
;
36
draw_color
.
arr
[1] =
tint
.
pixel
;
37
}
38
}
39
40
void
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) {
48
draw_color
.
arr
[0] =
clear
.
pixel
;
49
draw_color
.
arr
[1] =
clear
.
pixel
;
50
}
else
{
51
draw_color
.
arr
[0] =
tint
.
pixel
;
52
draw_color
.
arr
[1] =
tint
.
pixel
;
53
}
54
}
55
}
draw_mode
uint8_t draw_mode
Definition
draw_color.c:8
draw_color
color_t draw_color
Definition
draw_color.c:7
clear
static color_t clear
Definition
draw_color.c:5
flush_mode
static uint8_t flush_mode
Definition
draw_color.c:3
draw_cmd_color
void draw_cmd_color(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
Definition
draw_color.c:10
draw_cmd_mode
void draw_cmd_mode(uint8_t drawmode, uint8_t flushmode, uint8_t change_mode, uint8_t change_flush)
Definition
draw_color.c:40
tint
static color_t tint
Definition
draw_color.c:4
zeebo.h
color_t::arr
uint16_t arr[2]
Definition
zeebo.h:13
color_t::c16
struct color_t::@0 c16
color_t::pixel
uint16_t pixel
Definition
zeebo.h:11
color_t::pixel2
uint32_t pixel2
Definition
zeebo.h:12
color_t
Definition
zeebo.h:10
src
draw_color.c
Generated by
1.12.0