Implement BGCLIP
This commit is contained in:
@@ -29,6 +29,7 @@ class BG
|
||||
bool show;
|
||||
int chipWidth = 16;
|
||||
int chipHeight = 16;
|
||||
int display;
|
||||
this(PetitComputer pc)
|
||||
{
|
||||
chip[] = BGChip(0);
|
||||
@@ -40,7 +41,7 @@ class BG
|
||||
r = 0;
|
||||
show = true;
|
||||
}
|
||||
void render(float disw, float dish)
|
||||
void render(int display, float disw, float dish)
|
||||
{
|
||||
if (!show)
|
||||
return;
|
||||
@@ -49,6 +50,7 @@ class BG
|
||||
dish /= 2;
|
||||
float z = offsetz;
|
||||
glColor3f(1.0, 1.0, 1.0);
|
||||
petitcom.chRenderingDisplay(display, clipx, clipx, clipx2 - clipx + 1, clipy2 - clipy + 1);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
@@ -118,6 +120,15 @@ class BG
|
||||
}
|
||||
void clip(int x, int y, int x2, int y2)
|
||||
{
|
||||
import std.algorithm : swap;
|
||||
if (x > x2)
|
||||
{
|
||||
swap(x, x2);
|
||||
}
|
||||
if (y > y2)
|
||||
{
|
||||
swap(y, y2);
|
||||
}
|
||||
this.clipx = x;
|
||||
this.clipy = y;
|
||||
this.clipx2 = x2;
|
||||
@@ -127,8 +138,8 @@ class BG
|
||||
{
|
||||
this.clipx = 0;
|
||||
this.clipy = 0;
|
||||
this.clipx2 = 400;
|
||||
this.clipy2 = 240;
|
||||
this.clipx2 = petitcom.currentDisplay.rect[display].w - 1;
|
||||
this.clipy2 = petitcom.currentDisplay.rect[display].h - 1;
|
||||
}
|
||||
void home(int x, int y)
|
||||
{
|
||||
|
||||
@@ -415,6 +415,16 @@ class PetitComputer
|
||||
}
|
||||
displaynum = 0;
|
||||
console.changeDisplay(currentDisplay);
|
||||
for(int i = 0; i < bgmax; i++)
|
||||
{
|
||||
this.bg[i].display = 0;
|
||||
this.bg[i].clip;
|
||||
}
|
||||
for(int i = bgmax; i < this.bg.length; i++)
|
||||
{
|
||||
this.bg[i].display = 1;
|
||||
this.bg[i].clip;
|
||||
}
|
||||
for (int i = cast(int)currentDisplay.rect.length - 1; i >= 0; i--)
|
||||
{
|
||||
display(i);
|
||||
@@ -647,7 +657,7 @@ class PetitComputer
|
||||
chRenderingDisplay(0);
|
||||
for(int i = 0; i < bgmax; i++)
|
||||
{
|
||||
bg[i].render(currentDisplay.rect[0].w, currentDisplay.rect[0].h);
|
||||
bg[i].render(0, currentDisplay.rect[0].w, currentDisplay.rect[0].h);
|
||||
}
|
||||
}
|
||||
if(currentDisplay.rect.length > 1 && BGvisibles[1])
|
||||
@@ -655,7 +665,7 @@ class PetitComputer
|
||||
chRenderingDisplay(1);
|
||||
for(int i = bgmax; i < bg.length; i++)
|
||||
{
|
||||
bg[i].render(currentDisplay.rect[1].w, currentDisplay.rect[1].h);
|
||||
bg[i].render(1, currentDisplay.rect[1].w, currentDisplay.rect[1].h);
|
||||
}
|
||||
}
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
Reference in New Issue
Block a user