From 19f071fd5ac6dd2b70d53c42943f273451645a44 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Wed, 12 Jan 2022 22:09:57 +0000 Subject: [PATCH] Use agb::fixnum rather than agb::number --- agb/examples/mixer_basic.rs | 2 +- agb/examples/wave.rs | 2 +- agb/src/display/background.rs | 2 +- agb/src/display/object.rs | 2 +- agb/src/lib.rs | 2 +- agb/src/sound/mixer/mod.rs | 2 +- agb/src/sound/mixer/sw_mixer.rs | 2 +- agb/src/syscall.rs | 2 +- book/games/pong/Cargo.lock | 8 ++++++++ examples/the-hat-chooses-the-wizard/Cargo.lock | 8 ++++++++ examples/the-hat-chooses-the-wizard/build.rs | 2 +- examples/the-hat-chooses-the-wizard/src/enemies.rs | 2 +- examples/the-hat-chooses-the-wizard/src/main.rs | 2 +- examples/the-purple-night/Cargo.lock | 8 ++++++++ examples/the-purple-night/src/main.rs | 2 +- examples/the-purple-night/src/sfx.rs | 2 +- 16 files changed, 37 insertions(+), 13 deletions(-) diff --git a/agb/examples/mixer_basic.rs b/agb/examples/mixer_basic.rs index c4780753..fdb39b15 100644 --- a/agb/examples/mixer_basic.rs +++ b/agb/examples/mixer_basic.rs @@ -1,8 +1,8 @@ #![no_std] #![no_main] +use agb::fixnum::Num; use agb::input::{Button, ButtonController, Tri}; -use agb::number::Num; use agb::sound::mixer::SoundChannel; use agb::{include_wav, Gba}; diff --git a/agb/examples/wave.rs b/agb/examples/wave.rs index 3e8264bb..239f60c8 100644 --- a/agb/examples/wave.rs +++ b/agb/examples/wave.rs @@ -3,8 +3,8 @@ use agb::{ display::example_logo, + fixnum::FixedNum, interrupt::{Interrupt, Mutex}, - number::FixedNum, }; struct BackCosines { diff --git a/agb/src/display/background.rs b/agb/src/display/background.rs index 7418dc41..4f6ab336 100644 --- a/agb/src/display/background.rs +++ b/agb/src/display/background.rs @@ -1,8 +1,8 @@ use core::ops::Index; use crate::{ + fixnum::{Rect, Vector2D}, memory_mapped::{MemoryMapped, MemoryMapped1DArray}, - number::{Rect, Vector2D}, }; use super::{ diff --git a/agb/src/display/object.rs b/agb/src/display/object.rs index 2fbd2329..4dea6e6f 100644 --- a/agb/src/display/object.rs +++ b/agb/src/display/object.rs @@ -2,8 +2,8 @@ use core::cell::RefCell; use super::{palette16, Priority, DISPLAY_CONTROL}; use crate::bitarray::Bitarray; +use crate::fixnum::Vector2D; use crate::memory_mapped::MemoryMapped1DArray; -use crate::number::Vector2D; type AffineLoan<'a> = crate::arena::Loan<'a, 32>; type AffineArena = crate::arena::Arena<32>; diff --git a/agb/src/lib.rs b/agb/src/lib.rs index bb3b1286..d5204c45 100644 --- a/agb/src/lib.rs +++ b/agb/src/lib.rs @@ -152,7 +152,7 @@ mod memory_mapped; /// Implements logging to the mgba emulator. pub mod mgba; /// Implementation of fixnums for working with non-integer values. -pub use agb_fixnum as number; +pub use agb_fixnum as fixnum; mod single; /// Implements sound output. pub mod sound; diff --git a/agb/src/sound/mixer/mod.rs b/agb/src/sound/mixer/mod.rs index 80a009d6..7b26c03a 100644 --- a/agb/src/sound/mixer/mod.rs +++ b/agb/src/sound/mixer/mod.rs @@ -4,7 +4,7 @@ mod sw_mixer; pub use sw_mixer::ChannelId; pub use sw_mixer::Mixer; -use crate::number::Num; +use crate::fixnum::Num; use crate::timer::Timer; #[non_exhaustive] diff --git a/agb/src/sound/mixer/sw_mixer.rs b/agb/src/sound/mixer/sw_mixer.rs index c9da82ab..a6db9460 100644 --- a/agb/src/sound/mixer/sw_mixer.rs +++ b/agb/src/sound/mixer/sw_mixer.rs @@ -1,7 +1,7 @@ use super::hw; use super::hw::LeftOrRight; use super::{SoundChannel, SoundPriority}; -use crate::number::Num; +use crate::fixnum::Num; use crate::timer::Timer; // Defined in mixer.s diff --git a/agb/src/syscall.rs b/agb/src/syscall.rs index ddeed8f0..bf271981 100644 --- a/agb/src/syscall.rs +++ b/agb/src/syscall.rs @@ -1,7 +1,7 @@ use core::arch::asm; use crate::display::object::AffineMatrixAttributes; -use crate::number::Num; +use crate::fixnum::Num; #[allow(non_snake_case)] diff --git a/book/games/pong/Cargo.lock b/book/games/pong/Cargo.lock index 2582c2b3..4e1b6357 100644 --- a/book/games/pong/Cargo.lock +++ b/book/games/pong/Cargo.lock @@ -12,12 +12,20 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" name = "agb" version = "0.8.0" dependencies = [ + "agb_fixnum", "agb_image_converter", "agb_macros", "agb_sound_converter", "bitflags", ] +[[package]] +name = "agb_fixnum" +version = "0.1.0" +dependencies = [ + "agb_macros", +] + [[package]] name = "agb_image_converter" version = "0.6.0" diff --git a/examples/the-hat-chooses-the-wizard/Cargo.lock b/examples/the-hat-chooses-the-wizard/Cargo.lock index 8a6e299e..96ef9a2e 100644 --- a/examples/the-hat-chooses-the-wizard/Cargo.lock +++ b/examples/the-hat-chooses-the-wizard/Cargo.lock @@ -12,12 +12,20 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" name = "agb" version = "0.8.0" dependencies = [ + "agb_fixnum", "agb_image_converter", "agb_macros", "agb_sound_converter", "bitflags", ] +[[package]] +name = "agb_fixnum" +version = "0.1.0" +dependencies = [ + "agb_macros", +] + [[package]] name = "agb_image_converter" version = "0.6.0" diff --git a/examples/the-hat-chooses-the-wizard/build.rs b/examples/the-hat-chooses-the-wizard/build.rs index 7df6d9dd..5b385333 100644 --- a/examples/the-hat-chooses-the-wizard/build.rs +++ b/examples/the-hat-chooses-the-wizard/build.rs @@ -170,7 +170,7 @@ mod tiled_export { &mut writer, r#" use crate::Level; - use agb::number::Vector2D; + use agb::fixnum::Vector2D; pub const fn get_level() -> Level {{ Level {{ diff --git a/examples/the-hat-chooses-the-wizard/src/enemies.rs b/examples/the-hat-chooses-the-wizard/src/enemies.rs index 799080c4..399474f3 100644 --- a/examples/the-hat-chooses-the-wizard/src/enemies.rs +++ b/examples/the-hat-chooses-the-wizard/src/enemies.rs @@ -1,7 +1,7 @@ use super::{object_tiles, sfx::SfxPlayer, Entity, FixedNumberType, HatState, Level}; use agb::{ display::object::{ObjectControl, Size}, - number::Vector2D, + fixnum::Vector2D, }; enum UpdateState { diff --git a/examples/the-hat-chooses-the-wizard/src/main.rs b/examples/the-hat-chooses-the-wizard/src/main.rs index aa5c9292..d4aa6574 100644 --- a/examples/the-hat-chooses-the-wizard/src/main.rs +++ b/examples/the-hat-chooses-the-wizard/src/main.rs @@ -109,8 +109,8 @@ use agb::{ object::{ObjectControl, ObjectStandard, Size}, Priority, HEIGHT, WIDTH, }, + fixnum::{FixedNum, Vector2D}, input::{self, Button, ButtonController}, - number::{FixedNum, Vector2D}, }; type FixedNumberType = FixedNum<10>; diff --git a/examples/the-purple-night/Cargo.lock b/examples/the-purple-night/Cargo.lock index 6d89970f..bebc8bad 100644 --- a/examples/the-purple-night/Cargo.lock +++ b/examples/the-purple-night/Cargo.lock @@ -12,12 +12,20 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" name = "agb" version = "0.8.0" dependencies = [ + "agb_fixnum", "agb_image_converter", "agb_macros", "agb_sound_converter", "bitflags", ] +[[package]] +name = "agb_fixnum" +version = "0.1.0" +dependencies = [ + "agb_macros", +] + [[package]] name = "agb_image_converter" version = "0.6.0" diff --git a/examples/the-purple-night/src/main.rs b/examples/the-purple-night/src/main.rs index 3ce4b92a..4d5df465 100644 --- a/examples/the-purple-night/src/main.rs +++ b/examples/the-purple-night/src/main.rs @@ -16,8 +16,8 @@ use agb::{ object::{ObjectControl, ObjectStandard}, Priority, HEIGHT, WIDTH, }, + fixnum::{FixedNum, Rect, Vector2D}, input::{Button, ButtonController, Tri}, - number::{FixedNum, Rect, Vector2D}, }; use generational_arena::Arena; diff --git a/examples/the-purple-night/src/sfx.rs b/examples/the-purple-night/src/sfx.rs index 400e5aaa..4fe33d75 100644 --- a/examples/the-purple-night/src/sfx.rs +++ b/examples/the-purple-night/src/sfx.rs @@ -1,5 +1,5 @@ use super::rng::get_random; -use agb::number::Num; +use agb::fixnum::Num; use agb::sound::mixer::{ChannelId, Mixer, SoundChannel}; const BAT_DEATH: &[u8] = agb::include_wav!("sfx/BatDeath.wav");