BGROT, BGSCALE実装.
This commit is contained in:
@@ -16,6 +16,8 @@ class BG
|
|||||||
BGChip[16384] chip;
|
BGChip[16384] chip;
|
||||||
int offsetx, offsety, offsetz;
|
int offsetx, offsety, offsetz;
|
||||||
int clipx, clipy, clipx2, clipy2;
|
int clipx, clipy, clipx2, clipy2;
|
||||||
|
double scalex, scaley;
|
||||||
|
double r;
|
||||||
int homex, homey;
|
int homex, homey;
|
||||||
int width, height;
|
int width, height;
|
||||||
int rendermax = 899;
|
int rendermax = 899;
|
||||||
@@ -26,15 +28,22 @@ class BG
|
|||||||
width = 25;
|
width = 25;
|
||||||
height = 35;
|
height = 35;
|
||||||
petitcom = pc;
|
petitcom = pc;
|
||||||
|
scalex = 1;
|
||||||
|
scaley = 1;
|
||||||
|
r = 0;
|
||||||
}
|
}
|
||||||
void render(float disw, float dish)
|
void render(float disw, float dish)
|
||||||
{
|
{
|
||||||
|
float aspect = disw / dish;
|
||||||
disw/=2;
|
disw/=2;
|
||||||
dish/=2;
|
dish/=2;
|
||||||
float z = offsetz / 1025f;
|
float z = offsetz / 1025f;
|
||||||
glColor3f(1.0, 1.0, 1.0);
|
glColor3f(1.0, 1.0, 1.0);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glTranslatef((-offsetx + homex) / disw, -((-offsety + homey) / dish), z);
|
glTranslatef((-offsetx + homex) / disw, -((-offsety + homey) / dish), z);
|
||||||
|
glScalef(1.0f / aspect, 1.0f, 1.0f);
|
||||||
|
glRotatef(360 - r, 0.0f, 0.0f, 1.0f );
|
||||||
|
glScalef(scalex * aspect, scaley, 1f);
|
||||||
version(test) glRotatef(45f, 1f, 0f, 0.5f);
|
version(test) glRotatef(45f, 1f, 0f, 0.5f);
|
||||||
//viewport
|
//viewport
|
||||||
//clipx,clipy
|
//clipx,clipy
|
||||||
@@ -114,4 +123,13 @@ class BG
|
|||||||
homex = x;
|
homex = x;
|
||||||
homey = y;
|
homey = y;
|
||||||
}
|
}
|
||||||
|
void scale(double x, double y)
|
||||||
|
{
|
||||||
|
this.scalex = x;
|
||||||
|
this.scaley = y;
|
||||||
|
}
|
||||||
|
void rot(double rot)
|
||||||
|
{
|
||||||
|
this.r = rot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -686,6 +686,14 @@ class BuiltinFunction
|
|||||||
{
|
{
|
||||||
p.bg[layer].home(x, y);
|
p.bg[layer].home(x, y);
|
||||||
}
|
}
|
||||||
|
static void BGSCALE(PetitComputer p, int layer, double x, double y)
|
||||||
|
{
|
||||||
|
p.bg[layer].scale(x, y);
|
||||||
|
}
|
||||||
|
static void BGROT(PetitComputer p, int layer, double rot)
|
||||||
|
{
|
||||||
|
p.bg[layer].rot(rot);
|
||||||
|
}
|
||||||
//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()
|
||||||
|
|||||||
@@ -846,6 +846,7 @@ class PetitComputer
|
|||||||
printConsole(sbe.getErrorMessage2, "\n");
|
printConsole(sbe.getErrorMessage2, "\n");
|
||||||
//printConsole(sbe.to!string);
|
//printConsole(sbe.to!string);
|
||||||
writeln(sbe.to!string);
|
writeln(sbe.to!string);
|
||||||
|
writeln(sbe.getErrorMessage2);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user