1
0

Extract console class

This commit is contained in:
otya128
2016-12-02 23:43:13 +09:00
parent b7234a1c6e
commit 8d62088854
6 changed files with 483 additions and 443 deletions

View File

@@ -296,17 +296,17 @@ class PrintCode : Code
case ValueType.Integer: case ValueType.Integer:
//write(arg.integerValue); //write(arg.integerValue);
if(vm.petitcomputer) if(vm.petitcomputer)
vm.petitcomputer.printConsole(arg.integerValue); vm.petitcomputer.console.print(arg.integerValue);
break; break;
case ValueType.Double: case ValueType.Double:
//write(arg.doubleValue); //write(arg.doubleValue);
if(vm.petitcomputer) if(vm.petitcomputer)
vm.petitcomputer.printConsole(arg.doubleValue); vm.petitcomputer.console.print(arg.doubleValue);
break; break;
case ValueType.String: case ValueType.String:
//write(arg.stringValue); //write(arg.stringValue);
if(vm.petitcomputer) if(vm.petitcomputer)
vm.petitcomputer.printConsoleString(arg.stringValue); vm.petitcomputer.console.printString(arg.stringValue);
break; break;
default: default:
//type mismatch //type mismatch
@@ -1555,7 +1555,7 @@ class InputCode : Code
{ {
if(error) if(error)
{ {
vm.petitcomputer.printConsoleString("?Redo from start \n"); vm.petitcomputer.console.printString("?Redo from start \n");
} }
wstring input = vm.petitcomputer.input("", false); wstring input = vm.petitcomputer.input("", false);
wstring[] split = input.split(","); wstring[] split = input.split(",");

View File

@@ -217,19 +217,19 @@ class BuiltinFunction
//static ABS = function double(double x) => abs(this.result == ValueType.Double ? 1 : 0); //static ABS = function double(double x) => abs(this.result == ValueType.Double ? 1 : 0);
static void LOCATE(PetitComputer p, DefaultValue!int x, DefaultValue!int y, DefaultValue!(int, false) z) static void LOCATE(PetitComputer p, DefaultValue!int x, DefaultValue!int y, DefaultValue!(int, false) z)
{ {
x.setDefaultValue(p.CSRX); x.setDefaultValue(p.console.CSRX);
y.setDefaultValue(p.CSRY); y.setDefaultValue(p.console.CSRY);
z.setDefaultValue(p.CSRZ); z.setDefaultValue(p.console.CSRZ);
p.CSRX = cast(int)x; p.console.CSRX = cast(int)x;
p.CSRY = cast(int)y; p.console.CSRY = cast(int)y;
p.CSRZ = cast(int)z; p.console.CSRZ = cast(int)z;
} }
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.consoleForeColor); fore.setDefaultValue(p.console.consoleForeColor);
back.setDefaultValue(p.consoleBackColor); back.setDefaultValue(p.console.consoleBackColor);
p.consoleForeColor = cast(int)fore; p.console.consoleForeColor = cast(int)fore;
p.consoleBackColor = cast(int)back; p.console.consoleBackColor = cast(int)back;
} }
static void VSYNC(PetitComputer p, DefaultValue!int time) static void VSYNC(PetitComputer p, DefaultValue!int time)
{ {
@@ -244,13 +244,13 @@ class BuiltinFunction
//TODO:プチコンのCLSには引数の個数制限がない //TODO:プチコンのCLSには引数の個数制限がない
static void CLS(PetitComputer p/*vaarg*/) static void CLS(PetitComputer p/*vaarg*/)
{ {
p.cls; p.console.cls;
} }
static void ASSERT__(PetitComputer p, int cond, wstring message) static void ASSERT__(PetitComputer p, int cond, wstring message)
{ {
if(!cond) if(!cond)
{ {
p.printConsole("Assertion failed: ", message, "\n"); p.console.print("Assertion failed: ", message, "\n");
} }
assert(cond, message.to!string); assert(cond, message.to!string);
} }
@@ -1226,7 +1226,7 @@ class BuiltinFunction
} }
static int CHKCHR(PetitComputer p, int x, int y) static int CHKCHR(PetitComputer p, int x, int y)
{ {
return cast(int)(p.console[y][x].character); return cast(int)(p.console.console[y][x].character);
} }
static wstring FORMAT(PetitComputer p, Value[] va_args) static wstring FORMAT(PetitComputer p, Value[] va_args)
{ {
@@ -1521,10 +1521,10 @@ class BuiltinFunction
//project:.->hidden project //project:.->hidden project
//project:/->project list //project:/->project list
auto l = p.project.getFileList(project, res); auto l = p.project.getFileList(project, res);
p.printConsole(res, "\t", project, "\n"); p.console.print(res, "\t", project, "\n");
foreach(i; l) foreach(i; l)
{ {
p.printConsole(i, "\n"); p.console.print(i, "\n");
} }
} }
static void FILES(PetitComputer p, wstring name, Value[] array) static void FILES(PetitComputer p, wstring name, Value[] array)
@@ -1533,7 +1533,7 @@ class BuiltinFunction
} }
static void ACLS(PetitComputer p) static void ACLS(PetitComputer p)
{ {
p.cls; p.console.cls;
SPCLR(p, DefaultValue!(int, false)(true)); SPCLR(p, DefaultValue!(int, false)(true));
BGCLR(p, DefaultValue!(int, false)(true)); BGCLR(p, DefaultValue!(int, false)(true));
GCLS(p, DefaultValue!(int, false)(true)); GCLS(p, DefaultValue!(int, false)(true));

392
SMILEBASIC/console.d Normal file
View File

@@ -0,0 +1,392 @@
module otya.smilebasic.console;
import derelict.sdl2.sdl;
import derelict.sdl2.image;
import derelict.opengl3.gl;
import derelict.opengl3.gl3;
import otya.smilebasic.petitcomputer;
import std.string;
import std.stdio;
import std.file;
import std.conv;
import std.csv;
import std.net.curl;
struct ConsoleCharacter
{
wchar character;
int foreColor;
int backColor;
byte attr;
int z;
}
class Console
{
int fontWidth;
int fontHeight;
int consoleWidth;
int consoleHeight;
int consoleWidthDisplay1;
int consoleHeightDisplay1;
int consoleWidth4;
int consoleHeight4;
int consoleHeightC, consoleWidthC;
ConsoleCharacter[][] consoleC;
int[] consoleColor =
[
0x00000000,
0xFF000000,
0xFF7F0000,
0xFFFF0000,
0xFF007F00,
0xFF00FF00,
0xFF7F7F00,
0xFFFFFF00,
0xFF00007F,
0xFF0000FF,
0xFF7F007F,
0xFFFF00FF,
0xFF007F7F,
0xFF00FFFF,
0xFF7F7F7F,
0xFFFFFFFF,
];
int[] consoleColorGL = new int[16];
ConsoleCharacter[][] console;
ConsoleCharacter[][] consoleDisplay1;
ConsoleCharacter[][] console4;
int CSRX;
int CSRY;
int CSRZ;
int consoleForeColor, consoleBackColor;
bool showCursor;
bool animationCursor;
SDL_Rect[] fontTable = new SDL_Rect[65536];
GraphicPage GRPF;
PetitComputer petitcom;
this(PetitComputer p)
{
petitcom = p;
fontWidth = 8;
fontHeight = 8;
consoleWidth = petitcom.screenWidth / fontWidth;
consoleHeight = petitcom.screenHeight / fontHeight;
consoleWidthDisplay1 = petitcom.screenWidthDisplay1 / fontWidth;
consoleHeightDisplay1 = petitcom.screenHeightDisplay1 / fontHeight;
consoleWidth4 = 320 / fontWidth;
consoleHeight4 = 480 / fontHeight;
console = new ConsoleCharacter[][consoleHeight];
consoleDisplay1 = new ConsoleCharacter[][consoleHeightDisplay1];
console4 = new ConsoleCharacter[][consoleHeight4];
consoleForeColor = 15;//#T_WHITE
for(int i = 0; i < console.length; i++)
{
console[i] = new ConsoleCharacter[consoleWidth];
console[i][] = ConsoleCharacter(0, consoleForeColor, consoleBackColor);
}
for(int i = 0; i < consoleDisplay1.length; i++)
{
consoleDisplay1[i] = new ConsoleCharacter[consoleWidthDisplay1];
consoleDisplay1[i][] = ConsoleCharacter(0, consoleForeColor, consoleBackColor);
}
for(int i = 0; i < console4.length; i++)
{
console4[i] = new ConsoleCharacter[consoleWidth4];
console4[i][] = ConsoleCharacter(0, consoleForeColor, consoleBackColor);
}
for(int i = 0; i < consoleColor.length; i++)
consoleColorGL[i] = petitcom.toGLColor(consoleColor[i]);
}
void createFontTable()
{
auto file = File(petitcom.fontTableFile, "w");
std.algorithm.fill(fontTable, SDL_Rect(488,120, 8, 8));//TODO:480,120とどっちが使われているかは要調査
for (int i = 1; i <= 16; i++)
{
string html = cast(string)get("http://smilebasic.com/supplements/unicode" ~ format("%02d",i));
std.stdio.writeln("http://smilebasic.com/supplements/unicode" ~ format("%02d",i));
int pos = 0, index;
while(true)
{
pos = cast(int)html.indexOf("<tr>\r\n<th>U+");
if(pos == -1) break;
pos += "<tr>\r\n<th>U+".length;
html = html[pos..$];
writeln(index = html.parse!int(16));
file.write(index, ',');
pos = cast(int)html.indexOf("</td>\r\n<td>(");
if(pos == -1) break;
pos += "</td>\r\n<td>(".length;
html = html[pos..$];
writeln(fontTable[index].x = html.parse!int);
file.write(fontTable[index].x, ',');
pos = cast(int)html.indexOf(',');
html = html[pos + 1..$];
munch(html, " ");
writeln(fontTable[index].y = html.parse!int);
file.write(fontTable[index].y, '\n');
fontTable[index].w = 8;
fontTable[index].h = 8;
}
}
}
void loadFontTable()
{
import std.csv;
import std.typecons;
std.algorithm.fill(fontTable, SDL_Rect(488,120, 8, 8));//TODO:480,120とどっちが使われているかは要調査
auto csv = csvReader!(Tuple!(int,int,int))(readText(petitcom.fontTableFile));
foreach(record; csv)
{
fontTable[record[0]].x = record[1];
fontTable[record[0]].y = record[2];
fontTable[record[0]].w = 8;
fontTable[record[0]].h = 8;
}
}
void cls()
{
for(int i = 0; i < consoleC.length; i++)
{
consoleC[i][] = ConsoleCharacter(0, consoleForeColor, consoleBackColor);
}
CSRX = 0;
CSRY = 0;
}
void display(int number)
{
if(petitcom.xscreenmode == 2)
{
consoleHeightC = consoleHeight4;
consoleWidthC = consoleWidth4;
consoleC = console4;
return;
}
if(number == 1)
{
consoleHeightC = consoleHeightDisplay1;
consoleWidthC = consoleWidthDisplay1;
consoleC = consoleDisplay1;
return;
}
consoleHeightC = consoleHeight;
consoleWidthC = consoleWidth;
consoleC = console;
}
void render()
{
if(petitcom.xscreenmode == 2)
{
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
for(int y = 0; y < consoleHeight4; y++)
for(int x = 0; x < consoleWidth4; x++)
{
auto back = consoleColorGL[console4[y][x].backColor];
if(back)
{
glColor4ubv(cast(ubyte*)&back);
glVertex3f(x * 8, y * 8 + 8, 1024);
glVertex3f(x * 8, y * 8, 1024);
glVertex3f(x * 8 + 8, y * 8, 1024);
glVertex3f(x * 8 + 8, y * 8 + 8, 1024);
}
}
if(showCursor && animationCursor)
{
glColor4ubv(cast(ubyte*)&consoleColorGL[15]);
glVertex3f((CSRX * 8), (CSRY * 8 + 8), -256);
glVertex3f((CSRX * 8), (CSRY * 8), -256);
glVertex3f((CSRX * 8 + 2), (CSRY * 8), -256);
glVertex3f((CSRX * 8 + 2), (CSRY * 8 + 8), -256);
}
glEnd();
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
for(int y = 0; y < consoleHeight4; y++)
for(int x = 0; x < consoleWidth4; x++)
{
auto fore = consoleColorGL[console4[y][x].foreColor];
auto rect = &fontTable[console4[y][x].character];
glColor4ubv(cast(ubyte*)&fore);
int z = console4[y][x].z;
glTexCoord2f((rect.x) / 512f - 1 , (rect.y + 8) / 512f - 1);
glVertex3f((x * 8), (y * 8 + 8), z);
glTexCoord2f((rect.x) / 512f - 1, (rect.y) / 512f - 1);
glVertex3f((x * 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y) / 512f - 1);
glVertex3f((x * 8 + 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y +8) / 512f - 1);
glVertex3f((x * 8 + 8), (y * 8 + 8), z);
}
glEnd();
return;
}
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
for(int y = 0; y < consoleHeight; y++)
for(int x = 0; x < consoleWidth; x++)
{
auto back = consoleColorGL[console[y][x].backColor];
if(back)
{
glColor4ubv(cast(ubyte*)&back);
glVertex3f(x * 8, y * 8 + 8, 1024);
glVertex3f(x * 8, y * 8, 1024);
glVertex3f(x * 8 + 8, y * 8, 1024);
glVertex3f(x * 8 + 8, y * 8 + 8, 1024);
}
}
if(petitcom.displaynum == 0 && showCursor && animationCursor)
{
glColor4ubv(cast(ubyte*)&consoleColorGL[15]);
glVertex3f((CSRX * 8), (CSRY * 8 + 8), -256);
glVertex3f((CSRX * 8), (CSRY * 8), -256);
glVertex3f((CSRX * 8 + 2), (CSRY * 8), -256);
glVertex3f((CSRX * 8 + 2), (CSRY * 8 + 8), -256);
}
glEnd();
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
for(int y = 0; y < consoleHeight; y++)
for(int x = 0; x < consoleWidth; x++)
{
auto fore = consoleColorGL[console[y][x].foreColor];
auto rect = &fontTable[console[y][x].character];
float z = console[y][x].z;
glColor4ubv(cast(ubyte*)&fore);
glTexCoord2f((rect.x) / 512f - 1 , (rect.y + 8) / 512f - 1);
glVertex3f((x * 8), (y * 8 + 8), z);
glTexCoord2f((rect.x) / 512f - 1, (rect.y) / 512f - 1);
glVertex3f((x * 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y) / 512f - 1);
glVertex3f((x * 8 + 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y +8) / 512f - 1);
glVertex3f((x * 8 + 8), (y * 8 + 8), z);
}
glEnd();
if(petitcom.xscreenmode != 1)
{
return;
}
//下画面
petitcom.chScreen(40, 0, 400, 240);
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
for(int y = 0; y < consoleHeightDisplay1; y++)
for(int x = 0; x < consoleWidthDisplay1; x++)
{
auto back = consoleColorGL[consoleDisplay1[y][x].backColor];
if(back)
{
glColor4ubv(cast(ubyte*)&back);
glVertex3f(x * 8, y * 8 + 8, 1024);
glVertex3f(x * 8, y * 8, 1024);
glVertex3f(x * 8 + 8, y * 8, 1024);
glVertex3f(x * 8 + 8, y * 8 + 8, 1024);
}
}
if(petitcom.displaynum == 1 && showCursor && animationCursor)
{
glColor4ubv(cast(ubyte*)&consoleColorGL[15]);
glVertex3f((CSRX * 8), (CSRY * 8 + 8), -256);
glVertex3f((CSRX * 8), (CSRY * 8), -256);
glVertex3f((CSRX * 8 + 2), (CSRY * 8), -256);
glVertex3f((CSRX * 8 + 2), (CSRY * 8 + 8), -256);
}
glEnd();
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
for(int y = 0; y < consoleHeightDisplay1; y++)
for(int x = 0; x < consoleWidthDisplay1; x++)
{
auto fore = consoleColorGL[consoleDisplay1[y][x].foreColor];
auto rect = &fontTable[consoleDisplay1[y][x].character];
float z = consoleDisplay1[y][x].z;
glColor4ubv(cast(ubyte*)&fore);
glTexCoord2f((rect.x) / 512f - 1 , (rect.y + 8) / 512f - 1);
glVertex3f((x * 8), (y * 8 + 8), z);
glTexCoord2f((rect.x) / 512f - 1, (rect.y) / 512f - 1);
glVertex3f((x * 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y) / 512f - 1);
glVertex3f((x * 8 + 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y +8) / 512f - 1);
glVertex3f((x * 8 + 8), (y * 8 + 8), z);
}
glEnd();
}
void print(T...)(T args)
{
foreach(i; args)
{
printString(i.to!wstring);
}
}
//0<=TABSTEP<=16
int TABSTEP = 4;
byte consoleAttr;
int tab;
void printString(wstring text)
{
//consolem.lock();
//scope(exit) consolem.unlock();
//write(text);
foreach(wchar c; text)
{
if(CSRY >= consoleHeightC)
{
CSRY = consoleHeightC - 1;
}
if(c == '\t')
{
import std.algorithm : min;
if(tab == 2 && CSRX == 0)
{
CSRX--;
}
else
{
auto t = min(CSRX + TABSTEP - CSRX % TABSTEP, consoleWidthC - 1);
consoleC[CSRY][CSRX..t] = ConsoleCharacter(0, consoleForeColor, consoleBackColor, consoleAttr, CSRZ);
CSRX += TABSTEP - (CSRX % TABSTEP) - 1;
if(CSRX + 1 >= consoleWidthC)
{
CSRX = consoleWidthC - 2;
}
tab = true;
}
}
else if(c != '\n')
{
consoleC[CSRY][CSRX] = ConsoleCharacter(c, consoleForeColor, consoleBackColor, consoleAttr, CSRZ);
tab = tab ? 2 : 0;
}
CSRX++;
if(CSRX >= consoleWidthC || c == '\n')
{
CSRX = 0;
CSRY++;
}
if(CSRY >= consoleHeightC)
{
auto tmp = consoleC[0];
for(int i = 0; i < consoleHeightC - 1; i++)
{
consoleC[i] = consoleC[i + 1];
}
consoleC[consoleHeightC - 1] = tmp;
tmp[] = ConsoleCharacter(0, consoleForeColor, consoleBackColor, consoleAttr, CSRZ);
CSRY = consoleHeightC - 1;
}
}
}
}

View File

@@ -16,6 +16,7 @@ import otya.smilebasic.error;
import otya.smilebasic.bg; import otya.smilebasic.bg;
import otya.smilebasic.parser; import otya.smilebasic.parser;
import otya.smilebasic.project; import otya.smilebasic.project;
import otya.smilebasic.console;
const static rot_test_deg = 45f; const static rot_test_deg = 45f;
const static rot_test_x = 0f; const static rot_test_x = 0f;
const static rot_test_y = 1f; const static rot_test_y = 1f;
@@ -166,36 +167,6 @@ class PetitComputer
int screenHeight; int screenHeight;
int screenWidthDisplay1; int screenWidthDisplay1;
int screenHeightDisplay1; int screenHeightDisplay1;
int fontWidth;
int fontHeight;
int consoleWidth;
int consoleHeight;
int consoleWidthDisplay1;
int consoleHeightDisplay1;
int consoleWidth4;
int consoleHeight4;
int consoleHeightC, consoleWidthC;
ConsoleCharacter[][] consoleC;
int[] consoleColor =
[
0x00000000,
0xFF000000,
0xFF7F0000,
0xFFFF0000,
0xFF007F00,
0xFF00FF00,
0xFF7F7F00,
0xFFFFFF00,
0xFF00007F,
0xFF0000FF,
0xFF7F007F,
0xFFFF00FF,
0xFF007F7F,
0xFF00FFFF,
0xFF7F7F7F,
0xFFFFFFFF,
];
int[] consoleColorGL = new int[16];
uint toGLColor(uint color) uint toGLColor(uint color)
{ {
//ARGB -> ABGR //ARGB -> ABGR
@@ -214,9 +185,6 @@ class PetitComputer
return SDL_Color(r >> 5 << 5, g >> 5 << 5, b >> 5 << 5, a == 255 ? 255 : 0); return SDL_Color(r >> 5 << 5, g >> 5 << 5, b >> 5 << 5, a == 255 ? 255 : 0);
} }
Button button; Button button;
ConsoleCharacter[][] console;
ConsoleCharacter[][] consoleDisplay1;
ConsoleCharacter[][] console4;
bool visibleGRP = true; bool visibleGRP = true;
private int[2] showPage = [0, 1]; private int[2] showPage = [0, 1];
private int[2] usePage = [0, 1]; private int[2] usePage = [0, 1];
@@ -238,7 +206,6 @@ class PetitComputer
} }
uint gcolor = -1; uint gcolor = -1;
GraphicPage[] GRP; GraphicPage[] GRP;
GraphicPage GRPF;
GraphicPage createGRPF(string file) GraphicPage createGRPF(string file)
{ {
SDL_RWops* stream = SDL_RWFromFile(toStringz(file), toStringz("rb")); SDL_RWops* stream = SDL_RWFromFile(toStringz(file), toStringz("rb"));
@@ -316,55 +283,7 @@ class PetitComputer
this.y = y; this.y = y;
} }
} }
SDL_Rect[] fontTable = new SDL_Rect[65536];
int sppage, bgpage; int sppage, bgpage;
void createFontTable()
{
auto file = File(fontTableFile, "w");
std.algorithm.fill(fontTable, SDL_Rect(488,120, 8, 8));//TODO:480,120とどっちが使われているかは要調査
for (int i = 1; i <= 16; i++)
{
string html = cast(string)get("http://smilebasic.com/supplements/unicode" ~ format("%02d",i));
std.stdio.writeln("http://smilebasic.com/supplements/unicode" ~ format("%02d",i));
int pos = 0, index;
while(true)
{
pos = cast(int)html.indexOf("<tr>\r\n<th>U+");
if(pos == -1) break;
pos += "<tr>\r\n<th>U+".length;
html = html[pos..$];
writeln(index = html.parse!int(16));
file.write(index, ',');
pos = cast(int)html.indexOf("</td>\r\n<td>(");
if(pos == -1) break;
pos += "</td>\r\n<td>(".length;
html = html[pos..$];
writeln(fontTable[index].x = html.parse!int);
file.write(fontTable[index].x, ',');
pos = cast(int)html.indexOf(',');
html = html[pos + 1..$];
munch(html, " ");
writeln(fontTable[index].y = html.parse!int);
file.write(fontTable[index].y, '\n');
fontTable[index].w = 8;
fontTable[index].h = 8;
}
}
}
void loadFontTable()
{
import std.csv;
import std.typecons;
std.algorithm.fill(fontTable, SDL_Rect(488,120, 8, 8));//TODO:480,120とどっちが使われているかは要調査
auto csv = csvReader!(Tuple!(int,int,int))(readText(fontTableFile));
foreach(record; csv)
{
fontTable[record[0]].x = record[1];
fontTable[record[0]].y = record[2];
fontTable[record[0]].w = 8;
fontTable[record[0]].h = 8;
}
}
Projects project; Projects project;
wstring currentProject; wstring currentProject;
void init() void init()
@@ -372,8 +291,6 @@ class PetitComputer
currentProject = ""; currentProject = "";
project = new Projects("."); project = new Projects(".");
// DerelictGL.load(); // DerelictGL.load();
for(int i = 0; i < consoleColor.length; i++)
consoleColorGL[i] = toGLColor(consoleColor[i]);
if(!exists(resourcePath)) if(!exists(resourcePath))
{ {
writeln("create ./resources"); writeln("create ./resources");
@@ -397,79 +314,28 @@ class PetitComputer
download("http://dengekionline.com/elem/000/000/927/927125/petitcom_17_cs1w1_512x512.jpg", download("http://dengekionline.com/elem/000/000/927/927125/petitcom_17_cs1w1_512x512.jpg",
BGFile); BGFile);
} }
if(!exists(fontTableFile))
{
writeln("create font table");
//HTMLなんて解析したくないから適当
createFontTable();
}
else
{
loadFontTable();
}
writeln("OK");
screenWidth = 400; screenWidth = 400;
screenHeight = 240; screenHeight = 240;
screenWidthDisplay1 = 320; screenWidthDisplay1 = 320;
screenHeightDisplay1 = 240; screenHeightDisplay1 = 240;
fontWidth = 8; console = new Console(this);
fontHeight = 8; if(!exists(fontTableFile))
consoleWidth = screenWidth / fontWidth;
consoleHeight = screenHeight / fontHeight;
consoleWidthDisplay1 = screenWidthDisplay1 / fontWidth;
consoleHeightDisplay1 = screenHeightDisplay1 / fontHeight;
consoleWidth4 = 320 / fontWidth;
consoleHeight4 = 480 / fontHeight;
console = new ConsoleCharacter[][consoleHeight];
consoleDisplay1 = new ConsoleCharacter[][consoleHeightDisplay1];
console4 = new ConsoleCharacter[][consoleHeight4];
consoleForeColor = 15;//#T_WHITE
for(int i = 0; i < console.length; i++)
{ {
console[i] = new ConsoleCharacter[consoleWidth]; writeln("create font table");
console[i][] = ConsoleCharacter(0, consoleForeColor, consoleBackColor); //HTMLなんて解析したくないから適当
console.createFontTable();
} }
for(int i = 0; i < consoleDisplay1.length; i++) else
{ {
consoleDisplay1[i] = new ConsoleCharacter[consoleWidthDisplay1]; console.loadFontTable();
consoleDisplay1[i][] = ConsoleCharacter(0, consoleForeColor, consoleBackColor);
}
for(int i = 0; i < console4.length; i++)
{
console4[i] = new ConsoleCharacter[consoleWidth4];
console4[i][] = ConsoleCharacter(0, consoleForeColor, consoleBackColor);
} }
display(0); display(0);
writeln("OK");
} }
void display(int number) void display(int number)
{ {
displaynum = number; displaynum = number;
if(xscreenmode == 2) console.display(number);
{
consoleHeightC = consoleHeight4;
consoleWidthC = consoleWidth4;
consoleC = console4;
return;
}
if(number)
{
consoleHeightC = consoleHeightDisplay1;
consoleWidthC = consoleWidthDisplay1;
consoleC = consoleDisplay1;
return;
}
consoleHeightC = consoleHeight;
consoleWidthC = consoleWidth;
consoleC = console;
}
void cls()
{
for(int i = 0; i < consoleC.length; i++)
{
consoleC[i][] = ConsoleCharacter(0, consoleForeColor, consoleBackColor);
}
CSRX = 0;
CSRY = 0;
} }
SDL_Renderer* renderer; SDL_Renderer* renderer;
int vsyncFrame; int vsyncFrame;
@@ -858,7 +724,7 @@ class PetitComputer
paint.buffer = new uint[512 * 512]; paint.buffer = new uint[512 * 512];
DerelictSDL2.load(); DerelictSDL2.load();
DerelictSDL2Image.load(); DerelictSDL2Image.load();
GRPF = createGRPF(fontFile); console.GRPF = createGRPF(fontFile);
GRP = new GraphicPage[6]; GRP = new GraphicPage[6];
for(int i = 0; i < 4; i++) for(int i = 0; i < 4; i++)
{ {
@@ -925,7 +791,7 @@ class PetitComputer
writeln(SDL_GetError.to!string); writeln(SDL_GetError.to!string);
return; return;
} }
GRPF.createTexture(renderer); console.GRPF.createTexture(renderer);
chScreen(0, 0, 400, 240); chScreen(0, 0, 400, 240);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
@@ -965,13 +831,13 @@ class PetitComputer
while(true) while(true)
{ {
auto profile = SDL_GetTicks(); auto profile = SDL_GetTicks();
if(showCursor) if(console.showCursor)
{ {
loopcnt++; loopcnt++;
//30フレームに一回 //30フレームに一回
if(loopcnt >= 30) if(loopcnt >= 30)
{ {
animationCursor = !animationCursor; console.animationCursor = !console.animationCursor;
loopcnt = 0; loopcnt = 0;
} }
} }
@@ -991,7 +857,7 @@ class PetitComputer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
version(test) glLoadIdentity(); version(test) glLoadIdentity();
version(test) glRotatef(rot_test_deg, rot_test_x, rot_test_y, rot_test_z); version(test) glRotatef(rot_test_deg, rot_test_x, rot_test_y, rot_test_z);
renderConsoleGL(); console.render();
if(xscreenmode == 1) if(xscreenmode == 1)
{ {
@@ -1143,17 +1009,18 @@ class PetitComputer
} }
void printInformation() void printInformation()
{ {
printConsole("otyaSMILEBASIC ver ", otya.smilebasic.systemvariable.Version.VERSIONSTRING, "\n"); console.print("otyaSMILEBASIC ver ", otya.smilebasic.systemvariable.Version.VERSIONSTRING, "\n");
printConsole("(C)2015-2016 otya\n"); console.print("(C)2015-2016 otya\n");
printConsole("8327164 bytes free\n"); console.print("8327164 bytes free\n");
printConsole("\n"); console.print("\n");
printPrompt(); printPrompt();
} }
void printPrompt() void printPrompt()
{ {
if(currentProject.length) printConsole("[", currentProject, "]"); if(currentProject.length) console.print("[", currentProject, "]");
printConsole("OK\n"); console.print("OK\n");
} }
Console console;
Object buttonLock; Object buttonLock;
Slot[] slot; Slot[] slot;
bool isRunningDirectMode = false; bool isRunningDirectMode = false;
@@ -1194,8 +1061,8 @@ class PetitComputer
} }
catch(SmileBasicError sbe) catch(SmileBasicError sbe)
{ {
printConsole(sbe.getErrorMessage, "\n"); console.print(sbe.getErrorMessage, "\n");
if(sbe.getErrorMessage2.length) printConsole(sbe.getErrorMessage2, "\n"); if(sbe.getErrorMessage2.length) console.print(sbe.getErrorMessage2, "\n");
writeln(sbe.to!string); writeln(sbe.to!string);
writeln(sbe.getErrorMessage2); writeln(sbe.getErrorMessage2);
} }
@@ -1228,7 +1095,7 @@ class PetitComputer
catch(Throwable t) catch(Throwable t)
{ {
writeln(t); writeln(t);
printConsole("can't open program \"", file, "\".\n"); print("can't open program \"", file, "\".\n");
continue; continue;
} }
try try
@@ -1239,9 +1106,9 @@ class PetitComputer
} }
catch(SmileBasicError sbe) catch(SmileBasicError sbe)
{ {
printConsole(sbe.getErrorMessage, "\n"); print(sbe.getErrorMessage, "\n");
printConsole(sbe.getErrorMessage2, "\n"); print(sbe.getErrorMessage2, "\n");
//printConsole(sbe.to!string); //print(sbe.to!string);
writeln(sbe.to!string); writeln(sbe.to!string);
writeln(sbe.getErrorMessage2); writeln(sbe.getErrorMessage2);
continue; continue;
@@ -1283,7 +1150,7 @@ class PetitComputer
token = lex.front(); token = lex.front();
if(token.type != otya.smilebasic.token.TokenType.Integer) if(token.type != otya.smilebasic.token.TokenType.Integer)
{ {
printConsole("Illegal function call", "\n"); console.print("Illegal function call", "\n");
continue; continue;
} }
else else
@@ -1313,12 +1180,12 @@ class PetitComputer
{ {
try try
{ {
printConsole(sbe.getErrorMessage, "\n"); console.print(sbe.getErrorMessage, "\n");
if(sbe.getErrorMessage2.length) printConsole(sbe.getErrorMessage2, "\n"); if(sbe.getErrorMessage2.length) console.print(sbe.getErrorMessage2, "\n");
writeln(sbe.to!string); writeln(sbe.to!string);
writeln(sbe.getErrorMessage2); writeln(sbe.getErrorMessage2);
auto loc = vm.currentLocation; auto loc = vm.currentLocation;
printConsole(loc.line, ":", loc.pos, ":", parser.getLine(loc)); console.print(loc.line, ":", loc.pos, ":", parser.getLine(loc));
} }
catch(Throwable t) catch(Throwable t)
{ {
@@ -1330,9 +1197,9 @@ class PetitComputer
{ {
try try
{ {
printConsole(t.to!string); console.print(t.to!string);
writeln(t); writeln(t);
printConsole(parser.getLine(vm.currentLocation)); console.print(parser.getLine(vm.currentLocation));
} }
catch(Throwable t) catch(Throwable t)
{ {
@@ -1369,7 +1236,7 @@ class PetitComputer
debug if(trace && loc.line != vm.currentLocation.line) debug if(trace && loc.line != vm.currentLocation.line)
{ {
loc = vm.currentLocation; loc = vm.currentLocation;
printConsole(loc.line, ":", loc.pos, ":", parser.getLine(loc)); console.print(loc.line, ":", loc.pos, ":", parser.getLine(loc));
} }
} }
} }
@@ -1378,13 +1245,13 @@ class PetitComputer
running = false; running = false;
try try
{ {
printConsole(sbe.getErrorMessage, "\n"); console.print(sbe.getErrorMessage, "\n");
if(sbe.getErrorMessage2.length) printConsole(sbe.getErrorMessage2, "\n"); if(sbe.getErrorMessage2.length) console.print(sbe.getErrorMessage2, "\n");
//printConsole(sbe.to!string); //print(sbe.to!string);
writeln(sbe.to!string); writeln(sbe.to!string);
writeln(sbe.getErrorMessage2); writeln(sbe.getErrorMessage2);
loc = vm.currentLocation; loc = vm.currentLocation;
printConsole(loc.line, ":", loc.pos, ":", parser.getLine(loc)); console.print(loc.line, ":", loc.pos, ":", parser.getLine(loc));
} }
catch(Throwable t) catch(Throwable t)
{ {
@@ -1396,9 +1263,9 @@ class PetitComputer
running = false; running = false;
try try
{ {
printConsole(t.to!string); console.print(t.to!string);
writeln(t); writeln(t);
printConsole(parser.getLine(vm.currentLocation)); console.print(parser.getLine(vm.currentLocation));
} }
catch(Throwable t) catch(Throwable t)
{ {
@@ -1410,7 +1277,7 @@ class PetitComputer
if(stopflg) if(stopflg)
{ {
loc = vm.currentLocation; loc = vm.currentLocation;
printConsole("Break on ", vm.currentSlotNumber, ":", loc.line, "\n"); console.print("Break on ", vm.currentSlotNumber, ":", loc.line, "\n");
stopflg = false; stopflg = false;
directMode = true; directMode = true;
if(!isRunningDirectMode) if(!isRunningDirectMode)
@@ -1449,21 +1316,21 @@ class PetitComputer
{ {
auto olddisplay = displaynum; auto olddisplay = displaynum;
//displaynum = 0; //displaynum = 0;
printConsole(prompt); console.print(prompt);
clearKeyBuffer(); clearKeyBuffer();
wstring buffer; wstring buffer;
showCursor = true; console.showCursor = true;
int oldCSRX = this.CSRX; int oldCSRX = this.console.CSRX;
int oldCSRY = this.CSRY; int oldCSRY = this.console.CSRY;
int pos; int pos;
void left() void left()
{ {
pos--; pos--;
CSRX--; console.CSRX--;
} }
void right() void right()
{ {
CSRX++; console.CSRX++;
} }
while(!quit) while(!quit)
{ {
@@ -1500,7 +1367,7 @@ class PetitComputer
} }
wchar k; wchar k;
//文字入力中はカーソルを表示する //文字入力中はカーソルを表示する
animationCursor = true; console.animationCursor = true;
foreach(key1; keybuffer[oldpos..kbp]) foreach(key1; keybuffer[oldpos..kbp])
{ {
wchar key = key1.key; wchar key = key1.key;
@@ -1513,25 +1380,25 @@ class PetitComputer
k = key; k = key;
if(!buffer.length) continue; if(!buffer.length) continue;
left(); left();
auto odcsrx = CSRX; auto odcsrx = console.CSRX;
auto odcsry = CSRY; auto odcsry = console.CSRY;
buffer = (pos ? buffer[0..pos] : ""); buffer = (pos ? buffer[0..pos] : "");
auto ocsrx = CSRX; auto ocsrx = console.CSRX;
auto ocsry = CSRY; auto ocsry = console.CSRY;
if (obf.length > pos + 1) if (obf.length > pos + 1)
{ {
buffer ~= obf[pos + 1..$]; buffer ~= obf[pos + 1..$];
printConsole(obf[pos + 1..$]); console.print(obf[pos + 1..$]);
} }
printConsole(" "); console.print(" ");
CSRX = odcsrx; console.CSRX = odcsrx;
CSRY = odcsry; console.CSRY = odcsry;
continue; continue;
} }
if(key == '\r') if(key == '\r')
{ {
k = key; k = key;
printConsole("\n"); console.print("\n");
break; break;
} }
immutable(wchar[1]) a = key; immutable(wchar[1]) a = key;
@@ -1546,17 +1413,17 @@ class PetitComputer
ks = an.to!wstring; ks = an.to!wstring;
} }
} }
printConsole(ks); console.print(ks);
buffer = (pos ? buffer[0..pos] : "") ~ ks; buffer = (pos ? buffer[0..pos] : "") ~ ks;
auto ocsrx = CSRX; auto ocsrx = console.CSRX;
auto ocsry = CSRY; auto ocsry = console.CSRY;
if (obf.length > pos) if (obf.length > pos)
{ {
buffer ~= obf[pos..$]; buffer ~= obf[pos..$];
printConsole(obf[pos..$]); console.print(obf[pos..$]);
} }
CSRX = ocsrx; console.CSRX = ocsrx;
CSRY = ocsry; console.CSRY = ocsry;
pos += ks.length; pos += ks.length;
} }
clearKeyBuffer(); clearKeyBuffer();
@@ -1565,7 +1432,7 @@ class PetitComputer
break; break;
} }
} }
showCursor = false; console.showCursor = false;
//display = olddisplay; //display = olddisplay;
return buffer; return buffer;
} }
@@ -1579,12 +1446,6 @@ class PetitComputer
keybufferlen--; keybufferlen--;
return result.key.to!wstring; return result.key.to!wstring;
} }
int CSRX;
int CSRY;
int CSRZ;
int consoleForeColor, consoleBackColor;
bool showCursor;
bool animationCursor;
Mutex consolem; Mutex consolem;
//プチコン内部表現はRGB5_A1 //プチコン内部表現はRGB5_A1
static uint toGLColor(GLenum format, ubyte r, ubyte g, ubyte b, ubyte a) static uint toGLColor(GLenum format, ubyte r, ubyte g, ubyte b, ubyte a)
@@ -1754,217 +1615,4 @@ class PetitComputer
glEnd(); glEnd();
//glFlush(); //glFlush();
} }
void renderConsoleGL()
{
if(xscreenmode == 2)
{
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
for(int y = 0; y < consoleHeight4; y++)
for(int x = 0; x < consoleWidth4; x++)
{
auto back = consoleColorGL[console4[y][x].backColor];
if(back)
{
glColor4ubv(cast(ubyte*)&back);
glVertex3f(x * 8, y * 8 + 8, 1024);
glVertex3f(x * 8, y * 8, 1024);
glVertex3f(x * 8 + 8, y * 8, 1024);
glVertex3f(x * 8 + 8, y * 8 + 8, 1024);
}
}
if(showCursor && animationCursor)
{
glColor4ubv(cast(ubyte*)&consoleColorGL[15]);
glVertex3f((CSRX * 8), (CSRY * 8 + 8), -256);
glVertex3f((CSRX * 8), (CSRY * 8), -256);
glVertex3f((CSRX * 8 + 2), (CSRY * 8), -256);
glVertex3f((CSRX * 8 + 2), (CSRY * 8 + 8), -256);
}
glEnd();
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
for(int y = 0; y < consoleHeight4; y++)
for(int x = 0; x < consoleWidth4; x++)
{
auto fore = consoleColorGL[console4[y][x].foreColor];
auto rect = &fontTable[console4[y][x].character];
glColor4ubv(cast(ubyte*)&fore);
int z = console4[y][x].z;
glTexCoord2f((rect.x) / 512f - 1 , (rect.y + 8) / 512f - 1);
glVertex3f((x * 8), (y * 8 + 8), z);
glTexCoord2f((rect.x) / 512f - 1, (rect.y) / 512f - 1);
glVertex3f((x * 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y) / 512f - 1);
glVertex3f((x * 8 + 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y +8) / 512f - 1);
glVertex3f((x * 8 + 8), (y * 8 + 8), z);
}
glEnd();
return;
}
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
for(int y = 0; y < consoleHeight; y++)
for(int x = 0; x < consoleWidth; x++)
{
auto back = consoleColorGL[console[y][x].backColor];
if(back)
{
glColor4ubv(cast(ubyte*)&back);
glVertex3f(x * 8, y * 8 + 8, 1024);
glVertex3f(x * 8, y * 8, 1024);
glVertex3f(x * 8 + 8, y * 8, 1024);
glVertex3f(x * 8 + 8, y * 8 + 8, 1024);
}
}
if(displaynum == 0 && showCursor && animationCursor)
{
glColor4ubv(cast(ubyte*)&consoleColorGL[15]);
glVertex3f((CSRX * 8), (CSRY * 8 + 8), -256);
glVertex3f((CSRX * 8), (CSRY * 8), -256);
glVertex3f((CSRX * 8 + 2), (CSRY * 8), -256);
glVertex3f((CSRX * 8 + 2), (CSRY * 8 + 8), -256);
}
glEnd();
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
for(int y = 0; y < consoleHeight; y++)
for(int x = 0; x < consoleWidth; x++)
{
auto fore = consoleColorGL[console[y][x].foreColor];
auto rect = &fontTable[console[y][x].character];
float z = console[y][x].z;
glColor4ubv(cast(ubyte*)&fore);
glTexCoord2f((rect.x) / 512f - 1 , (rect.y + 8) / 512f - 1);
glVertex3f((x * 8), (y * 8 + 8), z);
glTexCoord2f((rect.x) / 512f - 1, (rect.y) / 512f - 1);
glVertex3f((x * 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y) / 512f - 1);
glVertex3f((x * 8 + 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y +8) / 512f - 1);
glVertex3f((x * 8 + 8), (y * 8 + 8), z);
}
glEnd();
if(xscreenmode != 1)
{
return;
}
//下画面
chScreen(40, 0, 400, 240);
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
for(int y = 0; y < consoleHeightDisplay1; y++)
for(int x = 0; x < consoleWidthDisplay1; x++)
{
auto back = consoleColorGL[consoleDisplay1[y][x].backColor];
if(back)
{
glColor4ubv(cast(ubyte*)&back);
glVertex3f(x * 8, y * 8 + 8, 1024);
glVertex3f(x * 8, y * 8, 1024);
glVertex3f(x * 8 + 8, y * 8, 1024);
glVertex3f(x * 8 + 8, y * 8 + 8, 1024);
}
}
if(displaynum == 1 && showCursor && animationCursor)
{
glColor4ubv(cast(ubyte*)&consoleColorGL[15]);
glVertex3f((CSRX * 8), (CSRY * 8 + 8), -256);
glVertex3f((CSRX * 8), (CSRY * 8), -256);
glVertex3f((CSRX * 8 + 2), (CSRY * 8), -256);
glVertex3f((CSRX * 8 + 2), (CSRY * 8 + 8), -256);
}
glEnd();
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
for(int y = 0; y < consoleHeightDisplay1; y++)
for(int x = 0; x < consoleWidthDisplay1; x++)
{
auto fore = consoleColorGL[consoleDisplay1[y][x].foreColor];
auto rect = &fontTable[consoleDisplay1[y][x].character];
float z = consoleDisplay1[y][x].z;
glColor4ubv(cast(ubyte*)&fore);
glTexCoord2f((rect.x) / 512f - 1 , (rect.y + 8) / 512f - 1);
glVertex3f((x * 8), (y * 8 + 8), z);
glTexCoord2f((rect.x) / 512f - 1, (rect.y) / 512f - 1);
glVertex3f((x * 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y) / 512f - 1);
glVertex3f((x * 8 + 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y +8) / 512f - 1);
glVertex3f((x * 8 + 8), (y * 8 + 8), z);
}
glEnd();
}
void printConsole(T...)(T args)
{
foreach(i; args)
{
printConsoleString(i.to!wstring);
}
}
//0<=TABSTEP<=16
int TABSTEP = 4;
byte consoleAttr;
int tab;
void printConsoleString(wstring text)
{
//consolem.lock();
//scope(exit) consolem.unlock();
//write(text);
foreach(wchar c; text)
{
if(CSRY >= consoleHeightC)
{
CSRY = consoleHeightC - 1;
}
if(c == '\t')
{
import std.algorithm : min;
if(tab == 2 && CSRX == 0)
{
CSRX--;
}
else
{
auto t = min(CSRX + TABSTEP - CSRX % TABSTEP, consoleWidthC - 1);
consoleC[CSRY][CSRX..t] = ConsoleCharacter(0, consoleForeColor, consoleBackColor, consoleAttr, CSRZ);
CSRX += TABSTEP - (CSRX % TABSTEP) - 1;
if(CSRX + 1 >= consoleWidthC)
{
CSRX = consoleWidthC - 2;
}
tab = true;
}
}
else if(c != '\n')
{
consoleC[CSRY][CSRX] = ConsoleCharacter(c, consoleForeColor, consoleBackColor, consoleAttr, CSRZ);
tab = tab ? 2 : 0;
}
CSRX++;
if(CSRX >= consoleWidthC || c == '\n')
{
CSRX = 0;
CSRY++;
}
if(CSRY >= consoleHeightC)
{
auto tmp = consoleC[0];
for(int i = 0; i < consoleHeightC - 1; i++)
{
consoleC[i] = consoleC[i + 1];
}
consoleC[consoleHeightC - 1] = tmp;
tmp[] = ConsoleCharacter(0, consoleForeColor, consoleBackColor, consoleAttr, CSRZ);
CSRY = consoleHeightC - 1;
}
}
}
} }

View File

@@ -49,7 +49,7 @@ class CSRX : SystemVariable
@property @property
override Value value() override Value value()
{ {
return Value(vm.petitcomputer.CSRX); return Value(vm.petitcomputer.console.CSRX);
} }
} }
class CSRY : SystemVariable class CSRY : SystemVariable
@@ -57,7 +57,7 @@ class CSRY : SystemVariable
@property @property
override Value value() override Value value()
{ {
return Value(vm.petitcomputer.CSRY); return Value(vm.petitcomputer.console.CSRY);
} }
} }
class CSRZ : SystemVariable class CSRZ : SystemVariable
@@ -65,7 +65,7 @@ class CSRZ : SystemVariable
@property @property
override Value value() override Value value()
{ {
return Value(vm.petitcomputer.CSRZ); return Value(vm.petitcomputer.console.CSRZ);
} }
} }
class TabStep : SystemVariable class TabStep : SystemVariable
@@ -73,7 +73,7 @@ class TabStep : SystemVariable
@property @property
override Value value() override Value value()
{ {
return Value(vm.petitcomputer.TABSTEP); return Value(vm.petitcomputer.console.TABSTEP);
} }
@property @property
override void value(Value value) override void value(Value value)
@@ -87,7 +87,7 @@ class TabStep : SystemVariable
{ {
throw new OutOfRange(); throw new OutOfRange();
} }
vm.petitcomputer.TABSTEP = i; vm.petitcomputer.console.TABSTEP = i;
} }
} }
class Version : SystemVariable class Version : SystemVariable

View File

@@ -4,7 +4,7 @@
"derelict-sdl2": "~>1.9.7", "derelict-sdl2": "~>1.9.7",
"derelict-gl3": "*" "derelict-gl3": "*"
}, },
"sourceFiles": ["SMILEBASIC/bg.d","SMILEBASIC/builtinfunctions.d","SMILEBASIC/compiler.d","SMILEBASIC/error.d","SMILEBASIC/main.d","SMILEBASIC/node.d","SMILEBASIC/parser.d","SMILEBASIC/petitcomputer.d","SMILEBASIC/sprite.d","SMILEBASIC/systemvariable.d","SMILEBASIC/token.d","SMILEBASIC/type.d","SMILEBASIC/VM.d","SMILEBASIC/project.d"], "sourceFiles": ["SMILEBASIC/bg.d","SMILEBASIC/builtinfunctions.d","SMILEBASIC/compiler.d","SMILEBASIC/error.d","SMILEBASIC/main.d","SMILEBASIC/node.d","SMILEBASIC/parser.d","SMILEBASIC/petitcomputer.d","SMILEBASIC/sprite.d","SMILEBASIC/systemvariable.d","SMILEBASIC/token.d","SMILEBASIC/type.d","SMILEBASIC/VM.d","SMILEBASIC/project.d","SMILEBASIC/console.d"],
"targetType": "executable", "targetType": "executable",
"buildRequirements": ["allowWarnings"], "buildRequirements": ["allowWarnings"],
"targetPath": "out", "targetPath": "out",