mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 02:25:32 -04:00
Launcher: Alternate servers row background colour when using classic theme
This commit is contained in:
parent
1e54c2ebdc
commit
ace429ae55
@ -651,42 +651,46 @@ static void LTable_DrawHeaderBackground(struct LTable* w) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Works out the background colour of the given row */
|
/* Works out the background colour of the given row */
|
||||||
static BitmapCol LTable_RowCol(struct LTable* w, struct ServerInfo* row) {
|
static BitmapCol LTable_RowColor(struct LTable* w, int row) {
|
||||||
BitmapCol gridCol = BitmapCol_Make( 20, 20, 10, 255);
|
|
||||||
BitmapCol featSelCol = BitmapCol_Make( 50, 53, 0, 255);
|
BitmapCol featSelCol = BitmapCol_Make( 50, 53, 0, 255);
|
||||||
BitmapCol featuredCol = BitmapCol_Make(101, 107, 0, 255);
|
BitmapCol featuredCol = BitmapCol_Make(101, 107, 0, 255);
|
||||||
BitmapCol selectedCol = BitmapCol_Make( 40, 40, 40, 255);
|
BitmapCol selectedCol = BitmapCol_Make( 40, 40, 40, 255);
|
||||||
|
struct ServerInfo* entry;
|
||||||
cc_bool selected;
|
cc_bool selected;
|
||||||
|
entry = row < w->rowsCount ? LTable_Get(row) : NULL;
|
||||||
|
|
||||||
if (row) {
|
if (entry) {
|
||||||
selected = String_Equals(&row->hash, w->selectedHash);
|
selected = String_Equals(&entry->hash, w->selectedHash);
|
||||||
if (row->featured) {
|
if (entry->featured) {
|
||||||
return selected ? featSelCol : featuredCol;
|
return selected ? featSelCol : featuredCol;
|
||||||
} else if (selected) {
|
} else if (selected) {
|
||||||
return selectedCol;
|
return selectedCol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Launcher_Theme.ClassicBackground ? 0 : gridCol;
|
|
||||||
|
if (!Launcher_Theme.ClassicBackground) {
|
||||||
|
return BitmapCol_Make(20, 20, 10, 255);
|
||||||
|
} else {
|
||||||
|
return (row & 1) == 0 ? Launcher_Theme.BackgroundColor : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draws background behind each row in the table */
|
/* Draws background behind each row in the table */
|
||||||
static void LTable_DrawRowsBackground(struct LTable* w) {
|
static void LTable_DrawRowsBackground(struct LTable* w) {
|
||||||
struct ServerInfo* entry;
|
|
||||||
BitmapCol col;
|
|
||||||
int y, height, row;
|
int y, height, row;
|
||||||
|
BitmapCol color;
|
||||||
|
|
||||||
y = w->rowsBegY;
|
y = w->rowsBegY;
|
||||||
for (row = w->topRow; ; row++, y += w->rowHeight) {
|
for (row = w->topRow; ; row++, y += w->rowHeight) {
|
||||||
entry = row < w->rowsCount ? LTable_Get(row) : NULL;
|
color = LTable_RowColor(w, row);
|
||||||
col = LTable_RowCol(w, entry);
|
|
||||||
|
|
||||||
/* last row may get chopped off */
|
/* last row may get chopped off */
|
||||||
height = min(y + w->rowHeight, w->rowsEndY) - y;
|
height = min(y + w->rowHeight, w->rowsEndY) - y;
|
||||||
/* hit the end of the table */
|
/* hit the end of the table */
|
||||||
if (height < 0) break;
|
if (height < 0) break;
|
||||||
|
|
||||||
if (col) {
|
if (color) {
|
||||||
Drawer2D_Clear(&Launcher_Framebuffer, col,
|
Drawer2D_Clear(&Launcher_Framebuffer, color,
|
||||||
w->x, y, w->width, height);
|
w->x, y, w->width, height);
|
||||||
} else {
|
} else {
|
||||||
Launcher_ResetArea(w->x, y, w->width, height);
|
Launcher_ResetArea(w->x, y, w->width, height);
|
||||||
|
@ -365,7 +365,7 @@ const struct LauncherTheme Launcher_ModernTheme = {
|
|||||||
};
|
};
|
||||||
const struct LauncherTheme Launcher_ClassicTheme = {
|
const struct LauncherTheme Launcher_ClassicTheme = {
|
||||||
true,
|
true,
|
||||||
BitmapCol_Make( 50, 50, 50, 255), /* background */
|
BitmapCol_Make( 41, 41, 41, 255), /* background */
|
||||||
BitmapCol_Make( 0, 0, 0, 255), /* button border */
|
BitmapCol_Make( 0, 0, 0, 255), /* button border */
|
||||||
BitmapCol_Make(126, 136, 191, 255), /* active button */
|
BitmapCol_Make(126, 136, 191, 255), /* active button */
|
||||||
BitmapCol_Make(111, 111, 111, 255), /* button foreground */
|
BitmapCol_Make(111, 111, 111, 255), /* button foreground */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user