MCPcopy Create free account
hub / github.com/XorTroll/Goldleaf / OnLoad

Method OnLoad

Goldleaf/source/ui/ui_MainApplication.cpp:74–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72 }
73
74 void MainApplication::OnLoad() {
75 // Load the file hex-viewer font
76 auto file_cnt_font = std::make_shared<pu::ttf::Font>(40);
77 GLEAF_ASSERT_TRUE(file_cnt_font->LoadFromFile(g_Settings.PathForResource("/FileContentFont.ttf")));
78 pu::ui::render::AddFont("FileContentFont", file_cnt_font);
79
80 this->SetFadeAlphaIncrementStepCount(12);
81 LoadCommonIcons();
82
83 this->cur_battery_val = 0;
84 this->cur_selected_user = {};
85 this->cur_is_charging = false;
86 this->cur_time = "";
87 this->read_values_once = false;
88 this->cur_conn_strength = 0;
89 this->base_img = pu::ui::elm::Image::New(0, 0, pu::sdl2::TextureHandle::New(pu::ui::render::LoadImageFromFile(g_Settings.PathForResource("/Base.png"))));
90 this->time_text = pu::ui::elm::TextBlock::New(140, 32, "...");
91 this->time_text->SetColor(g_Settings.GetColorScheme().text);
92 this->battery_text = pu::ui::elm::TextBlock::New(1745, 32, "...");
93 this->battery_text->SetFont(pu::ui::GetDefaultFont(pu::ui::DefaultFontSize::MediumLarge));
94 this->battery_text->SetColor(g_Settings.GetColorScheme().text);
95 this->battery_img = pu::ui::elm::Image::New(1635, 10, pu::sdl2::TextureHandle::New(pu::ui::render::LoadImageFromFile(g_Settings.PathForResource("/Battery/0.png"))));
96 this->battery_charge_img = pu::ui::elm::Image::New(1635, 10, pu::sdl2::TextureHandle::New(pu::ui::render::LoadImageFromFile(g_Settings.PathForResource("/Battery/Charge.png"))));
97 this->battery_charge_img->SetWidth(80);
98 this->battery_charge_img->SetHeight(80);
99 this->menu_banner_img = pu::ui::elm::Image::New(40, 125, pu::sdl2::TextureHandle::New(pu::ui::render::LoadImageFromFile(g_Settings.PathForResource("/MenuBanner.png"))));
100 this->menu_version_text = pu::ui::elm::TextBlock::New(590, 195, "v" GLEAF_VERSION);
101 this->menu_version_text->SetFont(pu::ui::GetDefaultFont(pu::ui::DefaultFontSize::Large));
102 this->menu_version_text->SetColor(g_Settings.GetColorScheme().version_text);
103 this->menu_img = pu::ui::elm::Image::New(40, 125, GetCommonIcon(CommonIconKind::SdCard));
104 this->user_img = ClickableImage::New(1600, 135, GetCommonIcon(CommonIconKind::User));
105 this->user_img->SetWidth(105);
106 this->user_img->SetHeight(105);
107 this->user_img->SetOnClick(std::bind(&MainApplication::PickUser, this));
108 this->help_img = ClickableImage::New(1770, 135, GetCommonIcon(CommonIconKind::Help));
109 this->help_img->SetWidth(110);
110 this->help_img->SetHeight(110);
111 this->help_img->SetOnClick(std::bind(&MainApplication::helpImage_OnClick, this));
112 this->usb_img = pu::ui::elm::Image::New(450, 10, GetCommonIcon(CommonIconKind::USB));
113 this->usb_img->SetWidth(80);
114 this->usb_img->SetHeight(80);
115 this->usb_img->SetVisible(false);
116 this->conn_img = pu::ui::elm::Image::New(640, 10, pu::sdl2::TextureHandle::New(pu::ui::render::LoadImageFromFile(g_Settings.PathForResource("/Connection/None.png"))));
117 this->conn_img->SetWidth(80);
118 this->conn_img->SetHeight(80);
119 this->conn_img->SetVisible(true);
120 this->ip_text = pu::ui::elm::TextBlock::New(740, 32, "");
121 this->ip_text->SetFont(pu::ui::GetDefaultFont(pu::ui::DefaultFontSize::MediumLarge));
122 this->ip_text->SetColor(g_Settings.GetColorScheme().text);
123 this->menu_name_text = pu::ui::elm::TextBlock::New(200, 145, "...");
124 this->menu_name_text->SetFont(pu::ui::GetDefaultFont(pu::ui::DefaultFontSize::Large));
125 this->menu_name_text->SetColor(g_Settings.GetColorScheme().text);
126 this->menu_head_text = pu::ui::elm::TextBlock::New(200, 200, "...");
127 this->menu_head_text->SetFont(pu::ui::GetDefaultFont(pu::ui::DefaultFontSize::MediumLarge));
128 this->menu_head_text->SetColor(g_Settings.GetColorScheme().text);
129 this->menu_head_text->SetClampWidth(1380);
130 this->menu_head_text->SetClampSpeed(5);
131 this->menu_head_text->SetClampDelay(60);

Callers

nothing calls this directly

Calls 9

UnloadMenuDataMethod · 0.95
UpdateValuesMethod · 0.95
ShowLayoutMethod · 0.95
LoadCommonIconsFunction · 0.85
GetCommonIconFunction · 0.85
PathForResourceMethod · 0.80
SetWidthMethod · 0.80
SetHeightMethod · 0.80
SetOnClickMethod · 0.80

Tested by

no test coverage detected