From: uz Date: Tue, 3 Apr 2012 17:34:54 +0000 (+0000) Subject: Added support for several colors. X-Git-Tag: V2.14~426 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b5d4321a4bee3303a5c2fad9f214fbe470b77a95;p=cc65 Added support for several colors. git-svn-id: svn://svn.cc65.org/cc65/trunk@5641 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/sim65/chips/console.c b/src/sim65/chips/console.c index fbc750101..c257fa787 100644 --- a/src/sim65/chips/console.c +++ b/src/sim65/chips/console.c @@ -115,8 +115,14 @@ static const struct ChipData CData[] = { }; /* Defines for console screen */ -static const XColor FgColor = { - 0, 32*256, 141*256, 32*256, 0, 0 /* green */ +static const XColor GreenColor = { + 0, 32*256, 141*256, 32*256, 0, 0 /* green */ +}; +static const XColor AmberColor = { + 0, 255*256, 204*256, 51*256, 0, 0 /* amber */ +}; +static const XColor WhiteColor = { + 0, 224*256, 224*256, 224*256, 0, 0 /* white */ }; static const XColor BgColor = { 0, 0*256, 0*256, 0*256, 0, 0 /* black */ @@ -147,7 +153,7 @@ struct ScreenInstance { unsigned Rows; unsigned Cols; - /* Window dimensions, 384*288 (PAL) */ + /* Window dimensions, determined by char resolution and char set */ unsigned XTotal; unsigned YTotal; @@ -263,6 +269,8 @@ static void* ScreenCreateInstance (unsigned Addr, unsigned Range, void* CfgInfo) XSizeHints SizeHints; XWMHints WMHints; Cursor C; + unsigned CharColor; + /* Allocate the instance data */ ScreenInstance* V = VScreen = Sim->Malloc (sizeof (ScreenInstance)); @@ -354,8 +362,15 @@ static void* ScreenCreateInstance (unsigned Addr, unsigned Range, void* CfgInfo) Sim->Error ("Screen: Need color display"); } + /* Determine the character color */ + CharColor = (unsigned) CfgGetNum (CfgInfo, "charcolor", 0, 2, 0); + /* Get all needed colors */ - V->FgColor = FgColor; + switch (CharColor) { + case 1: V->FgColor = AmberColor; break; + case 2: V->FgColor = WhiteColor; break; + default: V->FgColor = GreenColor; break; + } V->BgColor = BgColor; CM = DefaultColormap (V->ScreenDisplay, V->Screen); if (XAllocColor (V->ScreenDisplay, CM, &V->FgColor) == 0) { @@ -634,7 +649,7 @@ static void ScreenEventLoop (void) break; } - } + } /* Flush the outgoing event queue */ XFlush (VScreen->ScreenDisplay);