diff --git a/SMILEBASIC/bg.d b/SMILEBASIC/bg.d index 83b5aeb..5b61ad6 100644 --- a/SMILEBASIC/bg.d +++ b/SMILEBASIC/bg.d @@ -135,6 +135,15 @@ class BG } void screen(int w, int h) { + rot = 0; + scalex = 0; + scaley = 0; + homex = 0; + homey = 0; + chipWidth = 16; + chipHeight = 16; + offsetx = offsety = offsetz = 0; + //BGCLIP is not initialized this.width = w; this.height = h; this.clear(); diff --git a/SMILEBASIC/builtinfunctions.d b/SMILEBASIC/builtinfunctions.d index acc5953..abfde85 100644 --- a/SMILEBASIC/builtinfunctions.d +++ b/SMILEBASIC/builtinfunctions.d @@ -2465,10 +2465,11 @@ class BuiltinFunction } static void ACLS(PetitComputer p) { - p.console.cls; - SPCLR(p, DefaultValue!(int, false)(true)); - BGCLR(p, DefaultValue!(int, false)(true)); - GCLS(p); + p.acls(true, true, true); + } + static void ACLS(PetitComputer p, int gr, int sp, int fn) + { + p.acls(cast(bool)gr, cast(bool)sp, cast(bool)fn); } static int CHKCALL(PetitComputer p, wstring func) { diff --git a/SMILEBASIC/graphic.d b/SMILEBASIC/graphic.d index b6402bc..30a7cc0 100644 --- a/SMILEBASIC/graphic.d +++ b/SMILEBASIC/graphic.d @@ -114,8 +114,8 @@ class Graphic } bool[2] visibles = [true, true]; - protected int[2] showPage = [0, 1]; - protected int[2] usePage = [0, 1]; + int[2] showPage = [0, 1]; + int[2] usePage = [0, 1]; bool visible() { return visibles[petitcom.displaynum]; @@ -323,7 +323,7 @@ class Graphic } abstract void gcopy(int srcpage, int x, int y, int x2, int y2, int x3, int y3, int cpmode); abstract void gtri(int x1, int y1, int x2, int y2, int x3, int y3, int color); - int[2] gprios = [511, 511]; + int[2] gprios = [512, 512]; @property ref gprio() { diff --git a/SMILEBASIC/petitcomputer.d b/SMILEBASIC/petitcomputer.d index ed3bcf8..e0c06f6 100644 --- a/SMILEBASIC/petitcomputer.d +++ b/SMILEBASIC/petitcomputer.d @@ -1634,6 +1634,51 @@ class PetitComputer Program program; + void acls(bool gclsAndSpriteImageBGImageInit, bool spdef, bool fontdef) + { + xscreen(0, 512, 4); + backcolor = 0; + console.width(8); + console.foreColors[] = 15; + console.backColors[] = 0; + console.CSRXs[] = 0; + console.CSRYs[] = 0; + console.CSRZs[] = 0; + console.attrs[] = ConsoleAttribute.TROT0; + if (gclsAndSpriteImageBGImageInit) + { + //TODO:sprite,bg + for (int i = 0; i <= 3; i++) + { + this.graphic.useGRP = i; + graphic.gcls(0, 0); + } + } + this.graphic.usePage = [0, 1]; + this.graphic.showPage = [0, 1]; + this.graphic.gprios = [512, 512];/*reference:GPRIO 1024*/ + this.graphic.visibles = [1, 1]; + this.sprite.sppage = [4, 4]; + this.sprite.allclear(); + this.sprite.visibles = [true, true]; + this.bgpage = [5, 5]; + this.BGvisibles = [true, true]; + foreach (b; bg) + { + b.screen(25, 15); + b.clip(); + } + if (spdef) + { + this.sprite.spdef(); + } + if (fontdef) + { + //TODO + } + + } + //プチコン内部表現はRGB5_A1 static uint toGLColor(GLenum format, ubyte r, ubyte g, ubyte b, ubyte a) { diff --git a/SMILEBASIC/sprite.d b/SMILEBASIC/sprite.d index 7d240ff..b50f9d8 100644 --- a/SMILEBASIC/sprite.d +++ b/SMILEBASIC/sprite.d @@ -978,6 +978,13 @@ class Sprite sprites[i].clear; } } + void allclear() + { + synchronized (this) for(int i = 0; i < sprites.length; i++) + { + sprites[i].clear; + } + } void sphome(int i, int hx, int hy) { i = spid(i);