per menu titles, remove yellow from classicube title

This commit is contained in:
UnknownShadow200 2021-08-06 22:10:51 +10:00
parent 60c123b37f
commit 63316d405a
4 changed files with 49 additions and 28 deletions

View file

@ -225,17 +225,18 @@ static PackedCol checkbox_palette[] = {
};
static void DrawIndexed(int size, int x, int y, struct Bitmap* bmp) {
BitmapCol* row;
BitmapCol* row, col;
int i, xx, yy;
for (i = 0, yy = 0; yy < size; yy++) {
if ((y + yy) < 0) { i += size; continue; }
if ((y + yy) >= bmp->height) break;
int* row = Bitmap_GetRow(bmp, y + yy);
row = Bitmap_GetRow(bmp, y + yy);
for (xx = 0; xx < size; xx++) {
int col = checkbox_palette[checkbox_indices[i++]];
col = checkbox_palette[checkbox_indices[i++]];
if (col == 0) continue; /* transparent pixel */
if ((x + xx) < 0 || (x + xx) >= bmp->width) continue;
row[x + xx] = col;
}

View file

@ -215,9 +215,9 @@ static struct ChooseModeScreen {
LScreen_Layout
struct LLine seps[2];
struct LButton btnEnhanced, btnClassicHax, btnClassic, btnBack;
struct LLabel lblTitle, lblHelp, lblEnhanced[2], lblClassicHax[2], lblClassic[2];
struct LLabel lblHelp, lblEnhanced[2], lblClassicHax[2], lblClassic[2];
cc_bool firstTime;
struct LWidget* _widgets[14];
struct LWidget* _widgets[13];
} ChooseModeScreen_Instance;
CC_NOINLINE static void ChooseMode_Click(cc_bool classic, cc_bool classicHacks) {
@ -243,7 +243,6 @@ static void UseModeClassic(void* w, int idx) { ChooseMode_Click(true, false)
static void ChooseModeScreen_Init(struct LScreen* s_) {
struct ChooseModeScreen* s = (struct ChooseModeScreen*)s_;
s->widgets = s->_widgets;
LLabel_Init(s_, &s->lblTitle, "");
LLine_Init(s_, &s->seps[0], 490);
LLine_Init(s_, &s->seps[1], 490);
@ -266,9 +265,6 @@ static void ChooseModeScreen_Init(struct LScreen* s_) {
s->btnClassicHax.OnClick = UseModeClassicHax;
s->btnClassic.OnClick = UseModeClassic;
s->btnBack.OnClick = SwitchToSettings;
s->lblTitle.font = &Launcher_TitleFont;
LLabel_SetConst(&s->lblTitle, "Choose game mode");
}
static void ChooseModeScreen_Show(struct LScreen* s_) {
@ -279,21 +275,20 @@ static void ChooseModeScreen_Show(struct LScreen* s_) {
static void ChooseModeScreen_Layout(struct LScreen* s_) {
struct ChooseModeScreen* s = (struct ChooseModeScreen*)s_;
LWidget_SetLocation(&s->lblTitle, ANCHOR_CENTRE, ANCHOR_CENTRE, 10, -135);
LWidget_SetLocation(&s->seps[0], ANCHOR_CENTRE, ANCHOR_CENTRE, -5, -35);
LWidget_SetLocation(&s->seps[1], ANCHOR_CENTRE, ANCHOR_CENTRE, -5, 35);
LWidget_SetLocation(&s->seps[0], ANCHOR_CENTRE, ANCHOR_CENTRE, -5, -85);
LWidget_SetLocation(&s->seps[1], ANCHOR_CENTRE, ANCHOR_CENTRE, -5, -15);
LWidget_SetLocation(&s->btnEnhanced, ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -250, -72);
LWidget_SetLocation(&s->lblEnhanced[0], ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -85, -72 - 12);
LWidget_SetLocation(&s->lblEnhanced[1], ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -85, -72 + 12);
LWidget_SetLocation(&s->btnEnhanced, ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -250, -120);
LWidget_SetLocation(&s->lblEnhanced[0], ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -85, -120 - 12);
LWidget_SetLocation(&s->lblEnhanced[1], ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -85, -120 + 12);
LWidget_SetLocation(&s->btnClassicHax, ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -250, 0);
LWidget_SetLocation(&s->lblClassicHax[0], ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -85, 0 - 12);
LWidget_SetLocation(&s->lblClassicHax[1], ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -85, 0 + 12);
LWidget_SetLocation(&s->btnClassicHax, ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -250, -50);
LWidget_SetLocation(&s->lblClassicHax[0], ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -85, -50 - 12);
LWidget_SetLocation(&s->lblClassicHax[1], ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -85, -50 + 12);
LWidget_SetLocation(&s->btnClassic, ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -250, 72);
LWidget_SetLocation(&s->lblClassic[0], ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -85, 72 - 12);
LWidget_SetLocation(&s->lblClassic[1], ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -85, 72 + 12);
LWidget_SetLocation(&s->btnClassic, ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -250, 20);
LWidget_SetLocation(&s->lblClassic[0], ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -85, 20 - 12);
LWidget_SetLocation(&s->lblClassic[1], ANCHOR_CENTRE_MIN, ANCHOR_CENTRE, -85, 20 + 12);
LWidget_SetLocation(&s->lblHelp, ANCHOR_CENTRE, ANCHOR_CENTRE, 0, 160);
LWidget_SetLocation(&s->btnBack, ANCHOR_CENTRE, ANCHOR_CENTRE, 0, 170);
@ -306,6 +301,9 @@ void ChooseModeScreen_SetActive(cc_bool firstTime) {
s->Show = ChooseModeScreen_Show;
s->Layout = ChooseModeScreen_Layout;
s->firstTime = firstTime;
s->title_fore = "&fChoose mode";
s->title_back = "&0Choose mode";
s->onEnterWidget = (struct LWidget*)&s->btnEnhanced;
Launcher_SetScreen((struct LScreen*)s);
}
@ -494,6 +492,9 @@ void ColoursScreen_SetActive(void) {
s->Layout = ColoursScreen_Layout;
s->KeyDown = ColoursScreen_KeyDown;
s->MouseWheel = ColoursScreen_MouseWheel;
s->title_fore = "&fCustom theme";
s->title_back = "&0Custom theme";
Launcher_SetScreen((struct LScreen*)s);
}
@ -609,6 +610,9 @@ void DirectConnectScreen_SetActive(void) {
LScreen_Reset((struct LScreen*)s);
s->Init = DirectConnectScreen_Init;
s->Layout = DirectConnectScreen_Layout;
s->title_fore = "&fDirect connect";
s->title_back = "&0Direct connect";
s->onEnterWidget = (struct LWidget*)&s->btnConnect;
Launcher_SetScreen((struct LScreen*)s);
}
@ -670,6 +674,9 @@ void MFAScreen_SetActive(void) {
s->Init = MFAScreen_Init;
s->Show = MFAScreen_Show;
s->Layout = MFAScreen_Layout;
s->title_fore = "&fEnter login code";
s->title_back = "&0Enter login code";
s->onEnterWidget = (struct LWidget*)&s->btnSignIn;
Launcher_SetScreen((struct LScreen*)s);
}
@ -988,6 +995,9 @@ void MainScreen_SetActive(void) {
s->Free = MainScreen_Free;
s->Tick = MainScreen_Tick;
s->Layout = MainScreen_Layout;
s->title_fore = "&fClassiCube";
s->title_back = "&0ClassiCube";
s->HoverWidget = MainScreen_HoverWidget;
s->UnhoverWidget = MainScreen_UnhoverWidget;
s->onEnterWidget = (struct LWidget*)&s->btnLogin;
@ -1380,7 +1390,6 @@ static void ServersScreen_MouseUp(struct LScreen* s_, int idx) {
void ServersScreen_SetActive(void) {
struct ServersScreen* s = &ServersScreen_Instance;
LScreen_Reset((struct LScreen*)s);
s->hidesTitlebar = true;
s->tableAcc = 0.0f;
s->Init = ServersScreen_Init;
@ -1453,6 +1462,9 @@ void SettingsScreen_SetActive(void) {
s->Init = SettingsScreen_Init;
s->Show = SettingsScreen_Show;
s->Layout = SettingsScreen_Layout;
s->title_fore = "&fOptions";
s->title_back = "&0Options";
Launcher_SetScreen((struct LScreen*)s);
}
@ -1507,6 +1519,9 @@ void ThemesScreen_SetActive(void) {
LScreen_Reset((struct LScreen*)s);
s->Init = ThemesScreen_Init;
s->Layout = ThemesScreen_Layout;
s->title_fore = "&fSelect theme";
s->title_back = "&0Select theme";
Launcher_SetScreen((struct LScreen*)s);
}
@ -1756,6 +1771,9 @@ void UpdatesScreen_SetActive(void) {
s->Tick = UpdatesScreen_Tick;
s->Free = UpdatesScreen_Free;
s->Layout = UpdatesScreen_Layout;
s->title_fore = "&fUpdate game";
s->title_back = "&0Update game";
Launcher_SetScreen((struct LScreen*)s);
}
#endif

View file

@ -8,7 +8,7 @@ struct LWidget;
struct LScreen;
typedef void (*LScreen_Func)(struct LScreen* s);
typedef void (*LWidget_Func)(struct LScreen* s, struct LWidget* w);
typedef void(*LWidget_Func)(struct LScreen* s, struct LWidget* w);
#define LScreen_Layout \
LScreen_Func Init; /* Initialises widgets and other data. Only called once. */ \
@ -31,7 +31,9 @@ typedef void (*LWidget_Func)(struct LScreen* s, struct LWidget* w);
struct LWidget* selectedWidget; /* Widget mouse last clicked on. */ \
int numWidgets; /* Number of widgets actually used. */ \
struct LWidget** widgets; /* Array of pointers to all widgets in the screen. */ \
cc_bool hidesTitlebar; /* Whether titlebar in window is hidden. */
cc_bool hidesTitlebar; /* Whether titlebar in window is hidden. */ \
const char* title_fore; /* Foreground titlebar text */ \
const char* title_back; /* Background titlebar text */
struct LScreen { LScreen_Layout };

View file

@ -363,7 +363,6 @@ const struct LauncherTheme Launcher_ModernTheme = {
BitmapCol_Make(141, 114, 165, 255), /* button foreground */
BitmapCol_Make(162, 131, 186, 255), /* button highlight */
};
const struct LauncherTheme Launcher_ClassicTheme = {
true,
BitmapCol_Make( 50, 50, 50, 255), /* background */
@ -503,15 +502,16 @@ void Launcher_ResetArea(int x, int y, int width, int height) {
}
void Launcher_ResetPixels(void) {
static const cc_string title_fore = String_FromConst("&eClassi&fCube");
static const cc_string title_back = String_FromConst("&0Classi&0Cube");
cc_string title_fore, title_back;
struct DrawTextArgs args;
int x;
if (activeScreen && activeScreen->hidesTitlebar) {
if (activeScreen && !activeScreen->title_fore) {
Launcher_ResetArea(0, 0, WindowInfo.Width, WindowInfo.Height);
return;
}
title_fore = String_FromReadonly(activeScreen->title_fore);
title_back = String_FromReadonly(activeScreen->title_back);
LBackend_ResetPixels();
DrawTextArgs_Make(&args, &title_fore, &logoFont, false);