Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions workspace/all/gametime/gametime.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ static SDL_Surface **romImages;

static PlayActivities *play_activities;

static inline SDL_Color colorFromUint(uint32_t colour)
{
SDL_Color tempcol;
tempcol.a = 255;
tempcol.r = (colour >> 16) & 0xFF;
tempcol.g = (colour >> 8) & 0xFF;
tempcol.b = colour & 0xFF;
return tempcol;
}

///////

int _renderText(const char *text, TTF_Font *font, SDL_Color color, SDL_Rect *rect, bool right_align)
Expand Down Expand Up @@ -260,7 +250,7 @@ void renderList(int count, int start, int end, int selected)
cleanName(rom_name, rom->name);
SDL_Color textColor = COLOR_WHITE;
if(isSelected) {
//textColor = colorFromUint(THEME_COLOR1);
//textColor = uintToColour(THEME_COLOR1);
textColor = COLOR_BLACK;
}
renderText(rom_name, font.medium, textColor, &(SDL_Rect){
Expand All @@ -281,8 +271,8 @@ void renderList(int count, int start, int end, int selected)
textHeight
};
for (int i = 0; i < 6; i++) {
SDL_Color detailCol = i % 2 == 0 ? COLOR_DARK_TEXT : colorFromUint(THEME_COLOR2_255);
//SDL_Color detailCol = colorFromUint(i % 2 == 0 ? THEME_COLOR3_255 : THEME_COLOR2_255);
SDL_Color detailCol = i % 2 == 0 ? COLOR_DARK_TEXT : uintToColour(THEME_COLOR2_255);
//SDL_Color detailCol = uintToColour(i % 2 == 0 ? THEME_COLOR3_255 : THEME_COLOR2_255);
//SDL_Color detailCol = i % 2 == 0 ? COLOR_DARK_TEXT : COLOR_LIGHT_TEXT;
detailsRect.x += renderText(details[i], font.small, detailCol, &detailsRect);
}
Expand Down
3 changes: 2 additions & 1 deletion workspace/all/ledcontrol/ledcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,11 @@ int main(int argc, char *argv[])
&(SDL_Rect){SCALE1(PADDING + BUTTON_PADDING), y + SCALE1(4)});
SDL_FreeSurface(text);

// color1 is stored as 0xRRGGBB; GFX_blitAssetColor expects 0xRRGGBBAA
GFX_blitAssetColor(ASSET_BUTTON, NULL, screen, &(SDL_Rect){
SCALE1(PADDING) + text_width,
y + SCALE1(BUTTON_MARGIN)
}, settings_values[j]);
}, ((uint32_t)settings_values[j] << 8) | 0xFF);
} else {
snprintf(setting_text, sizeof(setting_text), "%s: %d", settings_labels[j], settings_values[j]);
SDL_Surface *text = TTF_RenderUTF8_Blended(font.medium, setting_text, current_color);
Expand Down
5 changes: 3 additions & 2 deletions workspace/all/settings/colorpickermenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,14 @@ void ColorPickerMenu::drawPreset(SDL_Surface *surface, const SDL_Rect &row,
SDL_Rect sq_rect = {row.x + SCALE1(OPTION_PADDING), row.y + (row.h - sq) / 2, sq, sq};
SDL_FillRect(surface, &sq_rect, SDL_MapRGB(surface->format, 255, 255, 255));
SDL_Rect sq_inner = {sq_rect.x + 1, sq_rect.y + 1, sq_rect.w - 2, sq_rect.h - 2};
SDL_Color preset_color = uintToColour(preset.color);
SDL_FillRect(surface, &sq_inner, SDL_MapRGB(surface->format,
(preset.color >> 16) & 0xFF, (preset.color >> 8) & 0xFF, preset.color & 0xFF));
preset_color.r, preset_color.g, preset_color.b));

SDL_Color text_color = is_selected ? uintToColour(THEME_COLOR5_255) : uintToColour(THEME_COLOR4_255);

// Hex value "#RRGGBBAA"
char hex_str[9];
char hex_str[10];
snprintf(hex_str, sizeof(hex_str), "#%08X", preset.color);
SDL_Surface *hex_surf = TTF_RenderUTF8_Blended(font.tiny, hex_str, text_color);
int hex_x = sq_rect.x + sq + SCALE1(OPTION_PADDING / 2 + 2);
Expand Down
2 changes: 1 addition & 1 deletion workspace/all/settings/colorpickermenu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "menu.hpp"

struct ColorPreset {
uint32_t color; // 0xRRGGBB
uint32_t color; // 0xRRGGBBAA
std::string label;
};

Expand Down
Loading