added arduboyfx_read_data_array arduboyfx_set_frame arduboyfx_draw_frame arduboyfx_draw_string arduboyfx_draw_string_buffer arduboyfx_set_cursor
This commit is contained in:
parent
ddf419f702
commit
3f847e86a6
3 changed files with 49 additions and 3 deletions
|
@ -12,11 +12,12 @@ const arduboy: Arduboy2 = Arduboy2::new();
|
||||||
// Progmem data
|
// Progmem data
|
||||||
|
|
||||||
// dynamic ram variables
|
// dynamic ram variables
|
||||||
const FX_DATA_PAGE: u16 = 0xffff;
|
const FX_DATA_PAGE: u16 = 0xfffe;
|
||||||
const FX_DATA_BYTES: u32 = 234;
|
const FX_DATA_BYTES: u32 = 329;
|
||||||
const FXlogo: u32 = 0x000000;
|
const FXlogo: u32 = 0x000000;
|
||||||
const FXlogoWith: i16 = 115;
|
const FXlogoWith: i16 = 115;
|
||||||
const FXlogoHeight: i16 = 16;
|
const FXlogoHeight: i16 = 16;
|
||||||
|
const helloWorld: u32 = 0x0000EA;
|
||||||
|
|
||||||
static mut x: i16 = (WIDTH - FXlogoWith) / 2;
|
static mut x: i16 = (WIDTH - FXlogoWith) / 2;
|
||||||
static mut y: i16 = 25;
|
static mut y: i16 = 25;
|
||||||
|
@ -47,5 +48,7 @@ pub unsafe extern "C" fn loop_() {
|
||||||
if y == 0 || y == HEIGHT - FXlogoHeight {
|
if y == 0 || y == HEIGHT - FXlogoHeight {
|
||||||
yDir = -yDir;
|
yDir = -yDir;
|
||||||
}
|
}
|
||||||
|
arduboyfx_set_cursor(10, 10);
|
||||||
|
arduboyfx_draw_string(helloWorld);
|
||||||
arduboyfx_display_clear();
|
arduboyfx_display_clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,4 +26,28 @@ extern "C"
|
||||||
{
|
{
|
||||||
FX::drawBitmap(x,y,address,frame,mode);
|
FX::drawBitmap(x,y,address,frame,mode);
|
||||||
}
|
}
|
||||||
|
void arduboyfx_read_data_array(uint24_t address,uint8_t index,uint8_t offset,uint8_t elementSize,uint8_t * buffer,size_t length )
|
||||||
|
{
|
||||||
|
FX::readDataArray(address,index,offset,elementSize,buffer,length);
|
||||||
|
}
|
||||||
|
void arduboyfx_set_frame(uint24_t frame,uint8_t repeat )
|
||||||
|
{
|
||||||
|
FX::setFrame(frame,repeat);
|
||||||
|
}
|
||||||
|
uint24_t arduboyfx_draw_frame(uint24_t address)
|
||||||
|
{
|
||||||
|
return FX::drawFrame(address);
|
||||||
|
}
|
||||||
|
void arduboyfx_draw_string(uint24_t address)
|
||||||
|
{
|
||||||
|
FX::drawString(address);
|
||||||
|
}
|
||||||
|
void arduboyfx_draw_string_buffer(const uint8_t * buffer )
|
||||||
|
{
|
||||||
|
FX::drawString(buffer);
|
||||||
|
}
|
||||||
|
void arduboyfx_set_cursor(int16_t x,int16_t y)
|
||||||
|
{
|
||||||
|
return FX::setCursor(x,y);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
#![allow(non_upper_case_globals)]
|
#![allow(non_upper_case_globals)]
|
||||||
use core::ffi::{c_int, c_long, c_uchar, c_uint, c_ulong};
|
use core::ffi::{c_char, c_int, c_size_t, c_uchar, c_uint, c_ulong};
|
||||||
|
|
||||||
pub const dbmNormal: u8 = 0;
|
pub const dbmNormal: u8 = 0;
|
||||||
pub const dbmOverwrite: u8 = 0;
|
pub const dbmOverwrite: u8 = 0;
|
||||||
|
@ -15,6 +15,15 @@ extern "C" {
|
||||||
pub fn arduboyfx_display();
|
pub fn arduboyfx_display();
|
||||||
#[link_name = "arduboyfx_display_clear"]
|
#[link_name = "arduboyfx_display_clear"]
|
||||||
pub fn arduboyfx_display_clear();
|
pub fn arduboyfx_display_clear();
|
||||||
|
#[link_name = "arduboyfx_read_data_array"]
|
||||||
|
pub fn arduboyfx_read_data_array(
|
||||||
|
address: c_ulong,
|
||||||
|
index: c_uchar,
|
||||||
|
offset: c_uchar,
|
||||||
|
element_size: c_uchar,
|
||||||
|
buffer: *const c_uchar,
|
||||||
|
length: c_size_t,
|
||||||
|
);
|
||||||
#[link_name = "arduboyfx_draw_bitmap"]
|
#[link_name = "arduboyfx_draw_bitmap"]
|
||||||
pub fn arduboyfx_draw_bitmap(
|
pub fn arduboyfx_draw_bitmap(
|
||||||
x: c_int,
|
x: c_int,
|
||||||
|
@ -23,4 +32,14 @@ extern "C" {
|
||||||
frame: c_uchar,
|
frame: c_uchar,
|
||||||
mode: c_uchar,
|
mode: c_uchar,
|
||||||
);
|
);
|
||||||
|
#[link_name = "arduboyfx_set_frame"]
|
||||||
|
pub fn arduboyfx_set_frame(frame: c_ulong, repeat: c_uchar);
|
||||||
|
#[link_name = "arduboyfx_draw_frame"]
|
||||||
|
pub fn arduboyfx_draw_frame(address: c_ulong) -> c_ulong;
|
||||||
|
#[link_name = "arduboyfx_draw_string"]
|
||||||
|
pub fn arduboyfx_draw_string(address: c_ulong);
|
||||||
|
#[link_name = "arduboyfx_draw_string_buffer"]
|
||||||
|
pub fn arduboyfx_draw_string_buffer(buffer: *const c_uchar);
|
||||||
|
#[link_name = "arduboyfx_set_cursor"]
|
||||||
|
pub fn arduboyfx_set_cursor(x: c_int, y: c_int);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue