Fix COLOR
This commit is contained in:
@@ -245,10 +245,10 @@ class BuiltinFunction
|
|||||||
}
|
}
|
||||||
static void COLOR(PetitComputer p, DefaultValue!int fore, DefaultValue!(int, false) back)
|
static void COLOR(PetitComputer p, DefaultValue!int fore, DefaultValue!(int, false) back)
|
||||||
{
|
{
|
||||||
fore.setDefaultValue(p.console.consoleForeColor);
|
fore.setDefaultValue(p.console.foreColor);
|
||||||
back.setDefaultValue(p.console.consoleBackColor);
|
back.setDefaultValue(p.console.backColor);
|
||||||
p.console.consoleForeColor = cast(int)fore;
|
p.console.foreColor = cast(int)fore;
|
||||||
p.console.consoleBackColor = cast(int)back;
|
p.console.backColor = cast(int)back;
|
||||||
}
|
}
|
||||||
static void ATTR(PetitComputer p, int attr)
|
static void ATTR(PetitComputer p, int attr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -91,7 +91,24 @@ class Console
|
|||||||
{
|
{
|
||||||
CSRZs[petitcom.displaynum] = value;
|
CSRZs[petitcom.displaynum] = value;
|
||||||
}
|
}
|
||||||
int consoleForeColor, consoleBackColor;
|
int[2] foreColors, backColors;
|
||||||
|
@property ref foreColor()
|
||||||
|
{
|
||||||
|
return foreColors[petitcom.displaynum];
|
||||||
|
}
|
||||||
|
@property void foreColor(int value)
|
||||||
|
{
|
||||||
|
foreColors[petitcom.displaynum] = value;
|
||||||
|
}
|
||||||
|
@property ref backColor()
|
||||||
|
{
|
||||||
|
return backColors[petitcom.displaynum];
|
||||||
|
}
|
||||||
|
@property void backColor(int value)
|
||||||
|
{
|
||||||
|
backColors[petitcom.displaynum] = value;
|
||||||
|
}
|
||||||
|
|
||||||
bool showCursor;
|
bool showCursor;
|
||||||
bool animationCursor;
|
bool animationCursor;
|
||||||
SDL_Rect[] fontTable = new SDL_Rect[65536];
|
SDL_Rect[] fontTable = new SDL_Rect[65536];
|
||||||
@@ -112,14 +129,15 @@ class Console
|
|||||||
consoleWidth = petitcom.screenWidth / fontWidth;
|
consoleWidth = petitcom.screenWidth / fontWidth;
|
||||||
consoleHeight = petitcom.screenHeight / fontHeight;
|
consoleHeight = petitcom.screenHeight / fontHeight;
|
||||||
console = new ConsoleCharacter[][][petitcom.currentDisplay.rect.length];
|
console = new ConsoleCharacter[][][petitcom.currentDisplay.rect.length];
|
||||||
consoleForeColor = 15;//#T_WHITE
|
foreColor = 15;//#T_WHITE
|
||||||
|
backColor = 0;
|
||||||
for(int i = 0; i < console.length; i++)
|
for(int i = 0; i < console.length; i++)
|
||||||
{
|
{
|
||||||
console[i] = new ConsoleCharacter[][petitcom.currentDisplay.rect[i].h / fontHeight];
|
console[i] = new ConsoleCharacter[][petitcom.currentDisplay.rect[i].h / fontHeight];
|
||||||
for(int j = 0; j < console[i].length; j++)
|
for(int j = 0; j < console[i].length; j++)
|
||||||
{
|
{
|
||||||
console[i][j] = new ConsoleCharacter[petitcom.currentDisplay.rect[i].w / fontWidth];
|
console[i][j] = new ConsoleCharacter[petitcom.currentDisplay.rect[i].w / fontWidth];
|
||||||
console[i][j][] = ConsoleCharacter(0, consoleForeColor, consoleBackColor);
|
console[i][j][] = ConsoleCharacter(0, foreColor, backColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CSRXs[] = 0;
|
CSRXs[] = 0;
|
||||||
@@ -201,7 +219,7 @@ class Console
|
|||||||
{
|
{
|
||||||
for(int i = 0; i < consoleC.length; i++)
|
for(int i = 0; i < consoleC.length; i++)
|
||||||
{
|
{
|
||||||
consoleC[i][] = ConsoleCharacter(0, consoleForeColor, consoleBackColor);
|
consoleC[i][] = ConsoleCharacter(0, foreColor, backColor);
|
||||||
}
|
}
|
||||||
CSRX = 0;
|
CSRX = 0;
|
||||||
CSRY = 0;
|
CSRY = 0;
|
||||||
@@ -383,7 +401,7 @@ class Console
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto t = min(CSRX + TABSTEP - CSRX % TABSTEP, consoleWidthC - 1);
|
auto t = min(CSRX + TABSTEP - CSRX % TABSTEP, consoleWidthC - 1);
|
||||||
consoleC[CSRY][CSRX..t] = ConsoleCharacter(0, consoleForeColor, consoleBackColor, attr, CSRZ);
|
consoleC[CSRY][CSRX..t] = ConsoleCharacter(0, foreColor, backColor, attr, CSRZ);
|
||||||
CSRX += TABSTEP - (CSRX % TABSTEP) - 1;
|
CSRX += TABSTEP - (CSRX % TABSTEP) - 1;
|
||||||
if(CSRX + 1 >= consoleWidthC)
|
if(CSRX + 1 >= consoleWidthC)
|
||||||
{
|
{
|
||||||
@@ -394,7 +412,7 @@ class Console
|
|||||||
}
|
}
|
||||||
else if(c != '\n')
|
else if(c != '\n')
|
||||||
{
|
{
|
||||||
consoleC[CSRY][CSRX] = ConsoleCharacter(c, consoleForeColor, consoleBackColor, attr, CSRZ);
|
consoleC[CSRY][CSRX] = ConsoleCharacter(c, foreColor, backColor, attr, CSRZ);
|
||||||
tab = tab ? 2 : 0;
|
tab = tab ? 2 : 0;
|
||||||
}
|
}
|
||||||
CSRX++;
|
CSRX++;
|
||||||
@@ -418,6 +436,6 @@ class Console
|
|||||||
consoleC[i] = consoleC[i + 1];
|
consoleC[i] = consoleC[i + 1];
|
||||||
}
|
}
|
||||||
consoleC[consoleHeightC - 1] = tmp;
|
consoleC[consoleHeightC - 1] = tmp;
|
||||||
tmp[] = ConsoleCharacter(0, consoleForeColor, consoleBackColor, attr, CSRZ);
|
tmp[] = ConsoleCharacter(0, foreColor, backColor, attr, CSRZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user