Implement GSPOIT
This commit is contained in:
@@ -534,6 +534,10 @@ class BuiltinFunction
|
|||||||
throw new TypeMismatch("GPUTCHR", 3);
|
throw new TypeMismatch("GPUTCHR", 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static int GSPOIT(PetitComputer p, int x, int y)
|
||||||
|
{
|
||||||
|
return p.graphic.gspoit(p.graphic.useGRP, x, y);
|
||||||
|
}
|
||||||
static void BGMPLAY(PetitComputer p, int music)
|
static void BGMPLAY(PetitComputer p, int music)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -429,8 +429,10 @@ class Graphic
|
|||||||
{
|
{
|
||||||
SDL_GL_MakeCurrent(petitcom.window, petitcom.contextVM);
|
SDL_GL_MakeCurrent(petitcom.window, petitcom.contextVM);
|
||||||
glAlphaFunc(GL_GEQUAL, 0.1f);
|
glAlphaFunc(GL_GEQUAL, 0.1f);
|
||||||
glEnable(GL_ALPHA_TEST);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
void draw2()
|
void draw2()
|
||||||
{
|
{
|
||||||
@@ -451,9 +453,6 @@ class Graphic
|
|||||||
GLint old;
|
GLint old;
|
||||||
int oldpage = drawMessageQueue[0].page;
|
int oldpage = drawMessageQueue[0].page;
|
||||||
glBindFramebufferEXT(GL_FRAMEBUFFER, this.GRP[oldpage].buffer);
|
glBindFramebufferEXT(GL_FRAMEBUFFER, this.GRP[oldpage].buffer);
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
glDisable(GL_ALPHA_TEST);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
|
|
||||||
//glAlphaFunc(GL_GEQUAL, 0.0);
|
//glAlphaFunc(GL_GEQUAL, 0.0);
|
||||||
void chScreen(int x, int y, int w, int h)
|
void chScreen(int x, int y, int w, int h)
|
||||||
@@ -559,6 +558,9 @@ class Graphic
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
DrawMessage[] drawMessageQueue = new DrawMessage[1];
|
DrawMessage[] drawMessageQueue = new DrawMessage[1];
|
||||||
int drawMessageLength;
|
int drawMessageLength;
|
||||||
@@ -675,6 +677,15 @@ class Graphic
|
|||||||
dm.display = cast(byte)petitcom.displaynum;
|
dm.display = cast(byte)petitcom.displaynum;
|
||||||
sendDrawMessage(dm);
|
sendDrawMessage(dm);
|
||||||
}
|
}
|
||||||
|
int gspoit(int page, int x, int y)
|
||||||
|
{
|
||||||
|
glBindFramebufferEXT(GL_FRAMEBUFFER, this.GRP[page].buffer);
|
||||||
|
int ui;
|
||||||
|
//flush
|
||||||
|
updateVM();
|
||||||
|
glReadPixels(x, y, 1, 1, GRP[page].textureFormat, GL_UNSIGNED_BYTE, &ui);
|
||||||
|
return ui;
|
||||||
|
}
|
||||||
int gprio;
|
int gprio;
|
||||||
void render()
|
void render()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user