From 3e3450904940f9083538b34ac3617c65298b4a82 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Wed, 23 Mar 2022 20:34:55 +0000 Subject: [PATCH] Rename get_object to object --- agb/examples/chicken.rs | 2 +- agb/examples/sprites.rs | 4 ++-- agb/src/display/object.rs | 2 +- book/games/pong/src/main.rs | 2 +- examples/the-hat-chooses-the-wizard/src/main.rs | 2 +- examples/the-purple-night/src/main.rs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/agb/examples/chicken.rs b/agb/examples/chicken.rs index 3d34fbb1..17bc887b 100644 --- a/agb/examples/chicken.rs +++ b/agb/examples/chicken.rs @@ -74,7 +74,7 @@ fn main(mut gba: agb::Gba) -> ! { let sprite = object.sprite(&ChickenSprites[0]); let mut chicken = Character { - object: object.get_object(sprite), + object: object.object(sprite), position: Vector2D { x: (6 * 8) << 8, y: ((7 * 8) - 4) << 8, diff --git a/agb/examples/sprites.rs b/agb/examples/sprites.rs index 7b3bbaf6..b4b9daf5 100644 --- a/agb/examples/sprites.rs +++ b/agb/examples/sprites.rs @@ -20,7 +20,7 @@ fn all_sprites(gfx: &ObjectController) { for y in 0..9 { for x in 0..14 { - let mut obj = gfx.get_object(gfx.sprite(&SPRITES[0])); + let mut obj = gfx.object(gfx.sprite(&SPRITES[0])); obj.show(); obj.set_position((x * 16 + 8, y * 16 + 8).into()); objs.push(obj); @@ -65,7 +65,7 @@ fn all_tags(gfx: &ObjectController) { let sprite = v.sprite(0); let (size_x, size_y) = sprite.size().to_width_height(); let (size_x, size_y) = (size_x as i32, size_y as i32); - let mut obj = gfx.get_object(gfx.sprite(sprite)); + let mut obj = gfx.object(gfx.sprite(sprite)); obj.show(); obj.set_position((x * 32 + 16 - size_x / 2, y * 32 + 16 - size_y / 2).into()); objs.push((obj, v)); diff --git a/agb/src/display/object.rs b/agb/src/display/object.rs index b5ae0d2b..43109e86 100644 --- a/agb/src/display/object.rs +++ b/agb/src/display/object.rs @@ -361,7 +361,7 @@ impl ObjectController { } } - pub fn get_object<'a, 'b>(&'a self, sprite: SpriteBorrow<'b>) -> Object<'b, 'a> { + pub fn object<'a, 'b>(&'a self, sprite: SpriteBorrow<'b>) -> Object<'b, 'a> { self.try_get_object(sprite).expect("No object available") } diff --git a/book/games/pong/src/main.rs b/book/games/pong/src/main.rs index 93e65a90..540c3bb9 100644 --- a/book/games/pong/src/main.rs +++ b/book/games/pong/src/main.rs @@ -24,7 +24,7 @@ fn main(mut gba: Gba) -> ! { const BALL: &Tag = GRAPHICS.tags().get("Ball"); let ball_sprite = object.sprite(BALL.sprite(0)); - let mut ball = object.get_object(ball_sprite); + let mut ball = object.object(ball_sprite); ball.set_x(50).set_y(50).show(); diff --git a/examples/the-hat-chooses-the-wizard/src/main.rs b/examples/the-hat-chooses-the-wizard/src/main.rs index eb9e94e8..6831b004 100644 --- a/examples/the-hat-chooses-the-wizard/src/main.rs +++ b/examples/the-hat-chooses-the-wizard/src/main.rs @@ -120,7 +120,7 @@ pub struct Entity<'a> { impl<'a> Entity<'a> { pub fn new(object: &'a ObjectController, collision_mask: Vector2D) -> Self { let dummy_sprite = object.sprite(WALKING.sprite(0)); - let mut sprite = object.get_object(dummy_sprite); + let mut sprite = object.object(dummy_sprite); sprite.set_priority(Priority::P1); Entity { sprite, diff --git a/examples/the-purple-night/src/main.rs b/examples/the-purple-night/src/main.rs index ac4e2aab..48cbef4c 100644 --- a/examples/the-purple-night/src/main.rs +++ b/examples/the-purple-night/src/main.rs @@ -162,7 +162,7 @@ struct Entity<'a> { impl<'a> Entity<'a> { fn new(object_controller: &'a ObjectController, collision_mask: Rect) -> Self { let s = object_controller.sprite(LONGSWORD_IDLE.sprite(0)); - let mut sprite = object_controller.get_object(s); + let mut sprite = object_controller.object(s); sprite.set_priority(Priority::P1); Entity { sprite,