1
0

Add --redirect-console option

This commit is contained in:
otya128
2017-07-08 17:41:31 +09:00
parent 18719c0c17
commit 2076af47f6
4 changed files with 28 additions and 7 deletions

View File

@@ -280,6 +280,7 @@ class PetitComputer
}
int[2] bgpage;
Projects project;
bool redirectConsole;
void init()
{
random = new Random();
@@ -313,7 +314,7 @@ class PetitComputer
screenWidthDisplay1 = 320;
screenHeightDisplay1 = 240;
currentDisplay = Display([SDL_Rect(0, 0, screenWidth, screenHeight)]);
console = new Console(this);
console = redirectConsole ? new NativeConsole(std.stdio.stdout, this) : new Console(this);
if(!exists(fontTableFile))
{
writeln("create font table");
@@ -844,7 +845,7 @@ class PetitComputer
renderCondition.notify();
}
while(true)
while(!quit)
{
auto profile = SDL_GetTicks();
if(console.showCursor)
@@ -1127,7 +1128,7 @@ class PetitComputer
bool isRunningDirectMode = false;
GLenum textureScaleMode;
int maincnt;
void run(bool nodirectmode = false, string inputfile = "", bool antialiasing = false)
void run(bool nodirectmode = false, string inputfile = "", bool antialiasing = false, bool redirectConsole = false)
{
if (antialiasing)
{
@@ -1137,6 +1138,7 @@ class PetitComputer
{
textureScaleMode = GL_NEAREST;
}
this.redirectConsole = redirectConsole;
buttonLock = new Object();
program = new Program();
keybuffer = new Key[128];
@@ -1359,6 +1361,8 @@ class PetitComputer
}
if(!running || stopflg)
{
if (nodirectmode)
quit = true;
if(stopflg)
{
loc = vm.currentLocation;