From 0deea64fc4b735e1fd7e4bfaa6656edf8ac37483 Mon Sep 17 00:00:00 2001 From: otya128 Date: Mon, 22 Feb 2016 21:25:20 +0900 Subject: [PATCH] =?UTF-8?q?Z=E5=BA=A7=E6=A8=99=E8=A8=88=E7=AE=97=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=A4=89=E3=81=88=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SMILEBASIC/bg.d | 2 +- SMILEBASIC/petitcomputer.d | 77 +++++++++++++++++++++----------------- SMILEBASIC/sprite.d | 2 +- 3 files changed, 45 insertions(+), 36 deletions(-) diff --git a/SMILEBASIC/bg.d b/SMILEBASIC/bg.d index 790b51a..2f97edf 100644 --- a/SMILEBASIC/bg.d +++ b/SMILEBASIC/bg.d @@ -37,7 +37,7 @@ class BG float aspect = disw / dish; disw /= 2; dish /= 2; - float z = offsetz / 1025f; + float z = offsetz; glColor3f(1.0, 1.0, 1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); diff --git a/SMILEBASIC/petitcomputer.d b/SMILEBASIC/petitcomputer.d index d84f2b2..3e6d864 100644 --- a/SMILEBASIC/petitcomputer.d +++ b/SMILEBASIC/petitcomputer.d @@ -622,7 +622,7 @@ class PetitComputer glViewport(x, y, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0, w, h, 0, 10,-10/*-256, 1024*/); + glOrtho(0, w, h, 0, 1024, -2048); } void renderGraphic() { @@ -1064,11 +1064,11 @@ class PetitComputer parser = new Parser( //readText("./SYS/GAME6TALK.TXT").to!wstring //readText("./SYS/GAME7EXPAD.TXT").to!wstring - readText("./SYS/GAME4SHOOTER.TXT").to!wstring + //readText("./SYS/GAME4SHOOTER.TXT").to!wstring //readText("./SYS/GAME2RPG.TXT").to!wstring //readText("./SYS/GAME1DOTRC.TXT").to!wstring //readText(input("LOAD PROGRAM:", true).to!string).to!wstring - //readText("./SYS/EX8TECDEMO.TXT").to!wstring + readText("./SYS/EX8TECDEMO.TXT").to!wstring //readText("./SYS/EX1TEXT.TXT").to!wstring //readText("FIZZBUZZ.TXT").to!wstring //readText("TEST.TXT").to!wstring @@ -1462,7 +1462,7 @@ class PetitComputer int gprio; void renderGraphicPage(int display, float w, float h) { - float z = gprio / 1025f; + float z = gprio; glColor3f(1.0, 1.0, 1.0); glBindTexture(GL_TEXTURE_2D, GRP[showPage[display]].glTexture); glEnable(GL_TEXTURE_2D); @@ -1489,19 +1489,22 @@ class PetitComputer for(int x = 0; x < consoleWidth4; x++) { auto back = consoleColorGL[console4[y][x].backColor]; - glColor4ubv(cast(ubyte*)&back); - glVertex3f(x * 8, y * 8 + 8, 0.9f); - glVertex3f(x * 8, y * 8, 0.9f); - glVertex3f(x * 8 + 8, y * 8, 0.9f); - glVertex3f(x * 8 + 8, y * 8 + 8, 0.9f); + 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), -0.9f); - glVertex3f((CSRX * 8), (CSRY * 8), -0.9f); - glVertex3f((CSRX * 8 + 2), (CSRY * 8), -0.9f); - glVertex3f((CSRX * 8 + 2), (CSRY * 8 + 8), -0.9f); + 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); @@ -1513,7 +1516,7 @@ class PetitComputer auto fore = consoleColorGL[console4[y][x].foreColor]; auto rect = &fontTable[console4[y][x].character]; glColor4ubv(cast(ubyte*)&fore); - float z = console4[y][x].z / 1025f; + 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); @@ -1533,19 +1536,22 @@ class PetitComputer for(int x = 0; x < consoleWidth; x++) { auto back = consoleColorGL[console[y][x].backColor]; - glColor4ubv(cast(ubyte*)&back); - glVertex3f((x * 8), (y * 8 + 8), 1f); - glVertex3f((x * 8), (y * 8), 1f); - glVertex3f((x * 8 + 8), (y * 8), 1f); - glVertex3f((x * 8 + 8), (y * 8 + 8), 1f); + 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) , -0.9f); - glVertex3f((CSRX * 8), (CSRY * 8), -0.9f); - glVertex3f((CSRX * 8 + 2), (CSRY * 8), -0.9f); - glVertex3f((CSRX * 8 + 2), (CSRY * 8 + 8), -0.9f); + 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); @@ -1556,7 +1562,7 @@ class PetitComputer { auto fore = consoleColorGL[console[y][x].foreColor]; auto rect = &fontTable[console[y][x].character]; - float z = console[y][x].z / 1025f; + 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); @@ -1581,19 +1587,22 @@ class PetitComputer for(int x = 0; x < consoleWidthDisplay1; x++) { auto back = consoleColorGL[consoleDisplay1[y][x].backColor]; - glColor4ubv(cast(ubyte*)&back); - glVertex3f((x * 8), (y * 8 + 8), 0.9f); - glVertex3f((x * 8), (y * 8), 0.9f); - glVertex3f((x * 8 + 8), (y * 8), 0.9f); - glVertex3f((x * 8 + 8), (y * 8 + 8), 0.9f); + 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), -0.9f); - glVertex3f((CSRX * 8), (CSRY * 8), -0.9f); - glVertex3f((CSRX * 8 + 2), (CSRY * 8), -0.9f); - glVertex3f((CSRX * 8 + 2), (CSRY * 8 + 8), -0.9f); + 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); @@ -1604,7 +1613,7 @@ class PetitComputer { auto fore = consoleColorGL[consoleDisplay1[y][x].foreColor]; auto rect = &fontTable[consoleDisplay1[y][x].character]; - float z = consoleDisplay1[y][x].z / 1025f; + 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); diff --git a/SMILEBASIC/sprite.d b/SMILEBASIC/sprite.d index cdb5a50..abea887 100644 --- a/SMILEBASIC/sprite.d +++ b/SMILEBASIC/sprite.d @@ -693,7 +693,7 @@ class Sprite int v = cast(int)sprite.v; int u2 = cast(int)sprite.u + sprite.w;//-1 int v2 = cast(int)sprite.v + sprite.h; - z = (sprite.z - 1) / 1025f;//スプライトの描画順が一番上だけどスプライトは最後に描画しないといけないのでZ - 1で一番上にする + z = (sprite.z - 1);//スプライトの描画順が一番上だけどスプライトは最後に描画しないといけないのでZ - 1で一番上にする float flipx = cast(float)sprite.scalex, flipy = cast(float)sprite.scaley, flipx2 = x, flipy2 = y; if(sprite.attr & SpriteAttr.hflip) {