aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-06-07 19:27:34 +0200
committerBad Diode <bd@badd10de.dev>2021-06-07 19:27:34 +0200
commitdf32deb2e40c1bddf2441d4681486b8b2e3fc004 (patch)
tree1acc026d5af59422fbdd8f5179afe7196202fb48 /src
parentac0cced1c487e1b98d2b834d5b462d46a7732569 (diff)
downloadstepper-df32deb2e40c1bddf2441d4681486b8b2e3fc004.tar.gz
stepper-df32deb2e40c1bddf2441d4681486b8b2e3fc004.zip
Change font used to a custom mixed font
Diffstat (limited to 'src')
-rw-r--r--src/bd-font.c141
-rw-r--r--src/gba/gba.h3
-rw-r--r--src/text/font.h137
-rw-r--r--src/text/text.h4
4 files changed, 139 insertions, 146 deletions
diff --git a/src/bd-font.c b/src/bd-font.c
deleted file mode 100644
index 5276735..0000000
--- a/src/bd-font.c
+++ /dev/null
@@ -1,141 +0,0 @@
1/*
2Copyright (c) 2021 Bad Diode
3
4Permission to use, copy, modify, and distribute this software for any
5purpose with or without fee is hereby granted, provided that the above
6copyright notice and this permission notice appear in all copies.
7
8THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9WITH REGARD TO THIS SOFTWARE.
10*/
11
12static const u32 bd_font[] = {
13 0x00000000, 0x00000000, 0x00002400, 0x423c0000,
14 0x00002400, 0x3c420000, 0x0000363e, 0x3e1c0800,
15 0x00081c3e, 0x3e1c0800, 0x001c1c3e, 0x363e081c,
16 0x00081c3e, 0x3e3e081c, 0x00000018, 0x18000000,
17 0x7e7e7e66, 0x667e7e7e, 0x00001824, 0x24180000,
18 0x7e7e665a, 0x5a667e7e, 0x00081c3e, 0x081c221c,
19 0x001c221c, 0x08083e08, 0x00183828, 0x08080c0c,
20 0x003c2424, 0x24343606, 0x00082208, 0x1c082208,
21 0x040c1c3c, 0x1c0c0400, 0x2030383c, 0x38302000,
22 0x081c3e08, 0x083e1c08, 0x00141414, 0x14140014,
23 0x003c2a2a, 0x2c282828, 0x0038043c, 0x423c201e,
24 0x00000000, 0x7e000000, 0x081c3e08, 0x3e1c083e,
25 0x081c3e08, 0x08080800, 0x00080808, 0x083e1c08,
26 0x00001030, 0x7e301000, 0x0000080c, 0x7e0c0800,
27 0x00000000, 0x0002023e, 0x00002466, 0xff662400,
28 0x0008081c, 0x1c3e3e00, 0x003e3e1c, 0x1c080800,
29 0x00000000, 0x00000000, 0x00080808, 0x08080008,
30 0x14141400, 0x00000000, 0x0000143e, 0x143e1400,
31 0x00081c02, 0x1c201e08, 0x00002616, 0x08343200,
32 0x00081408, 0x34122c00, 0x08080800, 0x00000000,
33 0x08040404, 0x04040408, 0x08101010, 0x10101008,
34 0x00001408, 0x3e081400, 0x00000808, 0x3e080800,
35 0x00000000, 0x000c0804, 0x00000000, 0x3e000000,
36 0x00000000, 0x000c0c00, 0x00203018, 0x0c060200,
37 0x00001c22, 0x2a221c00, 0x00000c0a, 0x08083e00,
38 0x00001c20, 0x1c023e00, 0x00001c22, 0x18221c00,
39 0x00001018, 0x143e1000, 0x00003e02, 0x1e201e00,
40 0x00001c02, 0x1e221c00, 0x00003e20, 0x10080400,
41 0x00001c22, 0x1c221c00, 0x00001c22, 0x3c201c00,
42 0x00000c0c, 0x000c0c00, 0x00000c0c, 0x000c0804,
43 0x00100804, 0x04081000, 0x0000003e, 0x003e0000,
44 0x00040810, 0x10080400, 0x001c2220, 0x10080008,
45 0x001c322a, 0x1a021c00, 0x001c2222, 0x3e222200,
46 0x001e221e, 0x22221e00, 0x001c2202, 0x02221c00,
47 0x000e1222, 0x22120e00, 0x003e021e, 0x02023e00,
48 0x003e021e, 0x02020200, 0x001c2202, 0x32221c00,
49 0x00222222, 0x3e222200, 0x003e0808, 0x08083e00,
50 0x00202020, 0x22221c00, 0x0022120a, 0x0e122200,
51 0x00020202, 0x02023e00, 0x0022362a, 0x22222200,
52 0x0022262a, 0x32222200, 0x001c2222, 0x22221c00,
53 0x001e2222, 0x1e020200, 0x001c2222, 0x2a122c00,
54 0x001e2222, 0x1e122200, 0x001c021c, 0x20221c00,
55 0x003e0808, 0x08080800, 0x00222222, 0x22221c00,
56 0x00222222, 0x22140800, 0x0022222a, 0x2a2a1400,
57 0x00221408, 0x08142200, 0x00222214, 0x08080800,
58 0x003e1008, 0x04023e00, 0x1c040404, 0x0404041c,
59 0x0002060c, 0x18302000, 0x1c101010, 0x1010101c,
60 0x08142200, 0x00000000, 0x00000000, 0x00003e00,
61 0x00040810, 0x00000000, 0x00001c20, 0x3c223c00,
62 0x0002021e, 0x22221e00, 0x00001c22, 0x02221c00,
63 0x0020203c, 0x22223c00, 0x00001c22, 0x1e023c00,
64 0x00003c02, 0x021e0202, 0x00003c22, 0x223c201c,
65 0x0002021e, 0x22222200, 0x0008000c, 0x08083e00,
66 0x00200020, 0x2020221c, 0x0002120a, 0x060a3200,
67 0x000c0808, 0x08083e00, 0x0000162a, 0x2a2a2a00,
68 0x00000e32, 0x22222200, 0x00001c22, 0x22221c00,
69 0x00001e22, 0x221e0202, 0x00003c22, 0x223c2070,
70 0x00001a26, 0x02020200, 0x00001c02, 0x1c201e00,
71 0x00043e04, 0x04041800, 0x00002222, 0x22221c00,
72 0x00002222, 0x22140800, 0x00002222, 0x2a2a1400,
73 0x00002214, 0x08142200, 0x00002222, 0x223c201c,
74 0x00003e10, 0x08043e00, 0x18040402, 0x02040418,
75 0x00080808, 0x08080808, 0x0c101020, 0x2010100c,
76 0x00002c1a, 0x00000000, 0x00000814, 0x22223e00,
77 0x001c2202, 0x221c080e, 0x00140022, 0x2222221c,
78 0x1008001c, 0x221e023c, 0x0814001c, 0x203c223c,
79 0x0014001c, 0x203c223c, 0x0408001c, 0x203c223c,
80 0x0814081c, 0x203c223c, 0x00001c02, 0x221c080e,
81 0x0814001c, 0x221e023c, 0x0014001c, 0x221e023c,
82 0x0408001c, 0x221e023c, 0x0014000c, 0x0808083e,
83 0x0014000c, 0x0808083e, 0x0408000c, 0x0808083e,
84 0x0014001c, 0x223e2222, 0x0814081c, 0x223e2222,
85 0x1008003e, 0x021e023e, 0x00001628, 0x1c0a3400,
86 0x003c0a1a, 0x0e0a3a00, 0x0814001c, 0x2222221c,
87 0x0014001c, 0x2222221c, 0x0408001c, 0x2222221c,
88 0x08140022, 0x2222221c, 0x04080022, 0x2222221c,
89 0x00140022, 0x223c201c, 0x14001c22, 0x2222221c,
90 0x14002222, 0x2222221c, 0x00081c22, 0x02221c08,
91 0x0018240e, 0x04043e00, 0x00221408, 0x1c081c08,
92 0x0038041e, 0x041e0438, 0x0030081c, 0x08080806,
93 0x1008001c, 0x203c223c, 0x1008000c, 0x0808083e,
94 0x1008001c, 0x2222221c, 0x10080022, 0x2222221c,
95 0x2c1a000e, 0x32222222, 0x2c1a0022, 0x262a3222,
96 0x001c122c, 0x001e0000, 0x000c120c, 0x001e0000,
97 0x08000804, 0x02221c00, 0x0000003e, 0x02020000,
98 0x0000003e, 0x20200000, 0x06241468, 0x4422f000,
99 0x06241468, 0x54f24000, 0x08000808, 0x08080800,
100 0x00482412, 0x24480000, 0x00122448, 0x24120000,
101 0x00880022, 0x00880022, 0x55885522, 0x55885522,
102 0x55aa55aa, 0x55aa55aa, 0x08080808, 0x08080808,
103 0x0808080f, 0x08080808, 0x08080f08, 0x0f080808,
104 0x14141417, 0x14141414, 0x0000001f, 0x14141414,
105 0x00000f08, 0x0f080808, 0x14141710, 0x17141414,
106 0x14141414, 0x14141414, 0x00001f10, 0x17141414,
107 0x14141710, 0x1f000000, 0x1414141f, 0x00000000,
108 0x08080f08, 0x0f000000, 0x0000000f, 0x08080808,
109 0x080808f8, 0x00000000, 0x080808ff, 0x00000000,
110 0x000000ff, 0x08080808, 0x080808f8, 0x08080808,
111 0x000000ff, 0x00000000, 0x080808ff, 0x08080808,
112 0x0808f808, 0xf8080808, 0x141414f4, 0x14141414,
113 0x1414f404, 0xfc000000, 0x0000fc04, 0xf4141414,
114 0x1414f700, 0xff000000, 0x0000ff00, 0xf7141414,
115 0x1414f404, 0xf4141414, 0x0000ff00, 0xff000000,
116 0x1414f700, 0xf7141414, 0x0808ff00, 0xff000000,
117 0x141414ff, 0x00000000, 0x0000ff00, 0xff080808,
118 0x000000ff, 0x14141414, 0x141414fc, 0x00000000,
119 0x0808f808, 0xf8000000, 0x0000f808, 0xf8080808,
120 0x000000fc, 0x14141414, 0x141414ff, 0x14141414,
121 0x0808ff08, 0xff080808, 0x0808080f, 0x00000000,
122 0x000000f8, 0x08080808, 0xffffffff, 0xffffffff,
123 0x00000000, 0xffffffff, 0x0f0f0f0f, 0x0f0f0f0f,
124 0xf0f0f0f0, 0xf0f0f0f0, 0xffffffff, 0x00000000,
125 0x00002c12, 0x12122c00, 0x000c120a, 0x12223a02,
126 0x003e2202, 0x02020200, 0x00003e14, 0x14141400,
127 0x3e220408, 0x04223e00, 0x00003c12, 0x12120c00,
128 0x00002222, 0x221e0202, 0x002c1a08, 0x08281000,
129 0x1c081c22, 0x221c081c, 0x1c22223e, 0x22221c00,
130 0x1c222222, 0x22143600, 0x1e041824, 0x22221c00,
131 0x0000142a, 0x2a140000, 0x0020142a, 0x2a140200,
132 0x00003c02, 0x1c023c00, 0x001c2222, 0x22222202,
133 0x00003e00, 0x3e003e00, 0x0000081c, 0x08001c00,
134 0x04081008, 0x04001c00, 0x10080408, 0x10001c00,
135 0x30480808, 0x08080808, 0x08080808, 0x08080906,
136 0x00000800, 0x3e000800, 0x00004c32, 0x004c3200,
137 0x00182418, 0x00000000, 0x00001c1c, 0x1c000000,
138 0x00000018, 0x18000000, 0x00f01010, 0x10121418,
139 0x0c342424, 0x00000000, 0x1810083c, 0x00000000,
140 0x00003c3c, 0x3c3c0000, 0x00000000, 0x00000000,
141};
diff --git a/src/gba/gba.h b/src/gba/gba.h
index a53363a..e475ea9 100644
--- a/src/gba/gba.h
+++ b/src/gba/gba.h
@@ -324,9 +324,6 @@ key_hold(u32 key) {
324 return key_curr & key_prev & key; 324 return key_curr & key_prev & key;
325} 325}
326 326
327// Check if the given key/button is currently pressed.
328#define KEY_PRESSED(key) (~(KEY_INPUTS) & key)
329
330// Back/unpack bits. 327// Back/unpack bits.
331static inline 328static inline
332u32 329u32
diff --git a/src/text/font.h b/src/text/font.h
new file mode 100644
index 0000000..65579b8
--- /dev/null
+++ b/src/text/font.h
@@ -0,0 +1,137 @@
1static const u32 font[] = {
2 0x00000000, 0x00000000, 0x00002400, 0x423c0000,
3 0x00002400, 0x3c420000, 0x0000363e, 0x3e1c0800,
4 0x00081c3e, 0x3e1c0800, 0x001c1c3e, 0x363e081c,
5 0x00081c3e, 0x3e3e081c, 0x00000018, 0x18000000,
6 0x7e7e7e66, 0x667e7e7e, 0x00001824, 0x24180000,
7 0x7e7e665a, 0x5a667e7e, 0x00081c3e, 0x081c221c,
8 0x001c221c, 0x08083e08, 0x00183828, 0x08080c0c,
9 0x003c2424, 0x24343606, 0x00082208, 0x1c082208,
10 0x040c1c3c, 0x1c0c0400, 0x2030383c, 0x38302000,
11 0x081c3e08, 0x083e1c08, 0x00141414, 0x14001400,
12 0x003c2a2a, 0x2c282828, 0x0038043c, 0x423c201e,
13 0x00000000, 0x7e000000, 0x081c3e08, 0x3e1c083e,
14 0x00081c3e, 0x08080800, 0x00080808, 0x3e1c0800,
15 0x00001030, 0x7e301000, 0x0000080c, 0x7e0c0800,
16 0x00000000, 0x0002023e, 0x00001436, 0x7f361400,
17 0x0008081c, 0x1c3e3e00, 0x003e3e1c, 0x1c080800,
18 0x00000000, 0x00000000, 0x00080808, 0x08000800,
19 0x00141414, 0x00000000, 0x0000143e, 0x143e1400,
20 0x00081c02, 0x1c201e08, 0x00002616, 0x08343200,
21 0x00081408, 0x34122c00, 0x00080808, 0x00000000,
22 0x00000804, 0x04040800, 0x00000810, 0x10100800,
23 0x00001408, 0x3e081400, 0x00000808, 0x3e080800,
24 0x00000000, 0x000c0804, 0x00000000, 0x3e000000,
25 0x00000000, 0x000c0c00, 0x00203018, 0x0c060200,
26 0x00001c22, 0x2a221c00, 0x00000c0a, 0x08083e00,
27 0x00001c20, 0x1c023e00, 0x00001c22, 0x18221c00,
28 0x00001212, 0x123e1000, 0x00003e02, 0x1e201e00,
29 0x00001c02, 0x1e221c00, 0x00003e20, 0x10080400,
30 0x00001c22, 0x1c221c00, 0x00001c22, 0x3c201c00,
31 0x00000c0c, 0x000c0c00, 0x00000c0c, 0x000c0804,
32 0x00001008, 0x04081000, 0x0000003e, 0x003e0000,
33 0x00000408, 0x10080400, 0x001c2210, 0x08000800,
34 0x00001c2a, 0x3a021c00, 0x00001c22, 0x223e2200,
35 0x00001e22, 0x1e221e00, 0x00001c22, 0x02221c00,
36 0x00001e22, 0x22221e00, 0x00003e02, 0x1e023e00,
37 0x00003e02, 0x1e020200, 0x00001c02, 0x32221c00,
38 0x00002222, 0x3e222200, 0x00003e08, 0x08083e00,
39 0x00002020, 0x20221c00, 0x00002212, 0x0e122200,
40 0x00000202, 0x02023e00, 0x00002236, 0x2a222200,
41 0x0000262a, 0x32222200, 0x00001c22, 0x22221c00,
42 0x00001e22, 0x221e0200, 0x00001c22, 0x22122c00,
43 0x00001e22, 0x221e2200, 0x00001c02, 0x1c201e00,
44 0x00003e08, 0x08080800, 0x00002222, 0x22221c00,
45 0x00002222, 0x22140800, 0x0000222a, 0x2a2a1400,
46 0x00002214, 0x08142200, 0x00002222, 0x14080800,
47 0x00003e10, 0x08043e00, 0x00001c04, 0x04041c00,
48 0x0002060c, 0x18302000, 0x00001c10, 0x10101c00,
49 0x00081422, 0x00000000, 0x00000000, 0x00003e00,
50 0x00040810, 0x00000000, 0x00001c20, 0x3c223c00,
51 0x0002021e, 0x22221e00, 0x00001c02, 0x02021c00,
52 0x0020203c, 0x22223c00, 0x00001c22, 0x1e021c00,
53 0x00003c02, 0x1e020200, 0x00003c22, 0x223c201c,
54 0x0002021e, 0x22222200, 0x0008000c, 0x08083e00,
55 0x00200020, 0x2020221c, 0x0002120a, 0x060a3200,
56 0x000c0808, 0x08083e00, 0x0000162a, 0x2a2a2a00,
57 0x00000e32, 0x22222200, 0x00001c22, 0x22221c00,
58 0x00001e22, 0x221e0202, 0x00003c22, 0x223c2070,
59 0x00001a26, 0x02020200, 0x00001c02, 0x1c201e00,
60 0x00043e04, 0x04041800, 0x00002222, 0x22221c00,
61 0x00002222, 0x22140800, 0x00002222, 0x2a2a1400,
62 0x00002214, 0x08142200, 0x00002222, 0x223c201c,
63 0x00003e10, 0x08043e00, 0x00001c04, 0x06041c00,
64 0x00000808, 0x08080800, 0x00001c10, 0x30101c00,
65 0x00002c1a, 0x00000000, 0x00000814, 0x22223e00,
66 0x00001c14, 0x14141c00, 0x0000080c, 0x08081c00,
67 0x00001c10, 0x1c041c00, 0x00001c10, 0x18101c00,
68 0x00001414, 0x1c101000, 0x00001c04, 0x1c101c00,
69 0x00001c04, 0x1c141c00, 0x00001c10, 0x08040400,
70 0x00001c14, 0x1c141c00, 0x00001c14, 0x1c101000,
71 0x00001c14, 0x141c1400, 0x00001c14, 0x0c141c00,
72 0x00001c04, 0x04041c00, 0x00000c14, 0x14140c00,
73 0x00001c04, 0x0c041c00, 0x00001c04, 0x0c040400,
74 0x00001c04, 0x14141c00, 0x00001414, 0x1c141400,
75 0x00001c08, 0x08081c00, 0x00001010, 0x10141c00,
76 0x00001414, 0x0c141400, 0x00000404, 0x04041c00,
77 0x0000141c, 0x14141400, 0x00000c14, 0x14141400,
78 0x00000c14, 0x14141c00, 0x00001c14, 0x1c040400,
79 0x00001c14, 0x141c1000, 0x00001c14, 0x0c141400,
80 0x00001804, 0x1c100c00, 0x00001c08, 0x08080800,
81 0x00001414, 0x14141c00, 0x00001414, 0x14141800,
82 0x00001414, 0x141c1400, 0x00001414, 0x08141400,
83 0x00001414, 0x1c080800, 0x00001c10, 0x08041c00,
84 0x00000000, 0x00000000, 0x00000000, 0x00000000,
85 0x00000000, 0x00000000, 0x00000000, 0x00000000,
86 0x00000000, 0x00000000, 0x00000000, 0x00000000,
87 0x00000000, 0x00000000, 0x00000000, 0x00000000,
88 0x00000000, 0x00000000, 0x00000000, 0x00000000,
89 0x00000000, 0x00000000, 0x00000000, 0x00000000,
90 0x00000000, 0x00000000, 0x00000000, 0x00000000,
91 0x00000000, 0x00000000, 0x00000000, 0x00000000,
92 0x00000000, 0x00000000, 0x00000000, 0x00000000,
93 0x00000000, 0x00000000, 0x00000000, 0x00000000,
94 0x00000000, 0x00000000, 0x00000000, 0x00000000,
95 0x00000000, 0x00000000, 0x00000000, 0x00000000,
96 0x00000000, 0x00000000, 0x00000000, 0x00000000,
97 0x00000000, 0x00000000, 0x00000000, 0x00000000,
98 0x00000000, 0x00000000, 0x00000000, 0x00000000,
99 0x00000000, 0x00000000, 0x00000000, 0x00000000,
100 0x00000000, 0x00000000, 0x00000000, 0x00000000,
101 0x00000000, 0x00000000, 0x00000000, 0x00000000,
102 0x00000000, 0x00000000, 0x00000000, 0x00000000,
103 0x00000000, 0x00000000, 0x00000000, 0x00000000,
104 0x00000000, 0x00000000, 0x00000000, 0x00000000,
105 0x00000000, 0x00000000, 0x00000000, 0x00000000,
106 0x3e323232, 0x32323e00, 0x18181818, 0x18181800,
107 0x3e30303e, 0x06063e00, 0x3e30303c, 0x30303e00,
108 0x32323232, 0x3e303000, 0x3e06063e, 0x30303e00,
109 0x3e06063e, 0x26263e00, 0x3e303018, 0x0c060600,
110 0x3e32323e, 0x32323e00, 0x3e32323e, 0x30303e00,
111 0x00000000, 0x00060600, 0x00263618, 0x0c363200,
112 0x1c3e3232, 0x3e323200, 0x1e26261e, 0x26261e00,
113 0x3c060606, 0x06063c00, 0x1e323232, 0x32321e00,
114 0x3e06061e, 0x06063e00, 0x3e06061e, 0x06060600,
115 0x3c060636, 0x26261c00, 0x3232323e, 0x32323200,
116 0x1e0c0c0c, 0x0c0c1e00, 0x30303030, 0x32323e00,
117 0x2626160e, 0x16262600, 0x06060606, 0x06063e00,
118 0x62767e6a, 0x62626200, 0x363e3a32, 0x32323200,
119 0x1c323232, 0x32321c00, 0x3e32323e, 0x02020200,
120 0x1c323232, 0x3a1a2c00, 0x1e26261e, 0x26262600,
121 0x3c06061e, 0x30301e00, 0x7e181818, 0x18181800,
122 0x32323232, 0x32323e00, 0x32323232, 0x32341800,
123 0x32323232, 0x323a1400, 0x3232320c, 0x32323200,
124 0x32323232, 0x3c201e00, 0x3e30301c, 0x06063e00,
125 0x00000000, 0x00000000, 0x00000000, 0x00000000,
126 0x00000000, 0x00000000, 0x00000000, 0x00000000,
127 0x00000000, 0x00000000, 0x00000000, 0x00000000,
128 0x00000000, 0x00000000, 0x00000000, 0x00000000,
129 0x00000000, 0x00000000, 0x00000000, 0x00000000,
130};
131
132u16 palette[16] = {
133 0x7fff, 0x0000, 0x7fff, 0x7fff,
134 0x7fff, 0x7fff, 0x7fff, 0x7fff,
135 0x7fff, 0x7fff, 0x7fff, 0x7fff,
136 0x7fff, 0x7fff, 0x7fff, 0x7fff,
137};
diff --git a/src/text/text.h b/src/text/text.h
index 3b7921d..01dddb0 100644
--- a/src/text/text.h
+++ b/src/text/text.h
@@ -4,7 +4,7 @@
4#include "posprintf.h" 4#include "posprintf.h"
5#include "renderer.h" 5#include "renderer.h"
6 6
7#include "bd-font.c" 7#include "font.h"
8 8
9typedef struct TextEngine { 9typedef struct TextEngine {
10 // Cursor for tiled text mode The X and Y positions correspond to the tile 10 // Cursor for tiled text mode The X and Y positions correspond to the tile
@@ -30,7 +30,7 @@ static inline
30void 30void
31txt_init(u32 *font_data, u16 *font_tilemap, u16 font_offset) { 31txt_init(u32 *font_data, u16 *font_tilemap, u16 font_offset) {
32 // Load font data into VRAM. 32 // Load font data into VRAM.
33 unpack_tiles(&bd_font, font_data, 256); 33 unpack_tiles(&font, font_data, 256);
34 34
35 // Initialize the font map translation table. That way we can write 35 // Initialize the font map translation table. That way we can write
36 // a character on the text background layer with: 36 // a character on the text background layer with: