@@ -25,6 +25,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2525#include " widget/input/character_input_widget.hpp"
2626#include " widget/label/gap.hpp"
2727
28+ // TODO: remove when guit::init_standard_widgets() is removed
29+ #include " standard_widgets.hpp"
30+
2831using namespace std ::string_view_literals;
2932
3033using namespace ruis ;
@@ -37,47 +40,7 @@ gui::gui(utki::shared_ref<ruis::context> context) :
3740
3841void gui::init_standard_widgets (const fsif::file& fi)
3942{
40- // mount default resource pack
41-
42- std::vector<std::string> paths;
43-
44- if (!fi.path ().empty ()) {
45- paths.push_back (fi.path ());
46- }
47-
48- paths.emplace_back (" ruis_res/" );
49-
50- #if (M_OS == M_OS_LINUX && M_OS_NAME != M_OS_NAME_ANDROID) || (M_OS == M_OS_MACOSX && M_OS_NAME != M_OS_NAME_IOS) || \
51- (M_OS == M_OS_UNIX )
52-
53- unsigned soname =
54- # include " ../soname.txt"
55- ;
56-
57- paths.push_back (utki::cat (" /usr/local/share/ruis/res" sv, soname));
58- paths.push_back (utki::cat (" /usr/share/ruis/res" sv, soname));
59- #endif
60-
61- bool mounted = false ;
62- for (const auto & s : paths) {
63- try {
64- fi.set_path (s);
65- this ->context .get ().loader ().mount_res_pack (fi);
66- } catch (std::runtime_error&) {
67- continue ;
68- }
69-
70- mounted = true ;
71- break ;
72- }
73-
74- if (!mounted) {
75- throw std::runtime_error (" gui::init_standard_widgets(): could not mount default resource pack" );
76- }
77-
78- // TODO: pass which style to load via parameter
79- auto style_res = this ->context .get ().loader ().load <ruis::res::tml>(" ruis_tml_style_dark" sv);
80- this ->context .get ().style ().set (utki::make_shared<style_sheet>(style_res.get ().forest ));
43+ ruis::init_standard_widgets (this ->context , fi);
8144}
8245
8346void gui::set_viewport (const ruis::rect& rect)
0 commit comments