fix coordinates

This commit is contained in:
Corwin Kuiper 2021-06-05 00:26:10 +01:00
parent 225d0aca9f
commit 3b9231ef6e

View file

@ -87,11 +87,11 @@ impl ObjectStandard<'_> {
} }
/// Sets the x coordinate of the sprite on screen. /// Sets the x coordinate of the sprite on screen.
pub fn set_x(&mut self, x: u8) { pub fn set_x(&mut self, x: u16) {
self.attributes.set_x(x) self.attributes.set_x(x)
} }
/// Sets the y coordinate of the sprite on screen. /// Sets the y coordinate of the sprite on screen.
pub fn set_y(&mut self, y: u8) { pub fn set_y(&mut self, y: u16) {
self.attributes.set_y(y) self.attributes.set_y(y)
} }
/// Sets the index of the tile to use as the sprite. Potentially a temporary function. /// Sets the index of the tile to use as the sprite. Potentially a temporary function.
@ -124,11 +124,11 @@ impl<'a> ObjectAffine<'a> {
} }
/// Sets the x coordinate of the sprite on screen. /// Sets the x coordinate of the sprite on screen.
pub fn set_x(&mut self, x: u8) { pub fn set_x(&mut self, x: u16) {
self.attributes.set_x(x) self.attributes.set_x(x)
} }
/// Sets the y coordinate of the sprite on screen. /// Sets the y coordinate of the sprite on screen.
pub fn set_y(&mut self, y: u8) { pub fn set_y(&mut self, y: u16) {
self.attributes.set_y(y) self.attributes.set_y(y)
} }
/// Sets the index of the tile to use as the sprite. Potentially a temporary function. /// Sets the index of the tile to use as the sprite. Potentially a temporary function.
@ -203,12 +203,12 @@ impl ObjectAttribute {
self.a1 = set_bits(self.a1, a1, 2, 0xE); self.a1 = set_bits(self.a1, a1, 2, 0xE);
} }
fn set_x(&mut self, x: u8) { fn set_x(&mut self, x: u16) {
self.a1 = set_bits(self.a1, x as u16, 8, 0); self.a1 = set_bits(self.a1, x, 9, 0);
} }
fn set_y(&mut self, y: u8) { fn set_y(&mut self, y: u16) {
self.a0 = set_bits(self.a0, y as u16, 8, 0) self.a0 = set_bits(self.a0, y, 8, 0)
} }
fn set_tile_id(&mut self, id: u16) { fn set_tile_id(&mut self, id: u16) {