Implement VISIBLE
This commit is contained in:
@@ -268,8 +268,17 @@ class BuiltinFunction
|
|||||||
}
|
}
|
||||||
return p.button;
|
return p.button;
|
||||||
}
|
}
|
||||||
static void VISIBLE(PetitComputer p, DefaultValue!(int) console, DefaultValue!(int) graphic, DefaultValue!(int) BG, DefaultValue!(int) sprite)
|
static void VISIBLE(PetitComputer p, int console, int graphic, int BG, int sprite)
|
||||||
{
|
{
|
||||||
|
import std.exception : enforce;
|
||||||
|
enforce(console == 0 || console == 1, new OutOfRange("VISIBLE", 1));
|
||||||
|
enforce(graphic == 0 || graphic == 1, new OutOfRange("VISIBLE", 2));
|
||||||
|
enforce(BG == 0 || BG == 1, new OutOfRange("VISIBLE", 3));
|
||||||
|
enforce(sprite == 0 || sprite == 1, new OutOfRange("VISIBLE", 4));
|
||||||
|
p.console.visible = cast(bool)console;
|
||||||
|
p.graphic.visible = cast(bool)graphic;
|
||||||
|
p.BGvisible = cast(bool)BG;
|
||||||
|
p.sprite.visible = cast(bool)sprite;
|
||||||
}
|
}
|
||||||
static void XON(PetitComputer p, Value mode/*!?!???!?*/)
|
static void XON(PetitComputer p, Value mode/*!?!???!?*/)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,6 +75,15 @@ class Console
|
|||||||
SDL_Rect[] fontTable = new SDL_Rect[65536];
|
SDL_Rect[] fontTable = new SDL_Rect[65536];
|
||||||
GraphicPage GRPF;
|
GraphicPage GRPF;
|
||||||
PetitComputer petitcom;
|
PetitComputer petitcom;
|
||||||
|
bool[2] visibles = [true, true];
|
||||||
|
bool visible()
|
||||||
|
{
|
||||||
|
return visibles[petitcom.displaynum];
|
||||||
|
}
|
||||||
|
void visible(bool value)
|
||||||
|
{
|
||||||
|
visibles[petitcom.displaynum] = value;
|
||||||
|
}
|
||||||
this(PetitComputer p)
|
this(PetitComputer p)
|
||||||
{
|
{
|
||||||
petitcom = p;
|
petitcom = p;
|
||||||
@@ -253,7 +262,7 @@ class Console
|
|||||||
}
|
}
|
||||||
void render()
|
void render()
|
||||||
{
|
{
|
||||||
if(petitcom.xscreenmode == 2)
|
if(petitcom.xscreenmode == 2 && (visibles[0] || showCursor)/*XSCREEN4*/)
|
||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
|
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
@@ -291,80 +300,86 @@ class Console
|
|||||||
glEnd();
|
glEnd();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
|
if (showCursor || visibles[0])
|
||||||
glDisable(GL_TEXTURE_2D);
|
{
|
||||||
glBegin(GL_QUADS);
|
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
|
||||||
for(int y = 0; y < consoleHeight; y++)
|
glDisable(GL_TEXTURE_2D);
|
||||||
for(int x = 0; x < consoleWidth; x++)
|
glBegin(GL_QUADS);
|
||||||
{
|
for(int y = 0; y < consoleHeight; y++)
|
||||||
auto back = consoleColorGL[console[y][x].backColor];
|
for(int x = 0; x < consoleWidth; x++)
|
||||||
if(back)
|
|
||||||
{
|
{
|
||||||
glColor4ubv(cast(ubyte*)&back);
|
auto back = consoleColorGL[console[y][x].backColor];
|
||||||
glVertex3f(x * 8, y * 8 + 8, 1024);
|
if(back)
|
||||||
glVertex3f(x * 8, y * 8, 1024);
|
{
|
||||||
glVertex3f(x * 8 + 8, y * 8, 1024);
|
glColor4ubv(cast(ubyte*)&back);
|
||||||
glVertex3f(x * 8 + 8, y * 8 + 8, 1024);
|
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(petitcom.displaynum == 0 && showCursor && animationCursor)
|
||||||
|
{
|
||||||
|
glColor4ubv(cast(ubyte*)&consoleColorGL[15]);
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
if(petitcom.displaynum == 0 && showCursor && animationCursor)
|
glEnd();
|
||||||
{
|
glEnable(GL_TEXTURE_2D);
|
||||||
glColor4ubv(cast(ubyte*)&consoleColorGL[15]);
|
|
||||||
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);
|
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
for(int y = 0; y < consoleHeight; y++)
|
for(int y = 0; y < consoleHeight; y++)
|
||||||
for(int x = 0; x < consoleWidth; x++)
|
for(int x = 0; x < consoleWidth; x++)
|
||||||
{
|
|
||||||
drawCharacter(x, y, console[y][x]);
|
|
||||||
}
|
|
||||||
glEnd();
|
|
||||||
if(petitcom.xscreenmode != 1)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//下画面
|
|
||||||
petitcom.chScreen(40, 0, 400, 240);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
glBegin(GL_QUADS);
|
|
||||||
for(int y = 0; y < consoleHeightDisplay1; y++)
|
|
||||||
for(int x = 0; x < consoleWidthDisplay1; x++)
|
|
||||||
{
|
|
||||||
auto back = consoleColorGL[consoleDisplay1[y][x].backColor];
|
|
||||||
if(back)
|
|
||||||
{
|
{
|
||||||
glColor4ubv(cast(ubyte*)&back);
|
drawCharacter(x, y, console[y][x]);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
glEnd();
|
||||||
if(petitcom.displaynum == 1 && showCursor && animationCursor)
|
if(petitcom.xscreenmode != 1)
|
||||||
{
|
|
||||||
glColor4ubv(cast(ubyte*)&consoleColorGL[15]);
|
|
||||||
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);
|
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
|
||||||
for(int y = 0; y < consoleHeightDisplay1; y++)
|
|
||||||
for(int x = 0; x < consoleWidthDisplay1; x++)
|
|
||||||
{
|
{
|
||||||
drawCharacter(x, y, consoleDisplay1[y][x]);
|
return;
|
||||||
}
|
}
|
||||||
glEnd();
|
}
|
||||||
|
if (visibles[1] || showCursor)
|
||||||
|
{
|
||||||
|
//下画面
|
||||||
|
petitcom.chScreen(40, 0, 400, 240);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, GRPF.glTexture);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
for(int y = 0; y < consoleHeightDisplay1; y++)
|
||||||
|
for(int x = 0; x < consoleWidthDisplay1; x++)
|
||||||
|
{
|
||||||
|
auto back = consoleColorGL[consoleDisplay1[y][x].backColor];
|
||||||
|
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(petitcom.displaynum == 1 && showCursor && animationCursor)
|
||||||
|
{
|
||||||
|
glColor4ubv(cast(ubyte*)&consoleColorGL[15]);
|
||||||
|
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);
|
||||||
|
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
for(int y = 0; y < consoleHeightDisplay1; y++)
|
||||||
|
for(int x = 0; x < consoleWidthDisplay1; x++)
|
||||||
|
{
|
||||||
|
drawCharacter(x, y, consoleDisplay1[y][x]);
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void print(T...)(T args)
|
void print(T...)(T args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,9 +15,17 @@ class Graphic
|
|||||||
paint.buffer = new uint[512 * 512];
|
paint.buffer = new uint[512 * 512];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool visibleGRP = true;
|
bool[2] visibles = [true, true];
|
||||||
private int[2] showPage = [0, 1];
|
private int[2] showPage = [0, 1];
|
||||||
private int[2] usePage = [0, 1];
|
private int[2] usePage = [0, 1];
|
||||||
|
bool visible()
|
||||||
|
{
|
||||||
|
return visibles[petitcom.displaynum];
|
||||||
|
}
|
||||||
|
void visible(bool value)
|
||||||
|
{
|
||||||
|
visibles[petitcom.displaynum] = value;
|
||||||
|
}
|
||||||
@property int useGRP()
|
@property int useGRP()
|
||||||
{
|
{
|
||||||
return usePage[petitcom.displaynum];
|
return usePage[petitcom.displaynum];
|
||||||
@@ -471,6 +479,8 @@ class Graphic
|
|||||||
int gprio;
|
int gprio;
|
||||||
void render(int display, float w, float h)
|
void render(int display, float w, float h)
|
||||||
{
|
{
|
||||||
|
if (!visibles[display])
|
||||||
|
return;
|
||||||
float z = gprio;
|
float z = gprio;
|
||||||
glColor3f(1.0, 1.0, 1.0);
|
glColor3f(1.0, 1.0, 1.0);
|
||||||
glBindTexture(GL_TEXTURE_2D, GRP[showPage[display]].glTexture);
|
glBindTexture(GL_TEXTURE_2D, GRP[showPage[display]].glTexture);
|
||||||
|
|||||||
@@ -413,6 +413,15 @@ class PetitComputer
|
|||||||
{
|
{
|
||||||
return bg;
|
return bg;
|
||||||
}
|
}
|
||||||
|
bool[2] BGvisibles = [true, true];
|
||||||
|
bool BGvisible()
|
||||||
|
{
|
||||||
|
return BGvisibles[displaynum];
|
||||||
|
}
|
||||||
|
void BGvisible(bool value)
|
||||||
|
{
|
||||||
|
BGvisibles[displaynum] = value;
|
||||||
|
}
|
||||||
protected BG[4] bg;
|
protected BG[4] bg;
|
||||||
bool quit;
|
bool quit;
|
||||||
Condition renderCondition;
|
Condition renderCondition;
|
||||||
@@ -586,7 +595,7 @@ class PetitComputer
|
|||||||
version(test) glLoadIdentity();
|
version(test) glLoadIdentity();
|
||||||
version(test) glRotatef(rot_test_deg, rot_test_x, rot_test_y, rot_test_z);
|
version(test) glRotatef(rot_test_deg, rot_test_x, rot_test_y, rot_test_z);
|
||||||
glBindTexture(GL_TEXTURE_2D, graphic.GRP[bgpage].glTexture);
|
glBindTexture(GL_TEXTURE_2D, graphic.GRP[bgpage].glTexture);
|
||||||
if(xscreenmode == 2)
|
if(xscreenmode == 2 && BGvisibles[0])
|
||||||
{
|
{
|
||||||
for(int i = 0; i < bgmax; i++)
|
for(int i = 0; i < bgmax; i++)
|
||||||
{
|
{
|
||||||
@@ -595,16 +604,22 @@ class PetitComputer
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(int i = 0; i < bgmax; i++)
|
if (BGvisibles[0])
|
||||||
{
|
{
|
||||||
bg[i].render(400f, 240f);
|
for(int i = 0; i < bgmax; i++)
|
||||||
|
{
|
||||||
|
bg[i].render(400f, 240f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(xscreenmode == 1)
|
if(xscreenmode == 1)
|
||||||
{
|
{
|
||||||
chScreen(40, 0, 320, 240);
|
if (BGvisibles[1])
|
||||||
for(int i = bgmax; i < bg.length; i++)
|
|
||||||
{
|
{
|
||||||
bg[i].render(320f, 240f);
|
chScreen(40, 0, 320, 240);
|
||||||
|
for(int i = bgmax; i < bg.length; i++)
|
||||||
|
{
|
||||||
|
bg[i].render(320f, 240f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
chScreen(0, 240, 400, 240);
|
chScreen(0, 240, 400, 240);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -300,6 +300,15 @@ class Sprite
|
|||||||
PetitComputer petitcom;
|
PetitComputer petitcom;
|
||||||
string spdefTableFile = "spdef.csv";
|
string spdefTableFile = "spdef.csv";
|
||||||
int spmax = 512;
|
int spmax = 512;
|
||||||
|
bool[2] visibles = [true, true];
|
||||||
|
bool visible()
|
||||||
|
{
|
||||||
|
return visibles[petitcom.displaynum];
|
||||||
|
}
|
||||||
|
void visible(bool value)
|
||||||
|
{
|
||||||
|
visibles[petitcom.displaynum] = value;
|
||||||
|
}
|
||||||
void initUVTable()
|
void initUVTable()
|
||||||
{
|
{
|
||||||
SPDEFTable = new SpriteDef[4096];
|
SPDEFTable = new SpriteDef[4096];
|
||||||
@@ -558,6 +567,17 @@ class Sprite
|
|||||||
SpriteBucket* bucketsptr;
|
SpriteBucket* bucketsptr;
|
||||||
void render()
|
void render()
|
||||||
{
|
{
|
||||||
|
if (!visibles[0] && !visibles[1])
|
||||||
|
{
|
||||||
|
foreach(ref sprite; sprites)
|
||||||
|
{
|
||||||
|
if(sprite.define)
|
||||||
|
{
|
||||||
|
animation(&sprite);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
//とりあえずZ更新されたら描画時にまとめてソート
|
//とりあえずZ更新されたら描画時にまとめてソート
|
||||||
//thread safe.....
|
//thread safe.....
|
||||||
if(zChange)
|
if(zChange)
|
||||||
@@ -648,6 +668,8 @@ class Sprite
|
|||||||
{
|
{
|
||||||
if(!dis && sprite.id >= spmax)
|
if(!dis && sprite.id >= spmax)
|
||||||
{
|
{
|
||||||
|
if (!visibles[1])
|
||||||
|
continue;
|
||||||
disw = 160f;
|
disw = 160f;
|
||||||
disw2 = 320f;
|
disw2 = 320f;
|
||||||
petitcom.chScreen(40, 0, 320, 240);
|
petitcom.chScreen(40, 0, 320, 240);
|
||||||
@@ -658,6 +680,8 @@ class Sprite
|
|||||||
{
|
{
|
||||||
if(sprite.id < spmax && dis)
|
if(sprite.id < spmax && dis)
|
||||||
{
|
{
|
||||||
|
if (!visibles[0])
|
||||||
|
continue;
|
||||||
disw = 200f;
|
disw = 200f;
|
||||||
disw2 = 400f;
|
disw2 = 400f;
|
||||||
petitcom.chScreen(0, 240, 400, 240);
|
petitcom.chScreen(0, 240, 400, 240);
|
||||||
|
|||||||
Reference in New Issue
Block a user