mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
More impl Into<Vector2D<_>> and fix compile errors
This commit is contained in:
parent
f96b0e772b
commit
74451f819c
|
@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- An abstraction over hblank DMA to allow for cool effects like gradients and circular windows. See the dma_effect* examples.
|
||||
- Expermental and incomplete support for MIDI files with agb-tracker.
|
||||
|
||||
### Change
|
||||
- Bcakground `set_scroll_pos` and `set_tile` now accepts an `impl Into<Vector2D<u16>>` rather than a `Vector<u16>`.
|
||||
|
||||
## [0.18.1] - 2024/02/06
|
||||
|
||||
### Added
|
||||
|
|
|
@ -228,7 +228,7 @@ impl<'a, 'b> TextRenderer<'b> {
|
|||
for ((x, y), tile) in self.tiles.iter() {
|
||||
bg.set_tile(
|
||||
vram_manager,
|
||||
(self.tile_pos.x + *x as u16, self.tile_pos.y + *y as u16).into(),
|
||||
(self.tile_pos.x + *x as u16, self.tile_pos.y + *y as u16),
|
||||
&tile.tile_set(),
|
||||
tile.tile_setting(),
|
||||
);
|
||||
|
|
|
@ -273,7 +273,7 @@ impl<'a> InfiniteScrolledMap<'a> {
|
|||
|
||||
self.map.set_tile(
|
||||
vram,
|
||||
(x_idx as u16, (y_idx + copy_from as usize) as u16).into(),
|
||||
(x_idx as u16, (y_idx + copy_from as usize) as u16),
|
||||
tileset,
|
||||
tile_setting,
|
||||
);
|
||||
|
@ -373,8 +373,7 @@ impl<'a> InfiniteScrolledMap<'a> {
|
|||
(
|
||||
size.tile_pos_x(tile_x - self.offset.x),
|
||||
size.tile_pos_y(tile_y - self.offset.y),
|
||||
)
|
||||
.into(),
|
||||
),
|
||||
tileset,
|
||||
tile_setting,
|
||||
);
|
||||
|
|
|
@ -225,7 +225,7 @@ impl RegularMap {
|
|||
pub fn set_tile(
|
||||
&mut self,
|
||||
vram: &mut VRamManager,
|
||||
pos: Vector2D<u16>,
|
||||
pos: impl Into<Vector2D<u16>>,
|
||||
tileset: &TileSet<'_>,
|
||||
tile_setting: TileSetting,
|
||||
) {
|
||||
|
@ -237,7 +237,7 @@ impl RegularMap {
|
|||
self.colours()
|
||||
);
|
||||
|
||||
let pos = self.map_size().gba_offset(pos);
|
||||
let pos = self.map_size().gba_offset(pos.into());
|
||||
self.set_tile_at_pos(vram, pos, tileset, tile_setting);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ pub(crate) fn load_help_text(
|
|||
|
||||
background.set_tile(
|
||||
vram,
|
||||
(x + at_tile.0, at_tile.1).into(),
|
||||
(x + at_tile.0, at_tile.1),
|
||||
&help_tiledata.tiles,
|
||||
help_tiledata.tile_settings[tile_id as usize],
|
||||
)
|
||||
|
@ -53,7 +53,7 @@ pub(crate) fn load_description(
|
|||
let tile_id = y * 8 + x + 8 * 11 * (face_id as u16 % 10);
|
||||
descriptions_map.set_tile(
|
||||
vram,
|
||||
(x, y).into(),
|
||||
(x, y),
|
||||
&description_data.tiles,
|
||||
description_data.tile_settings[tile_id as usize],
|
||||
)
|
||||
|
@ -74,15 +74,15 @@ fn create_background_map(map: &mut RegularMap, vram: &mut VRamManager, stars_til
|
|||
backgrounds::stars.tile_settings[tile_id as usize]
|
||||
};
|
||||
|
||||
map.set_tile(vram, (x, y).into(), stars_tileset, tile_setting);
|
||||
map.set_tile(vram, (x, y), stars_tileset, tile_setting);
|
||||
}
|
||||
}
|
||||
|
||||
map.set_scroll_pos((0i16, rng::gen().rem_euclid(8) as i16).into());
|
||||
map.set_scroll_pos((0i16, rng::gen().rem_euclid(8) as i16));
|
||||
}
|
||||
|
||||
pub fn show_title_screen(background: &mut RegularMap, vram: &mut VRamManager, sfx: &mut Sfx) {
|
||||
background.set_scroll_pos((0i16, 0).into());
|
||||
background.set_scroll_pos((0i16, 0));
|
||||
vram.set_background_palettes(backgrounds::PALETTES);
|
||||
|
||||
background.set_visible(false);
|
||||
|
|
|
@ -489,7 +489,7 @@ pub(crate) fn battle_screen(
|
|||
agb.sfx.battle();
|
||||
agb.sfx.frame();
|
||||
|
||||
help_background.set_scroll_pos((-16i16, -97i16).into());
|
||||
help_background.set_scroll_pos((-16i16, -97i16));
|
||||
crate::background::load_help_text(&mut agb.vram, help_background, 1, (0, 0));
|
||||
crate::background::load_help_text(&mut agb.vram, help_background, 2, (0, 1));
|
||||
|
||||
|
|
|
@ -163,9 +163,9 @@ pub(crate) fn customise_screen(
|
|||
) -> PlayerDice {
|
||||
agb.sfx.customise();
|
||||
agb.sfx.frame();
|
||||
descriptions_map.set_scroll_pos((-174i16, -52).into());
|
||||
descriptions_map.set_scroll_pos((-174i16, -52));
|
||||
|
||||
help_background.set_scroll_pos((-148i16, -34).into());
|
||||
help_background.set_scroll_pos((-148i16, -34));
|
||||
crate::background::load_help_text(&mut agb.vram, help_background, 0, (0, 0));
|
||||
|
||||
// create the dice
|
||||
|
|
|
@ -26,7 +26,7 @@ pub fn load_ui(map: &mut RegularMap, vram_manager: &mut VRamManager) {
|
|||
let tile_pos = y * 30 + x;
|
||||
let tile_setting = tilemaps::UI_BACKGROUND_MAP[tile_pos as usize];
|
||||
|
||||
map.set_tile(vram_manager, (x, y).into(), &ui_tileset, tile_setting);
|
||||
map.set_tile(vram_manager, (x, y), &ui_tileset, tile_setting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ pub fn load_level_background(
|
|||
let tile_pos = y * 22 + x;
|
||||
let tile_setting = level_map[tile_pos as usize];
|
||||
|
||||
map.set_tile(vram_manager, (x, y).into(), &level_tileset, tile_setting);
|
||||
map.set_tile(vram_manager, (x, y), &level_tileset, tile_setting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ pub fn write_level(
|
|||
.iter()
|
||||
.enumerate()
|
||||
{
|
||||
map.set_tile(vram, (i as u16, 0).into(), tileset, tile_settings[tile]);
|
||||
map.set_tile(vram, (i as u16, 0), tileset, tile_settings[tile]);
|
||||
}
|
||||
|
||||
map.set_scroll_pos((-(WIDTH / 2 - 7 * 8 / 2) as i16, -(HEIGHT / 2 - 4) as i16).into());
|
||||
map.set_scroll_pos((-(WIDTH / 2 - 7 * 8 / 2) as i16, -(HEIGHT / 2 - 4) as i16));
|
||||
}
|
||||
|
|
|
@ -794,7 +794,7 @@ pub fn main(mut agb: agb::Gba) -> ! {
|
|||
for x in 0..32u16 {
|
||||
world_display.set_tile(
|
||||
&mut vram,
|
||||
(x, y).into(),
|
||||
(x, y),
|
||||
&tileset,
|
||||
tile_sheet::background.tile_settings[level_display::BLANK],
|
||||
);
|
||||
|
|
|
@ -17,7 +17,7 @@ pub fn show_splash_screen(
|
|||
map: &mut RegularMap,
|
||||
vram: &mut VRamManager,
|
||||
) {
|
||||
map.set_scroll_pos((0i16, 0i16).into());
|
||||
map.set_scroll_pos((0i16, 0i16));
|
||||
let tile_data = match which {
|
||||
SplashScreen::Start => splash_screens::splash,
|
||||
SplashScreen::End => splash_screens::thanks_for_playing,
|
||||
|
|
Loading…
Reference in a new issue