mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-14 19:55:02 +01:00
Add scroll area to tile db
This commit is contained in:
parent
38b6a476d9
commit
1662857731
3 changed files with 21 additions and 17 deletions
BIN
res/tiles.png
BIN
res/tiles.png
Binary file not shown.
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
|
@ -9,25 +9,29 @@ pub fn tiledb_edit_ui(ctx: &egui::Context, tile_db: &mut TileDb) {
|
|||
egui::Window::new("Tiledb editor").show(ctx, |ui| {
|
||||
ui.label(format!("Number of tile defs: {}", tile_db.db.len()));
|
||||
ui.separator();
|
||||
for (i, def) in tile_db.db.iter_mut().enumerate() {
|
||||
ui.label(i.to_string());
|
||||
match &mut def.light {
|
||||
Some(light) => {
|
||||
ui.label("x");
|
||||
ui.add(egui::DragValue::new(&mut light.x));
|
||||
ui.label("y");
|
||||
ui.add(egui::DragValue::new(&mut light.y));
|
||||
}
|
||||
None => {
|
||||
if ui.button("Insert light emit").clicked() {
|
||||
def.light = Some(ScreenVec {
|
||||
x: TILE_SIZE as ScreenSc / 2,
|
||||
y: TILE_SIZE as ScreenSc / 2,
|
||||
});
|
||||
egui::ScrollArea::vertical()
|
||||
.max_height(400.0)
|
||||
.show(ui, |ui| {
|
||||
for (i, def) in tile_db.db.iter_mut().enumerate() {
|
||||
ui.label(i.to_string());
|
||||
match &mut def.light {
|
||||
Some(light) => {
|
||||
ui.label("x");
|
||||
ui.add(egui::DragValue::new(&mut light.x));
|
||||
ui.label("y");
|
||||
ui.add(egui::DragValue::new(&mut light.y));
|
||||
}
|
||||
None => {
|
||||
if ui.button("Insert light emit").clicked() {
|
||||
def.light = Some(ScreenVec {
|
||||
x: TILE_SIZE as ScreenSc / 2,
|
||||
y: TILE_SIZE as ScreenSc / 2,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
ui.separator();
|
||||
if ui.button("Add new default").clicked() {
|
||||
tile_db.db.push(super::TileDef::default());
|
||||
|
|
|
|||
BIN
tiles.dat
BIN
tiles.dat
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue