summaryrefslogtreecommitdiff
path: root/source/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/keyboard.c')
-rw-r--r--source/keyboard.c58
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];
+ }
+ }
+ }
}