all FX functions are now safe wrapped and I added the crate to the docs also it is added to the prelude
This commit is contained in:
parent
3f847e86a6
commit
522844499e
1272 changed files with 1371 additions and 61826 deletions
|
@ -2,7 +2,6 @@
|
|||
#![allow(non_upper_case_globals)]
|
||||
|
||||
//Include the Arduboy Library
|
||||
use arduboy_rust::arduboyfx::*;
|
||||
#[allow(unused_imports)]
|
||||
use arduboy_rust::prelude::*;
|
||||
|
||||
|
@ -12,12 +11,11 @@ const arduboy: Arduboy2 = Arduboy2::new();
|
|||
// Progmem data
|
||||
|
||||
// dynamic ram variables
|
||||
const FX_DATA_PAGE: u16 = 0xfffe;
|
||||
const FX_DATA_BYTES: u32 = 329;
|
||||
const FX_DATA_PAGE: u16 = 0xffff;
|
||||
const FX_DATA_BYTES: u32 = 234;
|
||||
const FXlogo: u32 = 0x000000;
|
||||
const FXlogoWith: i16 = 115;
|
||||
const FXlogoHeight: i16 = 16;
|
||||
const helloWorld: u32 = 0x0000EA;
|
||||
|
||||
static mut x: i16 = (WIDTH - FXlogoWith) / 2;
|
||||
static mut y: i16 = 25;
|
||||
|
@ -29,7 +27,7 @@ pub unsafe extern "C" fn setup() {
|
|||
// put your setup code here, to run once:
|
||||
arduboy.begin();
|
||||
arduboy.set_frame_rate(30);
|
||||
arduboyfx_begin_data(FX_DATA_PAGE);
|
||||
FX::begin_data(FX_DATA_PAGE);
|
||||
}
|
||||
// The loop() function repeats forever after setup() is done
|
||||
#[no_mangle]
|
||||
|
@ -39,7 +37,7 @@ pub unsafe extern "C" fn loop_() {
|
|||
if !arduboy.next_frame() {
|
||||
return;
|
||||
}
|
||||
arduboyfx_draw_bitmap(x, y, FXlogo, 0, 0);
|
||||
FX::draw_bitmap(x, y, FXlogo, 0, 0);
|
||||
x += xDir as i16;
|
||||
y += yDir as i16;
|
||||
if x == 0 || x == WIDTH - FXlogoWith {
|
||||
|
@ -48,7 +46,5 @@ pub unsafe extern "C" fn loop_() {
|
|||
if y == 0 || y == HEIGHT - FXlogoHeight {
|
||||
yDir = -yDir;
|
||||
}
|
||||
arduboyfx_set_cursor(10, 10);
|
||||
arduboyfx_draw_string(helloWorld);
|
||||
arduboyfx_display_clear();
|
||||
FX::display_clear()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue