From 61c9c73f399a075b54bd7fea9f6d625c42e890ec Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Wed, 17 Apr 2024 10:43:06 +0300 Subject: [PATCH] use slider --- src/gui.cpp | 26 ++++++++++++++++---------- src/gui.hpp | 2 +- src/main.cpp | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/gui.cpp b/src/gui.cpp index c1b9432..60148ce 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -23,13 +23,15 @@ along with this program. If not, see . #include #include -#include +#include #include "car_widget.hpp" #include "gauge.hpp" using namespace std::string_literals; +using namespace ruis::length_literals; + using namespace carcockpit; namespace m { @@ -37,7 +39,7 @@ using namespace ruis::make; using namespace carcockpit::make; } // namespace m -utki::shared_ref carcockpit::make_root_layout(utki::shared_ref c) +utki::shared_ref carcockpit::make_root_widgets(utki::shared_ref c) { using ruis::lp; @@ -50,15 +52,19 @@ utki::shared_ref carcockpit::make_root_layout(utki::shared_ref( - c, - tml::read(R"( - id{gauge_slider} - lp{dx{fill}dy{30pp}} - )") + m::slider(c, + { + .widget_params = { + .id = "gauge_slider"s, + .lp = { + .dims = {lp::fill, 30_pp} + } + }, + .oriented_params = { + .vertical = false + } + } ), - m::container( c, { diff --git a/src/gui.hpp b/src/gui.hpp index 5a488c5..b96da90 100644 --- a/src/gui.hpp +++ b/src/gui.hpp @@ -25,6 +25,6 @@ along with this program. If not, see . namespace carcockpit { -utki::shared_ref make_root_layout(utki::shared_ref c); +utki::shared_ref make_root_widgets(utki::shared_ref c); } // namespace carcockpit diff --git a/src/main.cpp b/src/main.cpp index 3f4047b..2c45360 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -52,7 +52,7 @@ class application : public ruisapp::application this->gui.context.get().loader.mount_res_pack(*this->get_res_file(papki::as_dir(res_path))); - this->gui.set_root(make_root_layout(this->gui.context)); + this->gui.set_root(make_root_widgets(this->gui.context)); } };