Skip to content

Commit 802164b

Browse files
committed
updated to new fonts + gui string
1 parent 1c670cb commit 802164b

File tree

8 files changed

+31
-31
lines changed

8 files changed

+31
-31
lines changed

ui/config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ namespace menu {
729729
frame_buffer.clear(klib::graphics::black);
730730

731731
// draw the current token using the large font
732-
screen<FrameBuffer>::large_text.template draw<FrameBuffer>(
732+
screen<FrameBuffer>::large_text::template draw<FrameBuffer>(
733733
frame_buffer,
734734
"USB mode",
735735
klib::vector2i{60, 60} - offset.cast<int32_t>(),

ui/menu.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ namespace menu {
7575
data(args)
7676
{}
7777

78-
template <typename T, typename FrameBuffer, uint32_t BufferSize>
79-
void draw(T& writer, FrameBuffer& fb, const klib::vector2u& offset, const uint32_t selected, char option[Count][BufferSize],
78+
template <typename Font, typename FrameBuffer, uint32_t BufferSize>
79+
void draw(FrameBuffer& fb, const klib::vector2u& offset, const uint32_t selected, char option[Count][BufferSize],
8080
const klib::graphics::color foreground, const klib::graphics::color background, const bool hidden[Count] = {})
8181
{
8282
uint32_t onscreen_index = 0;
@@ -112,7 +112,7 @@ namespace menu {
112112

113113
// draw the text on the screen
114114
// write the text to the display
115-
writer.draw(
115+
Font::template draw(
116116
fb, data[i],
117117
klib::vector2i{
118118
line_boarder_pixels,

ui/mouse.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ namespace menu {
7979
frame_buffer.clear(klib::graphics::black);
8080

8181
// draw the current token using the large font
82-
screen<FrameBuffer>::large_text.template draw<FrameBuffer>(
82+
screen<FrameBuffer>::large_text::template draw<FrameBuffer>(
8383
frame_buffer,
8484
"USB jiggler",
8585
klib::vector2i{36, 60} - offset.cast<int32_t>(),

ui/numeric_popup.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,27 +136,27 @@ namespace menu {
136136
// draw the bigmaps of the arrows
137137

138138
// draw the string using the small font
139-
screen_base::large_text.template draw<FrameBuffer>(
139+
screen_base::large_text::template draw<FrameBuffer>(
140140
frame_buffer,
141141
str,
142142
klib::vector2i{
143143
(240 / 2) -
144144
static_cast<int32_t>(
145-
(klib::string::strlen(str) * screen_base::large_font.width) / 2
145+
(klib::string::strlen(str) * screen_base::large_font::width) / 2
146146
), 2
147147
} - offset.cast<int32_t>(),
148148
klib::graphics::white
149149
);
150150

151151
// draw the string using the small font
152-
screen_base::large_text.template draw<FrameBuffer>(
152+
screen_base::large_text::template draw<FrameBuffer>(
153153
frame_buffer,
154154
buffer,
155155
klib::vector2i{
156156
(240 / 2) -
157157
static_cast<int32_t>(
158-
(klib::string::strlen(buffer) * screen_base::large_font.width) / 2
159-
), (134 / 2) - (screen_base::large_font.height / 2)
158+
(klib::string::strlen(buffer) * screen_base::large_font::width) / 2
159+
), (134 / 2) - (screen_base::large_font::height / 2)
160160
} - offset.cast<int32_t>(),
161161
klib::graphics::white
162162
);

ui/screen.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ namespace menu {
8181
static inline screen_buffer<8> buffer = {};
8282

8383
// small text for in the screens
84-
constexpr static auto small_font = klib::graphics::ascii_font_8x8();
85-
static inline auto small_text = klib::graphics::string(small_font);
84+
using small_font = klib::graphics::ascii_font_8x8;
85+
using small_text = klib::graphics::string<small_font>;
8686

8787
// large text for in the screens
88-
constexpr static auto large_font = klib::graphics::ascii_font_16x16();
89-
static inline auto large_text = klib::graphics::string(large_font);
88+
using large_font = klib::graphics::ascii_font_16x16;
89+
using large_text = klib::graphics::string<large_font>;
9090

9191
/**
9292
* @brief Draws a rectangle

ui/settings.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ namespace menu {
9494
char buffer[label_count][sizeof(labels[0])] = {};
9595

9696
// update the labels
97-
options.draw(
98-
screen_base::large_text, frame_buffer,
97+
options.template draw<typename screen_base::large_text>(
98+
frame_buffer,
9999
offset, static_cast<uint8_t>(selection),
100100
buffer, klib::graphics::grey,
101101
klib::graphics::white, {}

ui/splash.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ namespace menu {
113113
);
114114

115115
// draw using the small font
116-
screen_base::small_text.template draw<FrameBuffer>(
116+
screen_base::small_text::template draw<FrameBuffer>(
117117
frame_buffer,
118118
"koon.io",
119-
klib::vector2i{240 - (7 * screen_base::small_font.width), 120} - offset.cast<int32_t>(),
119+
klib::vector2i{240 - (7 * screen_base::small_font::width), 120} - offset.cast<int32_t>(),
120120
klib::graphics::white
121121
);
122122
}

ui/totp.hpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -203,56 +203,56 @@ namespace menu {
203203
// draw the entry text with a small font above the token if we have any
204204
if (klib::string::strlen(entries[current].str)) {
205205
// draw the current token using the large font
206-
screen<FrameBuffer>::small_text.template draw<FrameBuffer>(
206+
screen<FrameBuffer>::small_text::template draw<FrameBuffer>(
207207
frame_buffer,
208208
"profile",
209209
klib::vector2i{3, 3} - offset.cast<int32_t>(),
210210
klib::graphics::white
211211
);
212212

213213
// draw the current token using the large font
214-
screen<FrameBuffer>::large_text.template draw<FrameBuffer>(
214+
screen<FrameBuffer>::large_text::template draw<FrameBuffer>(
215215
frame_buffer,
216216
entries[current].str,
217-
klib::vector2i{6, 9 + screen<FrameBuffer>::small_font.height} - offset.cast<int32_t>(),
217+
klib::vector2i{6, 9 + screen<FrameBuffer>::small_font::height} - offset.cast<int32_t>(),
218218
klib::graphics::white
219219
);
220220
}
221221

222222
// draw the current token using the large font
223-
screen<FrameBuffer>::large_text.template draw<FrameBuffer>(
223+
screen<FrameBuffer>::large_text::template draw<FrameBuffer>(
224224
frame_buffer,
225225
current_token_buf,
226226
klib::vector2i{60, 60} - offset.cast<int32_t>(),
227227
klib::graphics::white
228228
);
229229

230230
// draw the next token using the small font
231-
screen<FrameBuffer>::small_text.template draw<FrameBuffer>(
231+
screen<FrameBuffer>::small_text::template draw<FrameBuffer>(
232232
frame_buffer,
233233
next_token_buf,
234234
klib::vector2i{108, 78} - offset.cast<int32_t>(),
235235
klib::graphics::white
236236
);
237237

238238
// draw the epoch time using the small font
239-
screen<FrameBuffer>::small_text.template draw<FrameBuffer>(
239+
screen<FrameBuffer>::small_text::template draw<FrameBuffer>(
240240
frame_buffer,
241241
epoch_buf,
242242
klib::vector2i{
243243
(240 - 1) - static_cast<int32_t>(
244-
klib::string::strlen(epoch_buf) * screen<FrameBuffer>::small_font.width
244+
klib::string::strlen(epoch_buf) * screen<FrameBuffer>::small_font::width
245245
),
246-
(135 - 1 - screen<FrameBuffer>::small_font.height)
246+
(135 - 1 - screen<FrameBuffer>::small_font::height)
247247
} - offset.cast<int32_t>(),
248248
klib::graphics::white
249249
);
250250

251251
// draw using the large font
252-
screen<FrameBuffer>::small_text.template draw<FrameBuffer>(
252+
screen<FrameBuffer>::small_text::template draw<FrameBuffer>(
253253
frame_buffer,
254254
delta_buf,
255-
klib::vector2i{1, (135 - 1 - screen<FrameBuffer>::small_font.height)} - offset.cast<int32_t>(),
255+
klib::vector2i{1, (135 - 1 - screen<FrameBuffer>::small_font::height)} - offset.cast<int32_t>(),
256256
klib::graphics::white
257257
);
258258

@@ -271,11 +271,11 @@ namespace menu {
271271
}
272272

273273
// draw the time left in seconds in the circle
274-
screen<FrameBuffer>::small_text.template draw<FrameBuffer>(
274+
screen<FrameBuffer>::small_text::template draw<FrameBuffer>(
275275
frame_buffer, seconds_left_buf,
276276
klib::vector2i{
277-
(204 + 1) - static_cast<int32_t>((klib::string::strlen(seconds_left_buf) * screen<FrameBuffer>::small_font.width) / 2),
278-
(68 + 1) - (screen<FrameBuffer>::small_font.height / 2)
277+
(204 + 1) - static_cast<int32_t>((klib::string::strlen(seconds_left_buf) * screen<FrameBuffer>::small_font::width) / 2),
278+
(68 + 1) - (screen<FrameBuffer>::small_font::height / 2)
279279
} - offset.cast<int32_t>(),
280280
klib::graphics::white
281281
);

0 commit comments

Comments
 (0)