added the f!() macro to the library to make shure that all random text can be written to the progmem to save the important ram

This commit is contained in:
Zenn 2023-08-07 20:40:06 +02:00
parent b00ee76ef1
commit 990ae0c03c
11 changed files with 71 additions and 97 deletions

View file

@ -1,4 +1,5 @@
#![no_std]
#![allow(non_upper_case_globals)]
use arduboy_rust::prelude::*;
@ -91,9 +92,9 @@ pub unsafe extern "C" fn loop_() {
match G.game_state {
GameState::Title => {
arduboy.set_cursor(52, 10);
arduboy.print(&b"PONG\0"[..]);
arduboy.print(f!(b"PONG\0"));
arduboy.set_cursor(16, 22);
arduboy.print(&b"Press A to start\0"[..]);
arduboy.print(f!(b"Press A to start\0"));
if A.just_pressed() {
G.game_state = GameState::Gameplay;
}
@ -106,14 +107,14 @@ pub unsafe extern "C" fn loop_() {
}
GameState::Win => {
arduboy.set_cursor(40, 10);
arduboy.print(&b"You Win!\0"[..]);
arduboy.print(f!(b"You Win!\0"));
if A.just_pressed() {
reset_game();
}
}
GameState::Lose => {
arduboy.set_cursor(37, 10);
arduboy.print(&b"Game Over\0"[..]);
arduboy.print(f!(b"Game Over\0"));
if A.just_pressed() {
reset_game();
}