1
0

CLSでカーソル位置を初期化するようにした

This commit is contained in:
otya128
2015-08-19 12:15:00 +09:00
parent a9194c0c0d
commit 190e655b90
2 changed files with 69 additions and 48 deletions

View File

@@ -112,10 +112,15 @@ class BuiltinFunction
static void XSCREEN(PetitComputer p, int mode, DefaultValue!(int, false) a, DefaultValue!(int, false) b) static void XSCREEN(PetitComputer p, int mode, DefaultValue!(int, false) a, DefaultValue!(int, false) b)
{ {
} }
static void DISPLAY(PetitComputer p, DefaultValue!(int) display) static void DISPLAY(PetitComputer p, DefaultValue!(int, false) display)
{
}
static void GCLS(PetitComputer p, DefaultValue!(int, false) display)
{
}
static void BEEP(PetitComputer p, DefaultValue!(int, false) display)
{ {
} }
//alias void function(PetitComputer, Value[], Value[]) BuiltinFunc; //alias void function(PetitComputer, Value[], Value[]) BuiltinFunc;
static BuiltinFunction[wstring] builtinFunctions; static BuiltinFunction[wstring] builtinFunctions;
static this() static this()

View File

@@ -395,6 +395,8 @@ class PetitComputer
{ {
console[i][] = ConsoleCharacter(0, consoleForeColor, consoleBackColor); console[i][] = ConsoleCharacter(0, consoleForeColor, consoleBackColor);
} }
CSRX = 0;
CSRY = 0;
} }
SDL_Renderer* renderer; SDL_Renderer* renderer;
int vsyncFrame; int vsyncFrame;
@@ -528,10 +530,17 @@ class PetitComputer
GRPFColorFore[i][j].createTexture(renderer); GRPFColorFore[i][j].createTexture(renderer);
} }
}+/ }+/
consolem = new Mutex();
keybuffermutex = new Mutex();
core.thread.Thread thread = new core.thread.Thread(&render);
thread.start();
auto startTicks = SDL_GetTicks();
//とりあえず //とりあえず
auto parser = new Parser(//readText("./SYS/EX1TEXT.TXT").to!wstring auto parser = new Parser(readText(input("LOAD PROGRAM:", true).to!string).to!wstring
//readText("./SYS/EX1TEXT.TXT").to!wstring
//readText("FIZZBUZZ.TXT").to!wstring //readText("FIZZBUZZ.TXT").to!wstring
readText("TEST.TXT").to!wstring //readText("TEST.TXT").to!wstring
/*"?ABS(-1) /*"?ABS(-1)
LOCATE 0,10 LOCATE 0,10
COLOR 5 COLOR 5
@@ -574,11 +583,6 @@ GOTO @LOOP`*/
auto vm = parser.compile(); auto vm = parser.compile();
bool running = true; bool running = true;
vm.init(this); vm.init(this);
consolem = new Mutex();
keybuffermutex = new Mutex();
core.thread.Thread thread = new core.thread.Thread(&render);
thread.start();
auto startTicks = SDL_GetTicks();
while (true) while (true)
{ {
uint elapse; uint elapse;
@@ -632,6 +636,8 @@ GOTO @LOOP`*/
clearKeyBuffer(); clearKeyBuffer();
wstring buffer; wstring buffer;
showCursor = true; showCursor = true;
int oldCSRX = this.CSRX;
int oldCSRY = this.CSRY;
while(true) while(true)
{ {
auto oldpos = keybufferpos; auto oldpos = keybufferpos;
@@ -651,6 +657,16 @@ GOTO @LOOP`*/
animationCursor = true; animationCursor = true;
foreach(key; keybuffer[oldpos..kbp]) foreach(key; keybuffer[oldpos..kbp])
{ {
if(key == 8)
{
k = key;
if(!buffer.length) continue;
buffer = buffer[0..$ - 1];
CSRX--;
printConsoleString(" ");
CSRX--;
continue;
}
printConsole(key); printConsole(key);
if(key == '\r') if(key == '\r')
{ {