mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 20:35:02 +01:00
More graphics, live reloading of textures
This commit is contained in:
parent
f31add5218
commit
cee7652e09
7 changed files with 10 additions and 1 deletions
BIN
res/graphics/tiles/dirtback.png
Normal file
BIN
res/graphics/tiles/dirtback.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
BIN
res/graphics/tiles/platform.png
Normal file
BIN
res/graphics/tiles/platform.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 568 B |
BIN
res/graphics/tiles/stoneback.png
Normal file
BIN
res/graphics/tiles/stoneback.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
BIN
res/graphics/tiles/torch.png
Normal file
BIN
res/graphics/tiles/torch.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 694 B |
|
|
@ -7,6 +7,7 @@ use crate::{
|
||||||
math::{px_per_frame_to_km_h, WorldPos},
|
math::{px_per_frame_to_km_h, WorldPos},
|
||||||
res::Res,
|
res::Res,
|
||||||
stringfmt::LengthDisp,
|
stringfmt::LengthDisp,
|
||||||
|
texture_atlas::AtlasBundle,
|
||||||
tiles::tiledb_edit_ui::tiledb_edit_ui,
|
tiles::tiledb_edit_ui::tiledb_edit_ui,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -87,6 +88,10 @@ fn debug_panel_ui(
|
||||||
debug.tiledb_edit
|
debug.tiledb_edit
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if ui.button("Reload graphics").clicked() {
|
||||||
|
res.atlas = AtlasBundle::new().unwrap();
|
||||||
|
game.tile_db.update_rects(&res.atlas.rects);
|
||||||
|
}
|
||||||
ui.separator();
|
ui.separator();
|
||||||
egui::ScrollArea::vertical().show(ui, |ui| {
|
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||||
gamedebug_core::for_each_imm(|info| match info {
|
gamedebug_core::for_each_imm(|info| match info {
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,11 @@ impl TileDb {
|
||||||
pub(crate) fn update_rects(&mut self, rects: &RectMap) {
|
pub(crate) fn update_rects(&mut self, rects: &RectMap) {
|
||||||
for def in &mut self.db {
|
for def in &mut self.db {
|
||||||
if !def.graphic_name.is_empty() {
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
tiles.dat
BIN
tiles.dat
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue