fixed some problems and added the demos for fxhelloworld, fxbasicexample and fxchompies
This commit is contained in:
parent
9ad03927de
commit
4a3100c0bd
18 changed files with 258 additions and 85 deletions
|
@ -11,24 +11,12 @@ const arduboy: Arduboy2 = Arduboy2::new();
|
|||
// Progmem data
|
||||
|
||||
// dynamic ram variables
|
||||
const FX_DATA_PAGE: u16 = 0xffff;
|
||||
#[allow(dead_code)]
|
||||
const FX_DATA_BYTES: u32 = 234;
|
||||
const FXlogo: u32 = 0x000000;
|
||||
const FXlogoWith: i16 = 115;
|
||||
const FXlogoHeight: i16 = 16;
|
||||
|
||||
static mut x: i16 = (WIDTH - FXlogoWith) / 2;
|
||||
static mut y: i16 = 25;
|
||||
static mut xDir: i8 = 1;
|
||||
static mut yDir: i8 = 1;
|
||||
// The setup() function runs once when you turn your Arduboy on
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn setup() {
|
||||
// put your setup code here, to run once:
|
||||
arduboy.begin();
|
||||
arduboy.set_frame_rate(30);
|
||||
FX::begin_data(FX_DATA_PAGE);
|
||||
|
||||
}
|
||||
// The loop() function repeats forever after setup() is done
|
||||
#[no_mangle]
|
||||
|
@ -38,14 +26,5 @@ pub unsafe extern "C" fn loop_() {
|
|||
if !arduboy.next_frame() {
|
||||
return;
|
||||
}
|
||||
FX::draw_bitmap(x, y, FXlogo, 0, 0);
|
||||
x += xDir as i16;
|
||||
y += yDir as i16;
|
||||
if x == 0 || x == WIDTH - FXlogoWith {
|
||||
xDir = -xDir;
|
||||
}
|
||||
if y == 0 || y == HEIGHT - FXlogoHeight {
|
||||
yDir = -yDir;
|
||||
}
|
||||
FX::display_clear()
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue