Big refactor and new run script
This commit is contained in:
parent
5796b78695
commit
a54fa90edc
68 changed files with 769 additions and 336 deletions
9
Examples/Arduboy-Tutorials/demo2/config.toml
Normal file
9
Examples/Arduboy-Tutorials/demo2/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
# "ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
9
Examples/Arduboy-Tutorials/demo3/config.toml
Normal file
9
Examples/Arduboy-Tutorials/demo3/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
# "ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
9
Examples/Arduboy-Tutorials/demo4/config.toml
Normal file
9
Examples/Arduboy-Tutorials/demo4/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
# "ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
9
Examples/Arduboy-Tutorials/demo5/config.toml
Normal file
9
Examples/Arduboy-Tutorials/demo5/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
# "ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
9
Examples/Arduboy-Tutorials/demo6/config.toml
Normal file
9
Examples/Arduboy-Tutorials/demo6/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
# "ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
|
@ -5,22 +5,19 @@
|
|||
#[allow(unused_imports)]
|
||||
use arduboy_rust::prelude::*;
|
||||
const arduboy: Arduboy2 = Arduboy2::new();
|
||||
|
||||
#[link_section = ".progmem.data"]
|
||||
static background_sprite: [u8; 10] = [8, 8, 0x81, 0x00, 0x12, 0x40, 0x04, 0x11, 0x00, 0x04];
|
||||
#[link_section = ".progmem.data"]
|
||||
static player_sprite1: [u8; 34] = [
|
||||
16, 16, 0xfe, 0x01, 0x3d, 0x25, 0x25, 0x3d, 0x01, 0x01, 0xc1, 0x01, 0x3d, 0x25, 0x25, 0x3d,
|
||||
0x01, 0xfe, 0x7f, 0x80, 0x9c, 0xbc, 0xb0, 0xb0, 0xb2, 0xb2, 0xb3, 0xb0, 0xb0, 0xb0, 0xbc, 0x9c,
|
||||
0x80, 0x7f,
|
||||
];
|
||||
#[link_section = ".progmem.data"]
|
||||
static player_sprite2: [u8; 34] = [
|
||||
16, 16, 0xfc, 0x02, 0x19, 0x25, 0x25, 0x19, 0x01, 0x01, 0x01, 0x01, 0x19, 0x25, 0x25, 0x19,
|
||||
0x02, 0xfc, 0x3f, 0x40, 0x80, 0x98, 0x8c, 0x86, 0x82, 0x82, 0x82, 0x82, 0x86, 0x8c, 0x98, 0x80,
|
||||
0x40, 0x3f,
|
||||
];
|
||||
|
||||
progmem!(
|
||||
static background_sprite: [u8; _] = [8, 8, 0x81, 0x00, 0x12, 0x40, 0x04, 0x11, 0x00, 0x04];
|
||||
static player_sprite1: [u8; _] = [
|
||||
16, 16, 0xfe, 0x01, 0x3d, 0x25, 0x25, 0x3d, 0x01, 0x01, 0xc1, 0x01, 0x3d, 0x25, 0x25, 0x3d,
|
||||
0x01, 0xfe, 0x7f, 0x80, 0x9c, 0xbc, 0xb0, 0xb0, 0xb2, 0xb2, 0xb3, 0xb0, 0xb0, 0xb0, 0xbc,
|
||||
0x9c, 0x80, 0x7f,
|
||||
];
|
||||
static player_sprite2: [u8; _] = [
|
||||
16, 16, 0xfc, 0x02, 0x19, 0x25, 0x25, 0x19, 0x01, 0x01, 0x01, 0x01, 0x19, 0x25, 0x25, 0x19,
|
||||
0x02, 0xfc, 0x3f, 0x40, 0x80, 0x98, 0x8c, 0x86, 0x82, 0x82, 0x82, 0x82, 0x86, 0x8c, 0x98,
|
||||
0x80, 0x40, 0x3f,
|
||||
];
|
||||
);
|
||||
// Put your variables here
|
||||
static mut playerx: c_int = 5;
|
||||
static mut playery: c_int = 10;
|
||||
|
|
9
Examples/Arduboy-Tutorials/demo7/config.toml
Normal file
9
Examples/Arduboy-Tutorials/demo7/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
# "ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
9
Examples/Arduboy-Tutorials/demo9/config.toml
Normal file
9
Examples/Arduboy-Tutorials/demo9/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
# "ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
9
Examples/Arduboy-Tutorials/eeprom/config.toml
Normal file
9
Examples/Arduboy-Tutorials/eeprom/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
# "ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
|
@ -24,7 +24,7 @@ static mut s: Scorebord = Scorebord {
|
|||
pub unsafe extern "C" fn setup() {
|
||||
// put your setup code here, to run once:
|
||||
arduboy.begin();
|
||||
arduboy.set_frame_rate(1);
|
||||
arduboy.set_frame_rate(30);
|
||||
arduboy.clear();
|
||||
e.init(&mut s);
|
||||
}
|
||||
|
@ -54,11 +54,9 @@ pub unsafe extern "C" fn loop_() {
|
|||
if s.player1 == 5 {
|
||||
arduboy.print(f!(b"lolxd\0"));
|
||||
s.text = "it works!!!\0";
|
||||
e.put(&s)
|
||||
} else {
|
||||
arduboy.print(f!(b"nope\0"));
|
||||
s.text = "lol\0";
|
||||
e.put(&s)
|
||||
}
|
||||
|
||||
//e.get(&mut s);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "eeprom-byte"
|
||||
name = "eeprom_byte"
|
||||
version = "0.1.0"
|
||||
authors = ["ZennDev <zenndev@protonmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
9
Examples/Arduboy-Tutorials/eeprom_byte/config.toml
Normal file
9
Examples/Arduboy-Tutorials/eeprom_byte/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
# "ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
|
@ -11,7 +11,8 @@ const arduboy: Arduboy2 = Arduboy2::new();
|
|||
// Setup eeprom memory
|
||||
static mut eeprom: EEPROMBYTE = EEPROMBYTE::new(10);
|
||||
|
||||
static mut count: u8 = 0;
|
||||
static mut count_in_ram: u8 = 0;
|
||||
static mut count_in_eeprom: u8 = 0;
|
||||
|
||||
// The setup() function runs once when you turn your Arduboy on
|
||||
#[no_mangle]
|
||||
|
@ -33,24 +34,23 @@ pub unsafe extern "C" fn loop_() {
|
|||
arduboy.clear();
|
||||
arduboy.poll_buttons();
|
||||
if arduboy.just_pressed(UP) {
|
||||
count += 1;
|
||||
count_in_ram += 1;
|
||||
}
|
||||
if arduboy.just_pressed(DOWN) {
|
||||
count -= 1;
|
||||
count_in_ram -= 1;
|
||||
}
|
||||
if arduboy.just_pressed(A) {
|
||||
eeprom.update(count)
|
||||
eeprom.update(count_in_ram);
|
||||
count_in_eeprom = eeprom.read()
|
||||
}
|
||||
arduboy.set_cursor(0, 0);
|
||||
arduboy.print(count as u16);
|
||||
|
||||
arduboy.set_cursor(0, 30);
|
||||
arduboy.print(f!(b"Counter:\0"));
|
||||
arduboy.print(count as u16);
|
||||
arduboy.set_cursor(0, 40);
|
||||
arduboy.print(f!(b"eeprom:\0"));
|
||||
|
||||
//arduboy.print(eeprom.read() as u16);
|
||||
arduboy.print(f!(b"Up/Down: Edit InRam\n\nA: Save to EEPROM\0"));
|
||||
|
||||
arduboy.set_cursor(0, HEIGHT - FONT_HEIGHT);
|
||||
arduboy.print(f!(b"InRam:\0"));
|
||||
arduboy.print(count_in_ram as u16);
|
||||
arduboy.set_cursor(10 * FONT_WIDTH, HEIGHT - FONT_HEIGHT);
|
||||
arduboy.print(f!(b"EEPROM:\0"));
|
||||
arduboy.print(count_in_eeprom as u16);
|
||||
arduboy.display();
|
||||
}
|
9
Examples/Arduboy-Tutorials/progmem/config.toml
Normal file
9
Examples/Arduboy-Tutorials/progmem/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
# "ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
|
@ -5,7 +5,7 @@
|
|||
//Include the Arduboy Library
|
||||
//Initialize the arduboy object
|
||||
use arduboy_rust::prelude::*;
|
||||
use arduboy_tones::tones_pitch::*;
|
||||
use tones_pitch::*;
|
||||
const arduboy: Arduboy2 = Arduboy2::new();
|
||||
const sound: ArduboyTones = ArduboyTones::new();
|
||||
// Progmem data
|
||||
|
@ -106,7 +106,10 @@ pub unsafe extern "C" fn loop_() {
|
|||
}
|
||||
}
|
||||
arduboy.clear();
|
||||
arduboy.set_cursor((WIDTH as i16 / 2) - (text1.len() as i16 * FONT_SIZE as i16 / 2), 10);
|
||||
arduboy.set_cursor(
|
||||
(WIDTH as i16 / 2) - (text1.len() as i16 * FONT_WIDTH / 2),
|
||||
10,
|
||||
);
|
||||
arduboy.print(get_string_addr!(text1));
|
||||
sprites::draw_override(playerx, playery, get_sprite_addr!(player_sprite1), 0);
|
||||
arduboy.display();
|
||||
|
|
9
Examples/Arduboy-Tutorials/serial/config.toml
Normal file
9
Examples/Arduboy-Tutorials/serial/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
# "ArduboyFX",
|
||||
# "ArdVoice",
|
||||
"Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
9
Examples/Arduboy-Tutorials/tone/config.toml
Normal file
9
Examples/Arduboy-Tutorials/tone/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
"ArduboyTones",
|
||||
# "ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
|
@ -4,7 +4,7 @@
|
|||
//Initialize the arduboy object
|
||||
#[allow(unused_imports)]
|
||||
use arduboy_rust::prelude::*;
|
||||
use arduboy_tones::tones_pitch::*;
|
||||
use tones_pitch::*;
|
||||
const arduboy: Arduboy2 = Arduboy2::new();
|
||||
const sound: ArduboyTones = ArduboyTones::new();
|
||||
const NDUR: u16 = 100;
|
||||
|
@ -346,7 +346,9 @@ pub unsafe extern "C" fn loop_() {
|
|||
|
||||
sound.tone(1000, 0);
|
||||
arduboy.clear();
|
||||
arduboy.print(f!(b"tone(1000)\n\nB: no_tone()\n delay(1000)\n break\0"));
|
||||
arduboy.print(f!(
|
||||
b"tone(1000)\n\nB: no_tone()\n delay(1000)\n break\0"
|
||||
));
|
||||
while sound.playing() {
|
||||
move_circle();
|
||||
if arduboy.pressed(B_BUTTON) {
|
||||
|
@ -381,7 +383,9 @@ pub unsafe extern "C" fn loop_() {
|
|||
|
||||
sound.tone3(NOTE_C7H, 500, NOTE_REST, 1000, NOTE_C6, 5000);
|
||||
arduboy.clear();
|
||||
arduboy.print(f!(b"tone(C7H,500,\n REST,1000,\n C6,6000)\n\nB: no_tone(), break\0"));
|
||||
arduboy.print(f!(
|
||||
b"tone(C7H,500,\n REST,1000,\n C6,6000)\n\nB: no_tone(), break\0"
|
||||
));
|
||||
while sound.playing() {
|
||||
move_circle();
|
||||
if arduboy.pressed(B_BUTTON) {
|
||||
|
@ -393,7 +397,9 @@ pub unsafe extern "C" fn loop_() {
|
|||
|
||||
sound.tones(get_tones_addr!(allNotes));
|
||||
arduboy.clear();
|
||||
arduboy.print(f!(b"tones(allNotes)\n\nA: no_tone(), again\nUP: again\nB: break\0"));
|
||||
arduboy.print(f!(
|
||||
b"tones(allNotes)\n\nA: no_tone(), again\nUP: again\nB: break\0"
|
||||
));
|
||||
while sound.playing() {
|
||||
move_circle();
|
||||
if arduboy.pressed(A_BUTTON) {
|
||||
|
@ -446,7 +452,9 @@ pub unsafe extern "C" fn loop_() {
|
|||
sound.volume_mode(VOLUME_ALWAYS_NORMAL);
|
||||
sound.tones(get_tones_addr!(sound1));
|
||||
arduboy.clear();
|
||||
arduboy.print(f!(b"volume_mode(NORMAL)\ntones(sound1)\n\nB: no_tone(), break\0"));
|
||||
arduboy.print(f!(
|
||||
b"volume_mode(NORMAL)\ntones(sound1)\n\nB: no_tone(), break\0"
|
||||
));
|
||||
while sound.playing() {
|
||||
move_circle();
|
||||
if arduboy.pressed(B) {
|
||||
|
|
9
Examples/ArduboyFX/fxbasicexample/config.toml
Normal file
9
Examples/ArduboyFX/fxbasicexample/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
"ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
9
Examples/ArduboyFX/fxchompies/config.toml
Normal file
9
Examples/ArduboyFX/fxchompies/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
"ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
|
@ -4,7 +4,7 @@
|
|||
//Include the Arduboy Library
|
||||
//Initialize the arduboy object
|
||||
use arduboy_rust::prelude::*;
|
||||
use arduboyfx::fx_consts::*;
|
||||
use fx_consts::*;
|
||||
const arduboy: Arduboy2 = Arduboy2::new();
|
||||
|
||||
// FX Data
|
||||
|
|
9
Examples/ArduboyFX/fxdrawballs/config.toml
Normal file
9
Examples/ArduboyFX/fxdrawballs/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
"ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
|
@ -1,10 +1,11 @@
|
|||
#![no_std]
|
||||
#![allow(non_upper_case_globals)]
|
||||
|
||||
use arduboy_rust::arduboyfx::fx_consts::{dbmMasked, dbmNormal};
|
||||
//Include the Arduboy Library
|
||||
//Initialize the arduboy object
|
||||
use arduboy_rust::prelude::*;
|
||||
use fx_consts::{dbmMasked, dbmNormal};
|
||||
|
||||
const arduboy: Arduboy2 = Arduboy2::new();
|
||||
|
||||
// FX Data
|
||||
|
|
9
Examples/ArduboyFX/fxdrawframes/config.toml
Normal file
9
Examples/ArduboyFX/fxdrawframes/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
"ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
9
Examples/ArduboyFX/fxhelloworld/config.toml
Normal file
9
Examples/ArduboyFX/fxhelloworld/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
"ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
|
@ -4,7 +4,7 @@
|
|||
//Include the Arduboy Library
|
||||
//Initialize the arduboy object
|
||||
use arduboy_rust::prelude::*;
|
||||
use arduboyfx::fx_consts::*;
|
||||
use fx_consts::*;
|
||||
const arduboy: Arduboy2 = Arduboy2::new();
|
||||
|
||||
//FX Data
|
||||
|
|
9
Examples/ArduboyFX/fxloadgamestate/config.toml
Normal file
9
Examples/ArduboyFX/fxloadgamestate/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
"ArduboyFX",
|
||||
# "ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
9
Examples/ardvoice/config.toml
Normal file
9
Examples/ardvoice/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
# "ArduboyTones",
|
||||
# "ArduboyFX",
|
||||
"ArdVoice",
|
||||
# "Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
9
Examples/drboy/config.toml
Normal file
9
Examples/drboy/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
"ArduboyTones",
|
||||
#"ArduboyFX",
|
||||
#"ArdVoice",
|
||||
#"Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
|
@ -4,7 +4,7 @@
|
|||
//Include the Arduboy Library
|
||||
#[allow(unused_imports)]
|
||||
use arduboy_rust::prelude::*;
|
||||
use arduboy_tones::tones_pitch::*;
|
||||
use tones_pitch::*;
|
||||
mod gameloop;
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
|
9
Examples/rustacean/config.toml
Normal file
9
Examples/rustacean/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
"ArduboyTones",
|
||||
#"ArduboyFX",
|
||||
#"ArdVoice",
|
||||
#"Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
9
Examples/snake/config.toml
Normal file
9
Examples/snake/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
Libraries = [
|
||||
"Arduboy2",
|
||||
"ArduboyTones",
|
||||
#"ArduboyFX",
|
||||
#"ArdVoice",
|
||||
#"Serial",
|
||||
"EEPROM",
|
||||
"Arduino",
|
||||
]
|
|
@ -257,11 +257,8 @@ pub unsafe extern "C" fn loop_() {
|
|||
State::Win => (),
|
||||
State::Pause => {
|
||||
let msg = "[ Break ]\0";
|
||||
let l = msg.len() as u8 * FONT_SIZE / 2;
|
||||
arduboy.set_cursor(
|
||||
((WIDTH / 2) as u16 - l as u16).try_into().unwrap(),
|
||||
((HEIGHT / 2) as u16).try_into().unwrap(),
|
||||
);
|
||||
let l = msg.len() as i16 * FONT_WIDTH / 2;
|
||||
arduboy.set_cursor(WIDTH / 2 - l, HEIGHT / 2);
|
||||
snake.render();
|
||||
snake.boarder();
|
||||
arduboy.print(msg);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue