Moved color definitions to their own .h file

This commit is contained in:
d0k3 2017-11-22 01:39:38 +01:00
parent 44c31ab50a
commit 534174e630
5 changed files with 68 additions and 56 deletions

View File

@ -0,0 +1,62 @@
#pragma once
#define RGB(r,g,b) ((r)<<24|(b)<<16|(g)<<8|(r))
// a base set of colors below
#define COLOR_BLACK RGB(0x00, 0x00, 0x00)
#define COLOR_WHITE RGB(0xFF, 0xFF, 0xFF)
#define COLOR_GREY RGB(0x80, 0x80, 0x80)
#define COLOR_RED RGB(0xFF, 0x00, 0x00)
#define COLOR_GREEN RGB(0x00, 0xFF, 0x00)
#define COLOR_BLUE RGB(0x00, 0x00, 0xFF)
#define COLOR_YELLOW RGB(0xFF, 0xFF, 0x00)
#define COLOR_CYAN RGB(0xFF, 0x00, 0xFF)
#define COLOR_ORANGE RGB(0xFF, 0xA5, 0x00)
#define COLOR_BRIGHTRED RGB(0xFF, 0x30, 0x30)
#define COLOR_DARKRED RGB(0x80, 0x00, 0x00)
#define COLOR_BRIGHTYELLOW RGB(0xFF, 0xFF, 0x30)
#define COLOR_BRIGHTGREEN RGB(0x30, 0xFF, 0x30)
#define COLOR_BRIGHTBLUE RGB(0x30, 0x30, 0xFF)
#define COLOR_TINTEDBLUE RGB(0x60, 0x60, 0x80)
#define COLOR_TINTEDYELLOW RGB(0xD0, 0xD0, 0x60)
#define COLOR_TINTEDGREEN RGB(0x70, 0x80, 0x70)
#define COLOR_LIGHTGREY RGB(0xB0, 0xB0, 0xB0)
#define COLOR_LIGHTERGREY RGB(0xD0, 0xD0, 0xD0)
#define COLOR_DARKGREY RGB(0x50, 0x50, 0x50)
#define COLOR_DARKESTGREY RGB(0x20, 0x20, 0x20)
#define COLOR_SUPERFUCHSIA RGB(0xFF, 0x00, 0xEF)
// standard colors - used everywhere
#define COLOR_STD_BG COLOR_BLACK
#define COLOR_STD_FONT COLOR_WHITE
// colors for GodMode9 file browser
#define COLOR_SIDE_BAR COLOR_DARKGREY
#define COLOR_MARKED COLOR_TINTEDYELLOW
#define COLOR_FILE COLOR_TINTEDGREEN
#define COLOR_DIR COLOR_TINTEDBLUE
#define COLOR_ROOT COLOR_GREY
// hex viewer colors
#define COLOR_HVOFFS RGB(0x40, 0x60, 0x50)
#define COLOR_HVOFFSI COLOR_DARKESTGREY
#define COLOR_HVASCII RGB(0x40, 0x80, 0x50)
#define COLOR_HVHEX(i) ((i % 2) ? RGB(0x30, 0x90, 0x30) : RGB(0x30, 0x80, 0x30))
// text viewer / script viewer colors
#define COLOR_TVOFFS RGB(0x40, 0x40, 0x40)
#define COLOR_TVOFFSL RGB(0x30, 0x30, 0x30)
#define COLOR_TVTEXT RGB(0xA0, 0xA0, 0xA0)
#define COLOR_TVRUN RGB(0xC0, 0x00, 0x00)
#define COLOR_TVCMT RGB(0x60, 0x60, 0x70)
#define COLOR_TVCMD RGB(0xA0, 0xA0, 0xA0)
// battery symbol colors
#define COLOR_BATTERY_CHARGING RGB(0x3D, 0xB7, 0xE4)
#define COLOR_BATTERY_FULL RGB(0x0F, 0xB0, 0x1B)
#define COLOR_BATTERY_MEDIUM RGB(0xFF, 0x88, 0x49)
#define COLOR_BATTERY_LOW RGB(0xB4, 0x00, 0x00)

View File

@ -33,5 +33,6 @@
#define SD_EJECT (1 << 17)
#define TIMEOUT_HID (1 << 31)
u32 InputWait(u32 timeout_sec);
bool CheckButton(u32 button);

View File

@ -6,6 +6,7 @@
#include <vram.h>
#include "common.h"
#include "colors.h"
#define BYTES_PER_PIXEL 3
@ -24,38 +25,6 @@
#define FONT_HEIGHT_EXT 8
#endif
#define RGB(r,g,b) ((r)<<24|(b)<<16|(g)<<8|(r))
#define COLOR_BLACK RGB(0x00, 0x00, 0x00)
#define COLOR_WHITE RGB(0xFF, 0xFF, 0xFF)
#define COLOR_GREY RGB(0x80, 0x80, 0x80)
#define COLOR_RED RGB(0xFF, 0x00, 0x00)
#define COLOR_GREEN RGB(0x00, 0xFF, 0x00)
#define COLOR_BLUE RGB(0x00, 0x00, 0xFF)
#define COLOR_YELLOW RGB(0xFF, 0xFF, 0x00)
#define COLOR_CYAN RGB(0xFF, 0x00, 0xFF)
#define COLOR_ORANGE RGB(0xFF, 0xA5, 0x00)
#define COLOR_BRIGHTRED RGB(0xFF, 0x30, 0x30)
#define COLOR_DARKRED RGB(0x80, 0x00, 0x00)
#define COLOR_BRIGHTYELLOW RGB(0xFF, 0xFF, 0x30)
#define COLOR_BRIGHTGREEN RGB(0x30, 0xFF, 0x30)
#define COLOR_BRIGHTBLUE RGB(0x30, 0x30, 0xFF)
#define COLOR_TINTEDBLUE RGB(0x60, 0x60, 0x80)
#define COLOR_TINTEDYELLOW RGB(0xD0, 0xD0, 0x60)
#define COLOR_TINTEDGREEN RGB(0x70, 0x80, 0x70)
#define COLOR_LIGHTGREY RGB(0xB0, 0xB0, 0xB0)
#define COLOR_LIGHTERGREY RGB(0xD0, 0xD0, 0xD0)
#define COLOR_DARKGREY RGB(0x50, 0x50, 0x50)
#define COLOR_DARKESTGREY RGB(0x20, 0x20, 0x20)
#define COLOR_TRANSPARENT RGB(0xFF, 0x00, 0xEF) // otherwise known as 'super fuchsia'
#define COLOR_STD_BG COLOR_BLACK
#define COLOR_STD_FONT COLOR_WHITE
#define TOP_SCREEN ((u8*)VRAM_TOP_LA)
#define BOT_SCREEN ((u8*)VRAM_BOT_A)
@ -71,6 +40,9 @@
#define SCREEN_WIDTH_ALT SCREEN_WIDTH_TOP
#endif
#define COLOR_TRANSPARENT COLOR_SUPERFUCHSIA
void ClearScreen(unsigned char *screen, int color);
void ClearScreenF(bool clear_main, bool clear_alt, int color);
void DrawRectangle(u8* screen, int x, int y, int width, int height, int color);

View File

@ -21,23 +21,8 @@
#define COLOR_TOP_BAR (PERM_RED ? COLOR_RED : PERM_ORANGE ? COLOR_ORANGE : PERM_BLUE ? COLOR_BRIGHTBLUE : \
PERM_YELLOW ? COLOR_BRIGHTYELLOW : PERM_GREEN ? COLOR_GREEN : COLOR_WHITE)
#define COLOR_SIDE_BAR COLOR_DARKGREY
#define COLOR_MARKED COLOR_TINTEDYELLOW
#define COLOR_FILE COLOR_TINTEDGREEN
#define COLOR_DIR COLOR_TINTEDBLUE
#define COLOR_ROOT COLOR_GREY
#define COLOR_ENTRY(e) (((e)->marked) ? COLOR_MARKED : ((e)->type == T_DIR) ? COLOR_DIR : ((e)->type == T_FILE) ? COLOR_FILE : ((e)->type == T_ROOT) ? COLOR_ROOT : COLOR_GREY)
#define COLOR_HVOFFS RGB(0x40, 0x60, 0x50)
#define COLOR_HVOFFSI COLOR_DARKESTGREY
#define COLOR_HVASCII RGB(0x40, 0x80, 0x50)
#define COLOR_HVHEX(i) ((i % 2) ? RGB(0x30, 0x90, 0x30) : RGB(0x30, 0x80, 0x30))
#define COLOR_BATTERY_CHARGING RGB(0x3D, 0xB7, 0xE4)
#define COLOR_BATTERY_FULL RGB(0x0F, 0xB0, 0x1B)
#define COLOR_BATTERY_MEDIUM RGB(0xFF, 0x88, 0x49)
#define COLOR_BATTERY_LOW RGB(0xB4, 0x00, 0x00)
#define BOOTPAUSE_KEY (BUTTON_R1|BUTTON_UP)
#define BOOTMENU_KEY (BUTTON_R1|BUTTON_LEFT)
#define BOOTFIRM_PATHS "0:/bootonce.firm", "0:/boot.firm", "1:/boot.firm"

View File

@ -29,14 +29,6 @@
#define TV_NLIN_DISP (SCREEN_HEIGHT / (FONT_HEIGHT_EXT + (2*TV_VPAD)))
#define TV_LLEN_DISP (((SCREEN_WIDTH_TOP - (2*TV_HPAD)) / FONT_WIDTH_EXT) - (TV_LNOS + 1))
// text viewer colors
#define COLOR_TVOFFS RGB(0x40, 0x40, 0x40)
#define COLOR_TVOFFSL RGB(0x30, 0x30, 0x30)
#define COLOR_TVTEXT RGB(0xA0, 0xA0, 0xA0)
#define COLOR_TVRUN RGB(0xC0, 0x00, 0x00)
#define COLOR_TVCMT RGB(0x60, 0x60, 0x70)
#define COLOR_TVCMD RGB(0xA0, 0xA0, 0xA0)
// some useful macros
#define IS_WHITESPACE(c) ((c == ' ') || (c == '\t') || (c == '\r') || (c == '\n'))