Update example to use the new macro

This commit is contained in:
Gwilym Kuiper 2021-10-17 22:38:19 +01:00
parent 292c4fd20f
commit 66e201ae39
6 changed files with 23 additions and 4 deletions

17
agb/Cargo.lock generated
View file

@ -14,6 +14,7 @@ version = "0.7.0"
dependencies = [ dependencies = [
"agb_image_converter", "agb_image_converter",
"agb_macros", "agb_macros",
"agb_sound_converter",
"bitflags", "bitflags",
] ]
@ -39,6 +40,16 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "agb_sound_converter"
version = "0.1.0"
dependencies = [
"hound",
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.0.1" version = "1.0.1"
@ -105,6 +116,12 @@ dependencies = [
"wasi", "wasi",
] ]
[[package]]
name = "hound"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a164bb2ceaeff4f42542bdb847c41517c78a60f5649671b2a07312b6e117549"
[[package]] [[package]]
name = "image" name = "image"
version = "0.23.14" version = "0.23.14"

View file

@ -21,6 +21,7 @@ alloc = []
[dependencies] [dependencies]
bitflags = "1.2" bitflags = "1.2"
agb_image_converter = { version = "0.6.0", path = "../agb-image-converter" } agb_image_converter = { version = "0.6.0", path = "../agb-image-converter" }
agb_sound_converter = { version = "0.1.0", path = "../agb-sound-converter" }
agb_macros = { version = "0.1.0", path = "../agb-macros" } agb_macros = { version = "0.1.0", path = "../agb-macros" }
[package.metadata.docs.rs] [package.metadata.docs.rs]

Binary file not shown.

View file

@ -6,10 +6,10 @@ extern crate agb;
use agb::input::{Button, ButtonController, Tri}; use agb::input::{Button, ButtonController, Tri};
use agb::number::Num; use agb::number::Num;
use agb::sound::mixer::SoundChannel; use agb::sound::mixer::SoundChannel;
use agb::Gba; use agb::{include_wav, Gba};
// Music - "I will not let you let me down" by Josh Woodward, free download at http://joshwoodward.com // Music - "Dead Code" by Josh Woodward, free download at http://joshwoodward.com
const I_WILL_NOT_LET_YOU_LET_ME_DOWN: &[u8] = include_bytes!("i-will-not-let-you-let-me-down.raw"); const DEAD_CODE: &[u8] = include_wav!("examples/JoshWoodward-DeadCode.wav");
#[agb::entry] #[agb::entry]
fn main() -> ! { fn main() -> ! {
@ -20,7 +20,7 @@ fn main() -> ! {
let mut mixer = gba.mixer.mixer(); let mut mixer = gba.mixer.mixer();
mixer.enable(); mixer.enable();
let channel = SoundChannel::new(I_WILL_NOT_LET_YOU_LET_ME_DOWN); let channel = SoundChannel::new(DEAD_CODE);
let channel_id = mixer.play_sound(channel).unwrap(); let channel_id = mixer.play_sound(channel).unwrap();
loop { loop {

View file

@ -26,6 +26,7 @@ pub mod input;
pub mod sound; pub mod sound;
pub use agb_image_converter::include_gfx; pub use agb_image_converter::include_gfx;
pub use agb_sound_converter::include_wav;
pub use agb_macros::entry; pub use agb_macros::entry;