diff --git a/assets/ui/bulldozer.png b/assets/ui/bulldozer_old.png similarity index 100% rename from assets/ui/bulldozer.png rename to assets/ui/bulldozer_old.png diff --git a/assets/ui/icons/curved_road.png b/assets/ui/icons/curved_road.png deleted file mode 100644 index bd90d25e..00000000 --- a/assets/ui/icons/curved_road.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c512cfe682e1a25cc5d88568e34e5368e71717cb29b07f049d2c78201ea732c8 -size 5011 diff --git a/assets/ui/icons/select_triangle_under.png b/assets/ui/icons/select_triangle_under.png new file mode 100644 index 00000000..ffa3630d --- /dev/null +++ b/assets/ui/icons/select_triangle_under.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fab7f40d8c913baf33c6d2a095922a232a75bef0fda8f44a670de8c71d19e047 +size 1248 diff --git a/assets/ui/icons/straight_road.png b/assets/ui/icons/straight_road.png deleted file mode 100644 index 5b557122..00000000 --- a/assets/ui/icons/straight_road.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c7c218e835cf411537997b3d53c301cc83112c65748347d243c7af5f743f36a2 -size 3908 diff --git a/assets/ui/icons/toolbar_bulldozer.png b/assets/ui/icons/toolbar_bulldozer.png new file mode 100644 index 00000000..64dc3e72 --- /dev/null +++ b/assets/ui/icons/toolbar_bulldozer.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a718f22308b691c3fac3779452787b103e330ae5161e3503d86cf0f4d883a9a +size 6639 diff --git a/assets/ui/icons/toolbar_companies.png b/assets/ui/icons/toolbar_companies.png new file mode 100644 index 00000000..7926bcbb --- /dev/null +++ b/assets/ui/icons/toolbar_companies.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b23b2468ddf0469bdda125cca7543cdf7612ce119ce41c8d6c1aae7ed7c1c1e +size 6960 diff --git a/assets/ui/icons/toolbar_curved_road.png b/assets/ui/icons/toolbar_curved_road.png new file mode 100644 index 00000000..f296343c --- /dev/null +++ b/assets/ui/icons/toolbar_curved_road.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a51ce645036afcf50568a28d44050602c5b686fac7ded23443680f6544f0c44 +size 5929 diff --git a/assets/ui/icons/toolbar_housetool.png b/assets/ui/icons/toolbar_housetool.png new file mode 100644 index 00000000..1ed7c175 --- /dev/null +++ b/assets/ui/icons/toolbar_housetool.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:766ef5ed03769e0051917726f61a32069400da457bfd982d804d02823b162a80 +size 6251 diff --git a/assets/ui/icons/toolbar_road_edit.png b/assets/ui/icons/toolbar_road_edit.png new file mode 100644 index 00000000..10e2914c --- /dev/null +++ b/assets/ui/icons/toolbar_road_edit.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c6d2fcdb54dbc79f506783d09a583c4e60aa5a9eef45f94b253d4ec6c2e7e82 +size 5968 diff --git a/assets/ui/icons/toolbar_straight_road.png b/assets/ui/icons/toolbar_straight_road.png new file mode 100644 index 00000000..7197ede7 --- /dev/null +++ b/assets/ui/icons/toolbar_straight_road.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79de2a15ad0af713992c9510ee57559e366c27cde6a036ccbe7c9a23bf2e6289 +size 4372 diff --git a/assets/ui/icons/toolbar_terraform.png b/assets/ui/icons/toolbar_terraform.png new file mode 100644 index 00000000..2d9e4793 --- /dev/null +++ b/assets/ui/icons/toolbar_terraform.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9c01466f2ef7cba95ea3325640ddba18407dccf339ad3f5365efc9d25b1f2fd +size 6618 diff --git a/assets/ui/icons/toolbar_train.png b/assets/ui/icons/toolbar_train.png new file mode 100644 index 00000000..15ef74db --- /dev/null +++ b/assets/ui/icons/toolbar_train.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0adc9fdea59e53ca18a1cc28410b8973e3b1aa7cb74877986dbf2805377c695f +size 5213 diff --git a/assets/ui/road_edit.png b/assets/ui/road_edit_old.png similarity index 100% rename from assets/ui/road_edit.png rename to assets/ui/road_edit_old.png diff --git a/native_app/src/gui/mod.rs b/native_app/src/gui/mod.rs index 07860adf..964cc774 100644 --- a/native_app/src/gui/mod.rs +++ b/native_app/src/gui/mod.rs @@ -183,12 +183,15 @@ impl UiTextures { } pub fn get(&self, name: &str) -> TextureId { - self.textures.get(name).unwrap().id() + match self.textures.get(name) { + None => panic!("Couldn't find texture (egui) {}", name), + Some(x) => x.id(), + } } pub fn get_yakui(&self, name: &str) -> yakui::TextureId { match self.yakui_textures.get(name) { - None => panic!("Couldn't find texture {}", name), + None => panic!("Couldn't find texture (yakui) {}", name), Some(x) => *x, } } diff --git a/native_app/src/gui/topgui.rs b/native_app/src/gui/topgui.rs index 482fe167..77c5b240 100644 --- a/native_app/src/gui/topgui.rs +++ b/native_app/src/gui/topgui.rs @@ -185,10 +185,10 @@ impl Gui { let tools = [ ("road", Tab::Roadbuild, Tool::RoadbuildStraight), ("curved", Tab::Roadcurved, Tool::RoadbuildCurved), - ("road_edit", Tab::Roadeditor, Tool::RoadEditor), + ("road_edit_old", Tab::Roadeditor, Tool::RoadEditor), ("housebrush", Tab::Housebrush, Tool::LotBrush), ("buildings", Tab::Roadbuilding, Tool::SpecialBuilding), - ("bulldozer", Tab::Bulldozer, Tool::Bulldozer), + ("bulldozer_old", Tab::Bulldozer, Tool::Bulldozer), ("traintool", Tab::Train, Tool::Train), ("terraform", Tab::Terraforming, Tool::Terraforming), ]; diff --git a/native_app/src/newgui/topgui.rs b/native_app/src/newgui/topgui.rs index 9a340e66..8ec82d7e 100644 --- a/native_app/src/newgui/topgui.rs +++ b/native_app/src/newgui/topgui.rs @@ -1,8 +1,8 @@ use ordered_float::OrderedFloat; use yakui::widgets::{List, Pad}; use yakui::{ - constrained, reflow, row, spacer, Alignment, Color, Constraints, CrossAxisAlignment, Dim2, - MainAxisAlignment, MainAxisSize, Vec2, + column, constrained, image, reflow, row, spacer, Alignment, Color, Constraints, + CrossAxisAlignment, Dim2, MainAxisAlignment, MainAxisSize, Vec2, }; use goryak::{ @@ -145,14 +145,14 @@ impl Gui { } let tools = [ - ("straight_road", Tool::RoadbuildStraight), - ("curved_road", Tool::RoadbuildCurved), - //("road_edit", Tool::RoadEditor), - //("housebrush", Tool::LotBrush), - //("buildings", Tool::SpecialBuilding), - //("bulldozer", Tool::Bulldozer), - //("traintool", Tool::Train), - //("terraform", Tool::Terraforming), + ("toolbar_straight_road", Tool::RoadbuildStraight), + ("toolbar_curved_road", Tool::RoadbuildCurved), + ("toolbar_road_edit", Tool::RoadEditor), + ("toolbar_housetool", Tool::LotBrush), + ("toolbar_companies", Tool::SpecialBuilding), + ("toolbar_bulldozer", Tool::Bulldozer), + ("toolbar_train", Tool::Train), + ("toolbar_terraform", Tool::Terraforming), ]; yakui::reflow(Alignment::TOP_LEFT, Dim2::ZERO, || { @@ -167,25 +167,45 @@ impl Gui { padxy(0.0, 10.0, || { let mut l = List::row(); l.main_axis_alignment = MainAxisAlignment::Center; + l.item_spacing = 10.0; l.show(|| { for (name, tool) in &tools { - let tint = if *tool == *uiworld.read::() { - primary() - } else { - Color::WHITE - }; - - if image_button( - uiworld.read::().get_yakui(name), - Vec2::new(64.0, 64.0), - tint, - Color::WHITE.with_alpha(0.7), - primary(), - ) - .clicked - { - *uiworld.write::() = *tool; - } + let (default_col, hover_col) = + if *tool == *uiworld.read::() { + let c = primary().lerp(&Color::WHITE, 0.3); + (c, c) + } else { + (Color::WHITE, Color::WHITE.with_alpha(0.7)) + }; + + column(|| { + if image_button( + uiworld.read::().get_yakui(name), + Vec2::new(64.0, 64.0), + default_col, + hover_col, + primary(), + ) + .clicked + { + *uiworld.write::() = *tool; + } + + if *tool == *uiworld.read::() { + reflow( + Alignment::CENTER_LEFT, + Dim2::pixels(0.0, 32.0), + || { + image( + uiworld + .read::() + .get_yakui("select_triangle_under"), + Vec2::new(64.0, 10.0), + ); + }, + ); + } + }); } }); });