1
0

BGROT, BGSCALE実装.

This commit is contained in:
otya128
2015-08-25 10:40:26 +09:00
parent ac8eb9b96d
commit cdda2dadbd
3 changed files with 27 additions and 0 deletions

View File

@@ -16,6 +16,8 @@ class BG
BGChip[16384] chip;
int offsetx, offsety, offsetz;
int clipx, clipy, clipx2, clipy2;
double scalex, scaley;
double r;
int homex, homey;
int width, height;
int rendermax = 899;
@@ -26,15 +28,22 @@ class BG
width = 25;
height = 35;
petitcom = pc;
scalex = 1;
scaley = 1;
r = 0;
}
void render(float disw, float dish)
{
float aspect = disw / dish;
disw/=2;
dish/=2;
float z = offsetz / 1025f;
glColor3f(1.0, 1.0, 1.0);
glLoadIdentity();
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);
//viewport
//clipx,clipy
@@ -114,4 +123,13 @@ class BG
homex = x;
homey = y;
}
void scale(double x, double y)
{
this.scalex = x;
this.scaley = y;
}
void rot(double rot)
{
this.r = rot;
}
}

View File

@@ -686,6 +686,14 @@ class BuiltinFunction
{
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;
static BuiltinFunction[wstring] builtinFunctions;
static this()

View File

@@ -846,6 +846,7 @@ class PetitComputer
printConsole(sbe.getErrorMessage2, "\n");
//printConsole(sbe.to!string);
writeln(sbe.to!string);
writeln(sbe.getErrorMessage2);
}
catch
{