1
0

Synchronize console operations

This commit is contained in:
otya128
2016-12-07 19:10:55 +09:00
parent 568e0f307c
commit 1387d54d16

View File

@@ -100,12 +100,15 @@ class Console
GraphicPage GRPF;
PetitComputer petitcom;
bool[2] visibles = [true, true];
Object consoleSync = new Object();
int width()
{
return fontWidth;
}
void width(int w)
{
synchronized(this)
{
fontWidth = fontHeight = w;
consoleWidth = petitcom.screenWidth / fontWidth;
@@ -138,6 +141,7 @@ class Console
CSRZs[] = 0;
display(petitcom.displaynum);
}
}
bool visible()
{
return visibles[petitcom.displaynum];
@@ -213,6 +217,8 @@ class Console
CSRZ = 0;
}
void display(int number)
{
synchronized(this)
{
if(petitcom.xscreenmode == 2)
{
@@ -232,6 +238,7 @@ class Console
consoleWidthC = consoleWidth;
consoleC = console;
}
}
void drawCharacter(int x, int y, ConsoleCharacter ch)
{
import std.algorithm.mutation : swap;
@@ -310,6 +317,8 @@ class Console
{
glLoadIdentity();
}
synchronized(this)
{
if(petitcom.xscreenmode == 2 && (visibles[0] || showCursor)/*XSCREEN4*/)
{
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
@@ -430,6 +439,7 @@ class Console
glEnd();
}
}
}
void print(T...)(T args)
{
foreach(i; args)