diff --git a/res/graphics/tiles/dirtback.png b/res/graphics/tiles/dirtback.png new file mode 100644 index 0000000..5992744 Binary files /dev/null and b/res/graphics/tiles/dirtback.png differ diff --git a/res/graphics/tiles/platform.png b/res/graphics/tiles/platform.png new file mode 100644 index 0000000..ab06dbc Binary files /dev/null and b/res/graphics/tiles/platform.png differ diff --git a/res/graphics/tiles/stoneback.png b/res/graphics/tiles/stoneback.png new file mode 100644 index 0000000..a8fdba9 Binary files /dev/null and b/res/graphics/tiles/stoneback.png differ diff --git a/res/graphics/tiles/torch.png b/res/graphics/tiles/torch.png new file mode 100644 index 0000000..11852cb Binary files /dev/null and b/res/graphics/tiles/torch.png differ diff --git a/src/debug.rs b/src/debug.rs index 9d434e5..a6655f3 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -7,6 +7,7 @@ use crate::{ math::{px_per_frame_to_km_h, WorldPos}, res::Res, stringfmt::LengthDisp, + texture_atlas::AtlasBundle, tiles::tiledb_edit_ui::tiledb_edit_ui, }; @@ -87,6 +88,10 @@ fn debug_panel_ui( debug.tiledb_edit } }); + if ui.button("Reload graphics").clicked() { + res.atlas = AtlasBundle::new().unwrap(); + game.tile_db.update_rects(&res.atlas.rects); + } ui.separator(); egui::ScrollArea::vertical().show(ui, |ui| { gamedebug_core::for_each_imm(|info| match info { diff --git a/src/tiles.rs b/src/tiles.rs index dcb25de..53ca4b9 100644 --- a/src/tiles.rs +++ b/src/tiles.rs @@ -118,7 +118,11 @@ impl TileDb { pub(crate) fn update_rects(&mut self, rects: &RectMap) { for def in &mut self.db { if !def.graphic_name.is_empty() { - def.tex_rect = rects[&def.graphic_name]; + if let Some(rect) = rects.get(&def.graphic_name) { + def.tex_rect = *rect; + } else { + log::error!("Missing texture for {}", def.graphic_name); + } } } } diff --git a/tiles.dat b/tiles.dat index 883db81..9e30cc0 100644 Binary files a/tiles.dat and b/tiles.dat differ