diff --git a/SMILEBASIC/SMILEBASIC.visualdproj b/SMILEBASIC/SMILEBASIC.visualdproj
index ea56b65..e7b800c 100644
--- a/SMILEBASIC/SMILEBASIC.visualdproj
+++ b/SMILEBASIC/SMILEBASIC.visualdproj
@@ -146,7 +146,7 @@
0
0
0
- 2.043
+ 2
0
0
0
@@ -155,7 +155,7 @@
$(CC) -c
1
$(DMDInstallDir)windows\bin\dmd.exe
-
+ $(DMDInstallDir)src
$(ConfigurationName)
$(OutDir)
@@ -174,7 +174,7 @@
0
0
-
+ NDirectMode
0
0
0
@@ -191,8 +191,8 @@
-
-
+ DerelictSDL2.lib;DerelictUtil.lib;DerelictGL3.lib;kernel32.lib
+ $(DMDInstallDir)windows\lib\
$(OutDir)\$(ProjectName).exe
@@ -213,7 +213,7 @@
-
+
diff --git a/SMILEBASIC/VM.d b/SMILEBASIC/VM.d
index 1936e57..495adba 100644
--- a/SMILEBASIC/VM.d
+++ b/SMILEBASIC/VM.d
@@ -37,8 +37,7 @@ class VMSlot
}
class VM
{
- static const directModeSlot = 5;
- VMSlot[6] slots;
+ VMSlot[5] slots;
int slot;
VMSlot currentSlot;
int stacki;
@@ -58,6 +57,11 @@ class VM
{
currentSlot = slots[slot];
}
+ void directSlot(Code[] code, int len, VMVariable[wstring] globalTable, Function[wstring] functions, DataTable gdt/*GNU Debugging Tools*/,
+ int[wstring] globalLabel, DebugInfo dinfo)
+ {
+ this.currentSlot.code ~= code;
+ }
void loadSlot(int slot, Code[] code, int len, VMVariable[wstring] globalTable, Function[wstring] functions, DataTable gdt/*GNU Debugging Tools*/,
int[wstring] globalLabel, DebugInfo dinfo)
{
diff --git a/SMILEBASIC/bg.d b/SMILEBASIC/bg.d
index ef2b579..790b51a 100644
--- a/SMILEBASIC/bg.d
+++ b/SMILEBASIC/bg.d
@@ -39,11 +39,11 @@ class BG
dish /= 2;
float z = offsetz / 1025f;
glColor3f(1.0, 1.0, 1.0);
+ glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- glTranslatef((-offsetx + homex) / disw, -((-offsety + homey) / dish), z);
- glScalef(1.0f / aspect, 1.0f, 1.0f);
+ glTranslatef((-offsetx + homex), ((-offsety + homey)), z);
+ glScalef(scalex, scaley, 1f);
glRotatef(360 - r, 0.0f, 0.0f, 1.0f );
- glScalef(scalex * aspect, scaley, 1f);
version(test) glRotatef(rot_test_deg, rot_test_x, rot_test_y, rot_test_z);
//viewport
//clipx,clipy
@@ -66,13 +66,13 @@ class BG
int w = 16;
int h = 16;
glTexCoord2f((u) / 512f - 1 , (v2) / 512f - 1);
- glVertex3f((x * w) / disw - 1, 1 - (y * h + h) / dish, 0);
+ glVertex3f((x * w), (y * h + h), 0);
glTexCoord2f((u) / 512f - 1, (v) / 512f - 1);
- glVertex3f((x * w) / disw - 1, 1 - (y * h) / dish, 0);
+ glVertex3f((x * w), (y * h), 0);
glTexCoord2f((u2) / 512f - 1, (v) / 512f - 1);
- glVertex3f((x * w + w) / disw - 1, 1 - (y * h) / dish, 0);
+ glVertex3f((x * w + w), (y * h), 0);
glTexCoord2f((u2) / 512f - 1, (v2) / 512f - 1);
- glVertex3f((x * w + w) / disw - 1, 1 - (y * h + h) / dish, 0);
+ glVertex3f((x * w + w), (y * h + h), 0);
rendercount++;
if(rendercount >= 899)
{
diff --git a/SMILEBASIC/petitcomputer.d b/SMILEBASIC/petitcomputer.d
index 9d2b936..d84f2b2 100644
--- a/SMILEBASIC/petitcomputer.d
+++ b/SMILEBASIC/petitcomputer.d
@@ -617,6 +617,13 @@ class PetitComputer
}
Paint paint;
int renderstartpos;
+ void chScreen(int x, int y, int w, int h)
+ {
+ glViewport(x, y, w, h);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, w, h, 0, 10,-10/*-256, 1024*/);
+ }
void renderGraphic()
{
if(!drawMessageLength) return;
@@ -632,8 +639,16 @@ class PetitComputer
glDisable(GL_TEXTURE_2D);
glDisable(GL_ALPHA_TEST);
glDisable(GL_DEPTH_TEST);
+
//glAlphaFunc(GL_GEQUAL, 0.0);
- glViewport(0, 0, 512, 512);
+ void chScreen(int x, int y, int w, int h)
+ {
+ glViewport(x, y, w, h);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, w, 0, h, -256, 1024);//wakaranai
+ }
+ chScreen(0, 0, 511, 511);
DrawType dt;
auto start = SDL_GetTicks();
int i = s;
@@ -651,7 +666,7 @@ class PetitComputer
case DrawType.PSET:
glBegin(GL_POINTS);
glColor4ubv(cast(ubyte*)&dm.color);
- glVertex2f((dm.x) / size - 1, (dm.y) / size - 1);
+ glVertex2f(dm.x, dm.y);
glEnd();
//draw.gpset(dm.page, dm.x, dm.y ,dm.color);
break;
@@ -659,8 +674,8 @@ class PetitComputer
{
glBegin(GL_LINES);
glColor4ubv(cast(ubyte*)&dm.color);
- glVertex2f((dm.x) / size - 1, (dm.y) / size - 1);
- glVertex2f((dm.x2) / size - 1, (dm.y2) / size - 1);
+ glVertex2f(dm.x, dm.y);
+ glVertex2f(dm.x2, dm.y2);
//glFlush();
glEnd();
}
@@ -670,10 +685,10 @@ class PetitComputer
{
glBegin(GL_QUADS);
glColor4ubv(cast(ubyte*)&dm.color);
- glVertex2f((dm.x) / size - 1, (dm.y) / size - 1);
- glVertex2f((dm.x) / size - 1, (dm.y2 + 1) / size - 1);
- glVertex2f((dm.x2 + 1) / size - 1, (dm.y2 + 1) / size - 1);
- glVertex2f((dm.x2 + 1) / size - 1, (dm.y) / size - 1);
+ glVertex2f(dm.x, dm.y);
+ glVertex2f(dm.x, dm.y2);
+ glVertex2f(dm.x2, dm.y2);
+ glVertex2f(dm.x2, dm.y);
glEnd();
}
//draw.gfill(dm.page, dm.x, dm.y ,dm.x2, dm.y2, dm.color);
@@ -682,10 +697,10 @@ class PetitComputer
{
glBegin(GL_LINE_LOOP);
glColor4ubv(cast(ubyte*)&dm.color);
- glVertex2f((dm.x) / size - 1, (dm.y) / size - 1);
- glVertex2f((dm.x) / size - 1, (dm.y2) / size - 1);
- glVertex2f((dm.x2) / size - 1, (dm.y2) / size - 1);
- glVertex2f((dm.x2) / size - 1, (dm.y) / size - 1);
+ glVertex2f(dm.x, dm.y);
+ glVertex2f(dm.x, dm.y2);
+ glVertex2f(dm.x2, dm.y2);
+ glVertex2f(dm.x2, dm.y);
glEnd();
}
//draw.gbox(dm.page, dm.x, dm.y ,dm.x2, dm.y2, dm.color);
@@ -725,7 +740,7 @@ class PetitComputer
glBindFramebufferEXT(GL_FRAMEBUFFER, old);
glEnable(GL_DEPTH_TEST);
drawflag = false;
- glViewport(0, 0, 400, 240);
+ this.chScreen(0, 0, 400, 240);
glEnable(GL_ALPHA_TEST);
}
Button[] buttonTable;
@@ -787,7 +802,7 @@ class PetitComputer
DerelictGL.load();
DerelictGL3.load();
- bool renderprofile;//e = true;
+ bool renderprofile = true;
try
{
version(Windows)
@@ -835,7 +850,7 @@ class PetitComputer
return;
}
GRPF.createTexture(renderer);
- glViewport(0, 0, 400, 240);
+ chScreen(0, 0, 400, 240);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glEnable(GL_DEPTH_TEST);
version(Windows)
@@ -881,28 +896,25 @@ class PetitComputer
renderGraphic();
if(xscreenmode == 1)
{
- glViewport(0, 240, 400, 240);
+ chScreen(0, 240, 400, 240);
}
if(xscreenmode == 2)
{
- glViewport(0, 0, 320, 480);
+ chScreen(0, 0, 320, 480);
}
//描画の順位
//sprite>GRP>console>BG
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glEnable(GL_BLEND);
version(test) glLoadIdentity();
version(test) glRotatef(rot_test_deg, rot_test_x, rot_test_y, rot_test_z);
if(xscreenmode == 1)
{
- glViewport(0, 240, 400, 240);
+ chScreen(0, 240, 400, 240);
}
- glEnable(GL_BLEND);
if(xscreenmode == 1)
{
- glViewport(0, 240, 400, 240);
+ chScreen(0, 240, 400, 240);
}
- glEnable(GL_BLEND);
version(test) glLoadIdentity();
version(test) glRotatef(rot_test_deg, rot_test_x, rot_test_y, rot_test_z);
if(xscreenmode == 2)
@@ -915,18 +927,18 @@ class PetitComputer
}
if(xscreenmode == 1)
{
- glViewport(40, 0, 320, 240);
+ chScreen(40, 0, 320, 240);
renderGraphicPage(1, 320, 240);
- glViewport(0, 240, 400, 240);
+ chScreen(0, 240, 400, 240);
}
if(xscreenmode == 2)
{
- glViewport(0, 0, 320, 480);
+ chScreen(0, 0, 320, 480);
}
renderConsoleGL();
if(xscreenmode == 1)
{
- glViewport(0, 240, 400, 240);
+ chScreen(0, 240, 400, 240);
}
version(test) glLoadIdentity();
version(test) glRotatef(rot_test_deg, rot_test_x, rot_test_y, rot_test_z);
@@ -946,12 +958,12 @@ class PetitComputer
}
if(xscreenmode == 1)
{
- glViewport(40, 0, 320, 240);
+ chScreen(40, 0, 320, 240);
for(int i = bgmax; i < bg.length; i++)
{
bg[i].render(320f, 240f);
}
- glViewport(0, 240, 400, 240);
+ chScreen(0, 240, 400, 240);
}
}
version(test) glLoadIdentity();
@@ -959,7 +971,7 @@ class PetitComputer
if(xscreenmode == 1)
{
- glViewport(0, 240, 400, 240);
+ chScreen(0, 240, 400, 240);
}
//http://marina.sys.wakayama-u.ac.jp/~tokoi/?date=20081122 みたいな方法もあるけどとりあえず
//とりあえず一番楽な方法
@@ -1456,13 +1468,13 @@ class PetitComputer
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glTexCoord2f(0 / 512f - 1 , h / 512f - 1);
- glVertex3f(-1, -1, z);
+ glVertex3f(0, h, z);
glTexCoord2f(0 / 512f - 1, 0 / 512f - 1);
- glVertex3f(-1, 1, z);
+ glVertex3f(0, 0, z);
glTexCoord2f(w / 512f - 1, 0 / 512f - 1);
- glVertex3f(1, 1, z);
+ glVertex3f(w, 0, z);
glTexCoord2f(w / 512f - 1, h / 512f - 1);
- glVertex3f(1, -1, z);
+ glVertex3f(w, h, z);
glEnd();
//glFlush();
}
@@ -1478,18 +1490,18 @@ class PetitComputer
{
auto back = consoleColorGL[console4[y][x].backColor];
glColor4ubv(cast(ubyte*)&back);
- glVertex3f((x * 8) / 160f - 1, 1 - (y * 8 + 8) / 240f, 0.9f);
- glVertex3f((x * 8) / 160f - 1, 1 - (y * 8) / 240f, 0.9f);
- glVertex3f((x * 8 + 8) / 160f - 1, 1 - (y * 8) / 240f, 0.9f);
- glVertex3f((x * 8 + 8) / 160f - 1, 1 - (y * 8 + 8) / 240f, 0.9f);
+ 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(showCursor && animationCursor)
{
glColor4ubv(cast(ubyte*)&consoleColorGL[15]);
- glVertex3f((CSRX * 8) / 160f - 1, 1 - (CSRY * 8 + 8) / 240f, -0.9f);
- glVertex3f((CSRX * 8) / 160f - 1, 1 - (CSRY * 8) / 240f, -0.9f);
- glVertex3f((CSRX * 8 + 2) / 160f - 1, 1 - (CSRY * 8) / 240f, -0.9f);
- glVertex3f((CSRX * 8 + 2) / 160f - 1, 1 - (CSRY * 8 + 8) / 240f, -0.9f);
+ 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);
}
glEnd();
glEnable(GL_TEXTURE_2D);
@@ -1503,13 +1515,13 @@ class PetitComputer
glColor4ubv(cast(ubyte*)&fore);
float z = console4[y][x].z / 1025f;
glTexCoord2f((rect.x) / 512f - 1 , (rect.y + 8) / 512f - 1);
- glVertex3f((x * 8) / 160f - 1, 1 - (y * 8 + 8) / 240f, z);
+ glVertex3f((x * 8), (y * 8 + 8), z);
glTexCoord2f((rect.x) / 512f - 1, (rect.y) / 512f - 1);
- glVertex3f((x * 8) / 160f - 1, 1 - (y * 8) / 240f, z);
+ glVertex3f((x * 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y) / 512f - 1);
- glVertex3f((x * 8 + 8) / 160f - 1, 1 - (y * 8) / 240f, z);
+ glVertex3f((x * 8 + 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y +8) / 512f - 1);
- glVertex3f((x * 8 + 8) / 160f - 1, 1 - (y * 8 + 8) / 240f, z);
+ glVertex3f((x * 8 + 8), (y * 8 + 8), z);
}
glEnd();
return;
@@ -1522,18 +1534,18 @@ class PetitComputer
{
auto back = consoleColorGL[console[y][x].backColor];
glColor4ubv(cast(ubyte*)&back);
- glVertex3f((x * 8) / 200f - 1, 1 - (y * 8 + 8) / 120f, 1f);
- glVertex3f((x * 8) / 200f - 1, 1 - (y * 8) / 120f, 1f);
- glVertex3f((x * 8 + 8) / 200f - 1, 1 - (y * 8) / 120f, 1f);
- glVertex3f((x * 8 + 8) / 200f - 1, 1 - (y * 8 + 8) / 120f, 1f);
+ 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(showCursor && animationCursor)
{
glColor4ubv(cast(ubyte*)&consoleColorGL[15]);
- glVertex3f((CSRX * 8) / 200f - 1, 1 - (CSRY * 8 + 8) / 120f, -0.9f);
- glVertex3f((CSRX * 8) / 200f - 1, 1 - (CSRY * 8) / 120f, -0.9f);
- glVertex3f((CSRX * 8 + 2) / 200f - 1, 1 - (CSRY * 8) / 120f, -0.9f);
- glVertex3f((CSRX * 8 + 2) / 200f - 1, 1 - (CSRY * 8 + 8) / 120f, -0.9f);
+ 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);
}
glEnd();
glEnable(GL_TEXTURE_2D);
@@ -1547,13 +1559,13 @@ class PetitComputer
float z = console[y][x].z / 1025f;
glColor4ubv(cast(ubyte*)&fore);
glTexCoord2f((rect.x) / 512f - 1 , (rect.y + 8) / 512f - 1);
- glVertex3f((x * 8) / 200f - 1, 1 - (y * 8 + 8) / 120f, z);
+ glVertex3f((x * 8), (y * 8 + 8), z);
glTexCoord2f((rect.x) / 512f - 1, (rect.y) / 512f - 1);
- glVertex3f((x * 8) / 200f - 1, 1 - (y * 8) / 120f, z);
+ glVertex3f((x * 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y) / 512f - 1);
- glVertex3f((x * 8 + 8) / 200f - 1, 1 - (y * 8) / 120f, z);
+ glVertex3f((x * 8 + 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y +8) / 512f - 1);
- glVertex3f((x * 8 + 8) / 200f - 1, 1 - (y * 8 + 8) / 120f, z);
+ glVertex3f((x * 8 + 8), (y * 8 + 8), z);
}
glEnd();
if(xscreenmode != 1)
@@ -1561,7 +1573,7 @@ class PetitComputer
return;
}
//下画面
- glViewport(40, 0, 400, 240);
+ chScreen(40, 0, 400, 240);
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
@@ -1570,18 +1582,18 @@ class PetitComputer
{
auto back = consoleColorGL[consoleDisplay1[y][x].backColor];
glColor4ubv(cast(ubyte*)&back);
- glVertex3f((x * 8) / 200f - 1, 1 - (y * 8 + 8) / 120f, 0.9f);
- glVertex3f((x * 8) / 200f - 1, 1 - (y * 8) / 120f, 0.9f);
- glVertex3f((x * 8 + 8) / 200f - 1, 1 - (y * 8) / 120f, 0.9f);
- glVertex3f((x * 8 + 8) / 200f - 1, 1 - (y * 8 + 8) / 120f, 0.9f);
+ 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(showCursor && animationCursor)
{
glColor4ubv(cast(ubyte*)&consoleColorGL[15]);
- glVertex3f((CSRX * 8) / 200f - 1, 1 - (CSRY * 8 + 8) / 120f, -0.9f);
- glVertex3f((CSRX * 8) / 200f - 1, 1 - (CSRY * 8) / 120f, -0.9f);
- glVertex3f((CSRX * 8 + 2) / 200f - 1, 1 - (CSRY * 8) / 120f, -0.9f);
- glVertex3f((CSRX * 8 + 2) / 200f - 1, 1 - (CSRY * 8 + 8) / 120f, -0.9f);
+ 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);
}
glEnd();
glEnable(GL_TEXTURE_2D);
@@ -1595,13 +1607,13 @@ class PetitComputer
float z = consoleDisplay1[y][x].z / 1025f;
glColor4ubv(cast(ubyte*)&fore);
glTexCoord2f((rect.x) / 512f - 1 , (rect.y + 8) / 512f - 1);
- glVertex3f((x * 8) / 200f - 1, 1 - (y * 8 + 8) / 120f, z);
+ glVertex3f((x * 8), (y * 8 + 8), z);
glTexCoord2f((rect.x) / 512f - 1, (rect.y) / 512f - 1);
- glVertex3f((x * 8) / 200f - 1, 1 - (y * 8) / 120f, z);
+ glVertex3f((x * 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y) / 512f - 1);
- glVertex3f((x * 8 + 8) / 200f - 1, 1 - (y * 8) / 120f, z);
+ glVertex3f((x * 8 + 8), (y * 8), z);
glTexCoord2f((rect.x + 8) / 512f - 1, (rect.y +8) / 512f - 1);
- glVertex3f((x * 8 + 8) / 200f - 1, 1 - (y * 8 + 8) / 120f, z);
+ glVertex3f((x * 8 + 8), (y * 8 + 8), z);
}
glEnd();
}
diff --git a/SMILEBASIC/sprite.d b/SMILEBASIC/sprite.d
index 53e4149..cdb5a50 100644
--- a/SMILEBASIC/sprite.d
+++ b/SMILEBASIC/sprite.d
@@ -649,7 +649,7 @@ class Sprite
{
disw = 160f;
disw2 = 320f;
- glViewport(40, 0, 320, 240);
+ petitcom.chScreen(40, 0, 320, 240);
aspect = disw2 / dish2;
dis = true;
}
@@ -659,7 +659,7 @@ class Sprite
{
disw = 200f;
disw2 = 400f;
- glViewport(0, 240, 400, 240);
+ petitcom.chScreen(0, 240, 400, 240);
aspect = disw2 / dish2;
dis = false;
}
@@ -678,8 +678,8 @@ class Sprite
}
sprite.linkx = x;
sprite.linky = y;
- auto homex2 = ((sprite.w / 2 ) - sprite.homex) / disw;
- auto homey2 = ((sprite.h / 2 ) - sprite.homey) / dish;
+ auto homex2 = ((sprite.w / 2 ) - sprite.homex);
+ auto homey2 = ((sprite.h / 2 ) - sprite.homey);
int w = sprite.w;
int h = sprite.h;
@@ -707,28 +707,28 @@ class Sprite
}
version(test) glRotatef(rot_test_deg, rot_test_x, rot_test_y, rot_test_z);
- glTranslatef((flipx2) / disw - 1,
- 1 - ((flipy2) / dish), 0);
+ glTranslatef((flipx2),
+ ((flipy2)), 0);
//glTranslatef((flipx2) / dish - 1,1 - ((flipy2) / dish), 0);
- //glScalef(flipx, flipy, 1f);
+ glScalef(flipx, flipy, 1f);
//アスペクト比を調節しないといけないらしい
//https://groups.google.com/forum/#!topic/android-group-japan/45mjecPSY4s
//http://www.tnksoft.com/blog/?p=2889
- glScalef(1.0f / aspect, 1.0f, 1.0f);
+ //glScalef(1.0f / aspect, 1.0f, 1.0f);
glRotatef(360 - sprite.r, 0.0f, 0.0f, 1.0f );
- glScalef(flipx * aspect, flipy, 1f);
+ //glScalef(flipx * aspect, flipy, 1f);
glBegin(GL_QUADS);
glColor4ubv(cast(ubyte*)&sprite.color);
if((sprite.attr& 0b111) == SpriteAttr.show)
{
glTexCoord2f(u / 512f - 1, v / 512f - 1);
- glVertex3f(-((sprite.w) / disw2 - homex2) , ((sprite.h) / dish2 - homey2), z);//1
+ glVertex3f(-((sprite.w / 2) - homex2) , -((sprite.h / 2) - homey2), z);//1
glTexCoord2f(u / 512f - 1 , v2 / 512f - 1);
- glVertex3f(-((sprite.w) / disw2 - homex2), -((sprite.h) / dish2 + homey2), z);//2
+ glVertex3f(-((sprite.w / 2) - homex2), ((sprite.h / 2) + homey2), z);//2
glTexCoord2f(u2 / 512f - 1, v2 / 512f - 1);
- glVertex3f((sprite.w) / disw2 + homex2, -((sprite.h) / dish2 + homey2), z);//3//y+--+x--++
+ glVertex3f((sprite.w / 2) + homex2, ((sprite.h / 2) + homey2), z);//3//y+--+x--++
glTexCoord2f(u2 / 512f - 1, v / 512f - 1);
- glVertex3f((sprite.w) / disw2 + homex2, ((sprite.h) / dish2 - homey2), z);//4
+ glVertex3f((sprite.w / 2) + homex2, -((sprite.h / 2) - homey2), z);//4
glEnd();
glLoadIdentity();
continue;
@@ -736,13 +736,13 @@ class Sprite
if((sprite.attr & SpriteAttr.rotate270) == SpriteAttr.rotate270)
{
glTexCoord2f(u2 / 512f - 1, v / 512f - 1);//3
- glVertex3f(-((sprite.w) / disw2 - homex2), ((sprite.h) / dish2 - homey2), z);//1
+ glVertex3f(-((sprite.w) / 2 - homex2), -((sprite.h) / 2 - homey2), z);//1
glTexCoord2f(u / 512f - 1, v / 512f - 1);//1
- glVertex3f(-((sprite.w) / disw2 - homex2), -((sprite.h) / dish2 + homey2), z);//2
+ glVertex3f(-((sprite.w) / 2 - homex2), ((sprite.h) / 2 + homey2), z);//2
glTexCoord2f(u / 512f - 1 , v2 / 512f - 1);//2
- glVertex3f((sprite.w) / disw2 + homex2, -((sprite.h) / dish2 + homey2), z);//3
+ glVertex3f((sprite.w) / 2 + homex2, ((sprite.h) / 2 + homey2), z);//3
glTexCoord2f(u2 / 512f - 1, v2 / 512f - 1);//4
- glVertex3f((sprite.w) / disw2 + homex2, ((sprite.h) / dish2 - homey2), z);//4
+ glVertex3f((sprite.w) / 2 + homex2, -((sprite.h) / 2 - homey2), z);//4
glEnd();
glLoadIdentity();
continue;
@@ -750,13 +750,13 @@ class Sprite
if((sprite.attr & SpriteAttr.rotate90) == SpriteAttr.rotate90)
{
glTexCoord2f(u / 512f - 1 , v2 / 512f - 1);//2
- glVertex3f(-((sprite.w) / disw2 - homex2), ((sprite.h) / dish2 - homey2), z);//1
+ glVertex3f(-((sprite.w) / 2 - homex2), -((sprite.h) / 2 - homey2), z);//1
glTexCoord2f(u2 / 512f - 1, v2 / 512f - 1);//3
- glVertex3f(-((sprite.w) / disw2 - homex2), -((sprite.h) / dish2 + homey2), z);//2
+ glVertex3f(-((sprite.w) / 2 - homex2), ((sprite.h) / 2 + homey2), z);//2
glTexCoord2f(u2 / 512f - 1, v / 512f - 1);//4
- glVertex3f((sprite.w) / disw2 + homex2, -((sprite.h) / dish2 + homey2), z);//3
+ glVertex3f((sprite.w) / 2 + homex2, ((sprite.h) / 2 + homey2), z);//3
glTexCoord2f(u / 512f - 1, v / 512f - 1);//1
- glVertex3f((sprite.w) / disw2 + homex2, ((sprite.h) / dish2 - homey2), z);//4
+ glVertex3f((sprite.w) / 2 + homex2, -((sprite.h) / 2 - homey2), z);//4
glEnd();
glLoadIdentity();
continue;
@@ -764,25 +764,25 @@ class Sprite
if((sprite.attr & SpriteAttr.rotate180) == SpriteAttr.rotate180)
{
glTexCoord2f(u2 / 512f - 1, v2 / 512f - 1);//4
- glVertex3f(-((sprite.w) / disw2 - homex2), ((sprite.h) / dish2 - homey2), z);//1
+ glVertex3f(-((sprite.w) / 2 - homex2), -((sprite.h) / 2 - homey2), z);//1
glTexCoord2f(u2 / 512f - 1, v / 512f - 1);//3
- glVertex3f(-((sprite.w) / disw2 - homex2), -((sprite.h) / dish2 + homey2), z);//2
+ glVertex3f(-((sprite.w) / 2 - homex2), ((sprite.h) / 2 + homey2), z);//2
glTexCoord2f(u / 512f - 1, v / 512f - 1);//1
- glVertex3f((sprite.w) / disw2 + homex2, -((sprite.h) / dish2 + homey2), z);//3
+ glVertex3f((sprite.w) / 2 + homex2, ((sprite.h) / 2 + homey2), z);//3
glTexCoord2f(u / 512f - 1 , v2 / 512f - 1);//2
- glVertex3f((sprite.w) / disw2 + homex2, ((sprite.h) / dish2 - homey2), z);//4
+ glVertex3f((sprite.w) / 2 + homex2, -((sprite.h) / 2 - homey2), z);//4
glEnd();
glLoadIdentity();
continue;
}
glTexCoord2f(u / 512f - 1, v / 512f - 1);
- glVertex3f(-((sprite.w) / disw2 - homex2), ((sprite.h) / dish2 - homey2), z);//1
+ glVertex3f(-((sprite.w) / 2 - homex2), -((sprite.h) / 2 - homey2), z);//1
glTexCoord2f(u / 512f - 1 , v2 / 512f - 1);
- glVertex3f(-((sprite.w) / disw2 - homex2), -((sprite.h) / dish2 + homey2), z);//2
+ glVertex3f(-((sprite.w) / 2 - homex2), ((sprite.h) / 2 + homey2), z);//2
glTexCoord2f(u2 / 512f - 1, v2 / 512f - 1);
- glVertex3f((sprite.w) / disw2 + homex2, -((sprite.h) / dish2 + homey2), z);//3
+ glVertex3f((sprite.w) / 2 + homex2, ((sprite.h) / 2 + homey2), z);//3
glTexCoord2f(u2 / 512f - 1, v / 512f - 1);
- glVertex3f((sprite.w) / disw2 + homex2, ((sprite.h) / dish2 - homey2), z);//4
+ glVertex3f((sprite.w) / 2 + homex2, -((sprite.h) / 2 - homey2), z);//4
glEnd();
glLoadIdentity();
continue;