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