diff options
author | Ian C <ianc@noddybox.co.uk> | 2007-03-12 00:59:51 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2007-03-12 00:59:51 +0000 |
commit | 7e2703a49de38100f9ee82042a744517fc7eb171 (patch) | |
tree | e76beb7f038e9ef51a30b5d10f5e4be7ffd73c46 /source/keyboard.c | |
parent | eeef0966f0448d71e79ad43d53769afebd47b459 (diff) |
Altered some interfaces for the monitor.
Diffstat (limited to 'source/keyboard.c')
-rw-r--r-- | source/keyboard.c | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/source/keyboard.c b/source/keyboard.c index 8853dd1..d2e7aa7 100644 --- a/source/keyboard.c +++ b/source/keyboard.c @@ -30,6 +30,12 @@ /* ---------------------------------------- STATIC DATA */ +#define PAL_OFFSET 110 + +static int is_dim = FALSE; +static int selection_on = COL_WHITE; +static int selection_off = COL_BLACK; + static struct { int state; @@ -237,7 +243,7 @@ static int GetEvent(SoftKeyEvent *ev, int map) y = 37 + (f / 10) * 30; FB_Box(x, y, 25, 18, key_state[f].new_state ? - COL_WHITE : COL_BLACK); + selection_on : selection_off); } } } @@ -267,7 +273,7 @@ static int GetEvent(SoftKeyEvent *ev, int map) /* ---------------------------------------- PUBLIC INTERFACES */ -void SK_DisplayKeyboard(uint16 *vram) +void SK_DisplayKeyboard(void) { static sImage img; static int loaded; @@ -278,7 +284,53 @@ void SK_DisplayKeyboard(uint16 *vram) loaded = true; } - FB_Blit(&img,0,0,110); + FB_Blit(&img,0,0,PAL_OFFSET); +} + + +void SK_SetDisplayBrightness(int dim) +{ + static uint16 saved_pal[16]; + int f; + uint16 *pal; + + pal = FB_PALETTE(); + + if (dim != is_dim) + { + is_dim = dim; + + if (is_dim) + { + selection_on = COL_DARKGREY; + + for(f=0;f<16;f++) + { + int r,g,b; + + saved_pal[f] = pal[PAL_OFFSET + f]; + + r = saved_pal[f] & 0x1f; + g = (saved_pal[f]>>5) & 0x1f; + b = (saved_pal[f]>>10) & 0x1f; + + r/=3; + g/=3; + b/=3; + + pal[PAL_OFFSET + f] = RGB15(r,g,b); + } + } + else + { + selection_on = COL_WHITE; + + for(f=0;f<16;f++) + { + pal[PAL_OFFSET + f] = saved_pal[f]; + } + } + } } |