Skip to content

Commit 53954b1

Browse files
Add versions and credits
1 parent c27f83a commit 53954b1

File tree

2 files changed

+79
-5
lines changed

2 files changed

+79
-5
lines changed

CubeModLoader/CWSDK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 1d65c9a010dc13f647051bcdd6635bf6e4839a55
1+
Subproject commit 6c3c518adec22d591721b96e1d38db5490f6010e

CubeModLoader/callbacks/gui/cube__StartMenuWidget__Draw.h

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void DrawModdedText(cube::StartMenuWidget* widget)
4949
widget->SetTextPivot(cube::TextPivot::Center);
5050
widget->SetBorderColor(&border_color);
5151
widget->SetTextColor(&modded_color);
52-
widget->DrawBaseWidgetText(&pos, &txt_modded, 0.5* widget->GetXSize(), height);
52+
widget->DrawText(&pos, &txt_modded, 0.5* widget->GetXSize(), height);
5353
}
5454

5555
// Todo: Game version
@@ -75,7 +75,9 @@ extern "C" void cube__StartMenuWidget__Draw(cube::StartMenuWidget * widget)
7575
FloatRGBA disabled_color(1.0f, 1.0f, 1.0f, 0.2f);
7676
FloatRGBA border_color(0.0f, 0.0f, 0.0f, 1.0f);
7777

78-
std::wstring font = L"resource2.dat";
78+
79+
std::wstring font1 = L"resource1.dat";
80+
std::wstring font2 = L"resource2.dat";
7981

8082
std::wstring btn_txt[num_btns] = {
8183
L"Start Game",
@@ -91,13 +93,19 @@ extern "C" void cube__StartMenuWidget__Draw(cube::StartMenuWidget * widget)
9193
cube::StartMenuWidget::HoverState::Exit,
9294
};
9395

96+
std::wstring credits[] = {
97+
L"Copyright (c) 2019 Picroma e.K.",
98+
L"Youtube for mods: TheBagel3",
99+
L"Modloader by ChrisMiuchiz and Nichiren.",
100+
};
101+
102+
widget->SetScalableFont(&font2);
94103
DrawModdedText(widget);
95104

96105
mouse_pos = *widget->GetRelativeMousePosition(&mouse_pos);
97106
width = widget->GetXSize();
98107
options_active = widget->game->gui.options_widget->node->display->IsVisible();
99108

100-
widget->SetScalableFont(&font);
101109
widget->SetTextSize(text_size);
102110
widget->SetBorderSize(border_size);
103111
widget->SetTextPivot(cube::TextPivot::Center);
@@ -133,8 +141,74 @@ extern "C" void cube__StartMenuWidget__Draw(cube::StartMenuWidget * widget)
133141
}
134142
}
135143

136-
widget->DrawBaseWidgetText(&pos, &btn_txt[i], 0.5 * width, btn_y);
144+
widget->DrawText(&pos, &btn_txt[i], 0.5 * width, btn_y);
145+
}
146+
147+
widget->SetScalableFont(&font1);
148+
widget->SetTextPivot(cube::TextPivot::Left);
149+
widget->SetTextSize(12.0f);
150+
widget->SetBorderSize(3.0f);
151+
widget->SetTextColor(&text_color);
152+
153+
FloatVector2 position;
154+
position = *widget->GetSomeVector2(&position);
155+
156+
Matrix4 mat;
157+
widget->node->CW_100EE0(&mat);
158+
float f9 = 10.0f;
159+
float f1 = widget->game->height - 15;
160+
float f8 = mat._24;
161+
float f3 = f8;
162+
f3 *= f1;
163+
float f12 = mat._14;
164+
float f0 = f12;
165+
f0 *= f9;
166+
f3 += f0;
167+
f3 += mat._44;
168+
float f13 = mat._22;
169+
float f2 = f13;
170+
f2 *= f1;
171+
float f10 = mat._12;
172+
f0 = f10;
173+
f0 *= f9;
174+
f2 += f0;
175+
f2 += mat._42;
176+
float f11 = mat._21;
177+
float f7 = f11;
178+
f7 *= f1;
179+
float f14 = mat._11;
180+
f0 = f14;
181+
f0 *= f9;
182+
f7 += f0;
183+
f0 += mat._41;
184+
f9 = 1.0f;
185+
float f6 = f9;
186+
f6 /= f3;
187+
f7 *= f6;
188+
f6 *= f2;
189+
190+
int offset = 20;
191+
for (int i = 0; i < 3; i++)
192+
{
193+
widget->DrawText(&pos, &credits[i], f7 + (width - widget->game->width) / 2, f6 - i * offset);
194+
widget->SetScalableFont(&font2);
195+
widget->SetTextSize(20.0f);
196+
offset = 25;
197+
}
198+
199+
std::wstring versions[] = {
200+
L"Game: 1.0.0-1",
201+
L"Modloader: " + to_wstring(MOD_MAJOR_VERSION) + L"." + to_wstring(MOD_MINOR_VERSION),
202+
};
203+
widget->SetScalableFont(&font1);
204+
widget->SetTextSize(12.0f);
205+
widget->SetTextPivot(cube::TextPivot::Right);
206+
207+
for (int i = 0; i < 2; i++)
208+
{
209+
widget->DrawText(&pos, &versions[i], -f7 + (width + widget->game->width) / 2, f6 - i * 20);
137210
}
211+
138212
};
139213

140214
overwrite_function(0x291210, cube__StartMenuWidget__Draw);

0 commit comments

Comments
 (0)