Implement BG/SPPAGE
This commit is contained in:
@@ -1339,6 +1339,18 @@ class BuiltinFunction
|
||||
{
|
||||
return p.sprite.spchk(id);
|
||||
}
|
||||
static void SPPAGE(PetitComputer p, int page)
|
||||
{
|
||||
if (!p.isValidGraphicPage(page))
|
||||
{
|
||||
throw new OutOfRange("SPPAGE", 1);
|
||||
}
|
||||
p.sprite.sppage = page;
|
||||
}
|
||||
static int SPPAGE(PetitComputer p)
|
||||
{
|
||||
return p.sprite.sppage;
|
||||
}
|
||||
static void BGMSTOP(PetitComputer p)
|
||||
{
|
||||
writeln("NOTIMPL:BGMSTOP");
|
||||
@@ -1486,6 +1498,18 @@ class BuiltinFunction
|
||||
{
|
||||
p.getBG(layer).fill(x, y, x2, y2, screendata);
|
||||
}
|
||||
static void BGPAGE(PetitComputer p, int page)
|
||||
{
|
||||
if (!p.isValidGraphicPage(page))
|
||||
{
|
||||
throw new OutOfRange("BGPAGE", 1);
|
||||
}
|
||||
p.bgpage = page;
|
||||
}
|
||||
static int BGPAGE(PetitComputer p)
|
||||
{
|
||||
return p.bgpage;
|
||||
}
|
||||
static void EFCON()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ class PetitComputer
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
int sppage, bgpage;
|
||||
int bgpage;
|
||||
Projects project;
|
||||
wstring currentProject;
|
||||
void init()
|
||||
@@ -453,6 +453,7 @@ class PetitComputer
|
||||
{
|
||||
return bg;
|
||||
}
|
||||
//TODO:extract class
|
||||
bool[2] BGvisibles = [true, true];
|
||||
bool BGvisible()
|
||||
{
|
||||
@@ -508,7 +509,7 @@ class PetitComputer
|
||||
{
|
||||
graphic.GRP[i] = createEmptyPage();
|
||||
}
|
||||
sppage = 4;
|
||||
sprite.sppage = 4;
|
||||
graphic.GRP[4] = createGRPF(spriteFile);
|
||||
bgpage = 5;
|
||||
graphic.GRP[5] = createGRPF(BGFile);
|
||||
@@ -848,7 +849,6 @@ class PetitComputer
|
||||
keybuffer = new Key[128];
|
||||
init();
|
||||
graphic = new Graphic(this);
|
||||
consolem = new Mutex();
|
||||
keybuffermutex = new Mutex();
|
||||
grpmutex = new Mutex();
|
||||
sprite = new Sprite(this);
|
||||
@@ -1232,7 +1232,10 @@ class PetitComputer
|
||||
keybufferlen--;
|
||||
return result.key.to!wstring;
|
||||
}
|
||||
Mutex consolem;
|
||||
public bool isValidGraphicPage(int page)
|
||||
{
|
||||
return page >= 0 && page < 6;
|
||||
}
|
||||
//プチコン内部表現はRGB5_A1
|
||||
static uint toGLColor(GLenum format, ubyte r, ubyte g, ubyte b, ubyte a)
|
||||
{
|
||||
|
||||
@@ -584,6 +584,7 @@ class Sprite
|
||||
SpriteBucket[] buckets;
|
||||
SpriteBucket* listptr;
|
||||
SpriteBucket* bucketsptr;
|
||||
int sppage;
|
||||
void render()
|
||||
{
|
||||
if ((!visibles[0] && !visibles[1]) || (petitcom.xscreenmode == 2 && !visibles[0]))
|
||||
@@ -665,7 +666,7 @@ class Sprite
|
||||
dish2 = 480f;
|
||||
dis = -1;
|
||||
}
|
||||
auto texture = petitcom.graphic.GRP[petitcom.sppage].glTexture;
|
||||
auto texture = petitcom.graphic.GRP[sppage].glTexture;
|
||||
float aspect = disw2 / dish2;
|
||||
float z = -0.01f;
|
||||
int spmax = petitcom.xscreenmode == 1 ? this.spmax : 512;//XSCREENが2,3じゃないと下画面は描画しない
|
||||
|
||||
Reference in New Issue
Block a user