Add scroll area to tile db

This commit is contained in:
crumblingstatue 2023-04-08 17:54:25 +02:00
parent 38b6a476d9
commit 1662857731
3 changed files with 21 additions and 17 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before After
Before After

View file

@ -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

Binary file not shown.