added all Sprite functions
This commit is contained in:
parent
2287869945
commit
251491e4e6
4 changed files with 57 additions and 5 deletions
|
@ -6,7 +6,6 @@
|
||||||
use arduboy_rust::prelude::*;
|
use arduboy_rust::prelude::*;
|
||||||
|
|
||||||
// Progmem data
|
// Progmem data
|
||||||
//#[link_section = ".progmem.data"]
|
|
||||||
|
|
||||||
// dynamic ram variables
|
// dynamic ram variables
|
||||||
|
|
||||||
|
@ -14,10 +13,6 @@ use arduboy_rust::prelude::*;
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn setup() {
|
pub unsafe extern "C" fn setup() {
|
||||||
// put your setup code here, to run once:
|
// put your setup code here, to run once:
|
||||||
arduboy.begin();
|
|
||||||
arduboy.clear();
|
|
||||||
arduboy.print(f!(b"hello boys\0"));
|
|
||||||
arduboy.display();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The loop() function repeats forever after setup() is done
|
// The loop() function repeats forever after setup() is done
|
||||||
|
|
|
@ -3,4 +3,21 @@
|
||||||
void arduino_draw_override(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame)
|
void arduino_draw_override(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame)
|
||||||
{
|
{
|
||||||
Sprites::drawOverwrite(x, y, bitmap, frame);
|
Sprites::drawOverwrite(x, y, bitmap, frame);
|
||||||
|
}
|
||||||
|
void arduino_draw_external_mask(int16_t x, int16_t y, const uint8_t *bitmap,
|
||||||
|
const uint8_t *mask, uint8_t frame, uint8_t mask_frame)
|
||||||
|
{
|
||||||
|
Sprites::drawExternalMask(x, y, bitmap, mask, frame, mask_frame);
|
||||||
|
}
|
||||||
|
void arduino_draw_plus_mask(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame)
|
||||||
|
{
|
||||||
|
Sprites::drawPlusMask(x, y, bitmap, frame);
|
||||||
|
}
|
||||||
|
void arduino_draw_erase(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame)
|
||||||
|
{
|
||||||
|
Sprites::drawErase(x, y, bitmap, frame);
|
||||||
|
}
|
||||||
|
void arduino_draw_self_masked(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame)
|
||||||
|
{
|
||||||
|
Sprites::drawSelfMasked(x, y, bitmap, frame);
|
||||||
}
|
}
|
|
@ -4,4 +4,9 @@
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void arduino_draw_override(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame);
|
void arduino_draw_override(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame);
|
||||||
|
void arduino_draw_external_mask(int16_t x, int16_t y, const uint8_t *bitmap,
|
||||||
|
const uint8_t *mask, uint8_t frame, uint8_t mask_frame);
|
||||||
|
void arduino_draw_plus_mask(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame);
|
||||||
|
void arduino_draw_erase(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame);
|
||||||
|
void arduino_draw_self_masked(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame);
|
||||||
}
|
}
|
|
@ -4,6 +4,22 @@ use core::ffi::{c_int, c_uchar};
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#[link_name = "arduino_draw_override"]
|
#[link_name = "arduino_draw_override"]
|
||||||
fn arduino_draw_override_raw(x: c_int, y: c_int, bitmap: *const c_uchar, frame: c_uchar);
|
fn arduino_draw_override_raw(x: c_int, y: c_int, bitmap: *const c_uchar, frame: c_uchar);
|
||||||
|
#[link_name = "arduino_draw_external_mask"]
|
||||||
|
fn arduino_draw_external_mask_raw(
|
||||||
|
x: c_int,
|
||||||
|
y: c_int,
|
||||||
|
bitmap: *const c_uchar,
|
||||||
|
mask: *const c_uchar,
|
||||||
|
frame: c_uchar,
|
||||||
|
mask_frame: c_uchar,
|
||||||
|
);
|
||||||
|
#[link_name = "arduino_draw_plus_mask"]
|
||||||
|
fn arduino_draw_plus_mask_raw(x: c_int, y: c_int, bitmap: *const c_uchar, frame: c_uchar);
|
||||||
|
#[link_name = "arduino_draw_erase"]
|
||||||
|
fn arduino_draw_erase_raw(x: c_int, y: c_int, bitmap: *const c_uchar, frame: c_uchar);
|
||||||
|
#[link_name = "arduino_draw_self_masked"]
|
||||||
|
fn arduino_draw_self_masked_raw(x: c_int, y: c_int, bitmap: *const c_uchar, frame: c_uchar);
|
||||||
|
|
||||||
}
|
}
|
||||||
/// Draw a sprite by replacing the existing content completely.
|
/// Draw a sprite by replacing the existing content completely.
|
||||||
///
|
///
|
||||||
|
@ -36,3 +52,22 @@ extern "C" {
|
||||||
pub fn draw_override(x: i16, y: i16, bitmap: *const u8, frame: u8) {
|
pub fn draw_override(x: i16, y: i16, bitmap: *const u8, frame: u8) {
|
||||||
unsafe { arduino_draw_override_raw(x, y, bitmap, frame) }
|
unsafe { arduino_draw_override_raw(x, y, bitmap, frame) }
|
||||||
}
|
}
|
||||||
|
pub fn draw_external_mask(
|
||||||
|
x: i16,
|
||||||
|
y: i16,
|
||||||
|
bitmap: *const u8,
|
||||||
|
mask: *const u8,
|
||||||
|
frame: u8,
|
||||||
|
mask_frame: u8,
|
||||||
|
) {
|
||||||
|
unsafe { arduino_draw_external_mask_raw(x, y, bitmap, mask, frame, mask_frame) }
|
||||||
|
}
|
||||||
|
pub fn draw_plus_mask(x: i16, y: i16, bitmap: *const u8, frame: u8) {
|
||||||
|
unsafe { arduino_draw_plus_mask_raw(x, y, bitmap, frame) }
|
||||||
|
}
|
||||||
|
pub fn draw_erase(x: i16, y: i16, bitmap: *const u8, frame: u8) {
|
||||||
|
unsafe { arduino_draw_erase_raw(x, y, bitmap, frame) }
|
||||||
|
}
|
||||||
|
pub fn draw_self_masked(x: i16, y: i16, bitmap: *const u8, frame: u8) {
|
||||||
|
unsafe { arduino_draw_self_masked_raw(x, y, bitmap, frame) }
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue