Fix XSCREEN 5,6
This commit is contained in:
@@ -19,6 +19,7 @@ enum DrawType
|
||||
PAINT,
|
||||
CLIPWRITE,
|
||||
PUTCHR,
|
||||
INIT,
|
||||
}
|
||||
struct Circle
|
||||
{
|
||||
@@ -68,14 +69,24 @@ class Graphic
|
||||
{
|
||||
petitcom = p;
|
||||
paint = new Paint();
|
||||
setSize(512, 512);
|
||||
width = 512;
|
||||
height = 512;
|
||||
//nnnue
|
||||
paint.buffer = new uint[width * height];
|
||||
}
|
||||
void setSize(int w, int h)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
//nnnue
|
||||
paint.buffer = new uint[width * height];
|
||||
initGraphicPages();/*
|
||||
DrawMessage dm;
|
||||
dm.type = DrawType.INIT;
|
||||
sendDrawMessage(dm);*/
|
||||
}
|
||||
void getSize(out int w, out int h)
|
||||
{
|
||||
w = width;
|
||||
h = height;
|
||||
}
|
||||
void initGraphicPages()
|
||||
{
|
||||
@@ -88,11 +99,20 @@ class Graphic
|
||||
GRP[4] = createGRPF(petitcom.spriteFile);
|
||||
GRP[5] = createGRPF(petitcom.BGFile);
|
||||
}
|
||||
void initGLGraphicPages()
|
||||
{
|
||||
foreach(g; GRP)
|
||||
{
|
||||
g.createTexture(petitcom.renderer, petitcom.textureScaleMode);
|
||||
g.createBuffer();
|
||||
}
|
||||
petitcom.console.GRPF.createTexture(petitcom.renderer, petitcom.textureScaleMode);
|
||||
}
|
||||
GraphicPage createGRPF(string file)
|
||||
{
|
||||
SDL_RWops* stream = SDL_RWFromFile(toStringz(file), toStringz("rb"));
|
||||
auto src = IMG_Load_RW(stream, 0);
|
||||
SDL_Surface* surface = SDL_CreateRGBSurface(0, src.w, src.h, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);//0xff000000, 0x00ff0000, 0x0000ff00, 0xFF);
|
||||
SDL_Surface* surface = SDL_CreateRGBSurface(0, width, height, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);//0xff000000, 0x00ff0000, 0x0000ff00, 0xFF);
|
||||
SDL_Rect rect;
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
@@ -403,6 +423,10 @@ class Graphic
|
||||
}
|
||||
void draw()
|
||||
{
|
||||
if (!GRP[0].glTexture)
|
||||
{
|
||||
initGLGraphicPages();
|
||||
}
|
||||
if(!drawMessageLength) return;
|
||||
drawflag = true;
|
||||
//betuni kouzoutai demo sonnnani sokudo kawaranasasou
|
||||
@@ -533,6 +557,7 @@ class Graphic
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
if(SDL_GetTicks() - start >= 16 && i != len - 1)
|
||||
|
||||
@@ -402,6 +402,17 @@ class PetitComputer
|
||||
currentDisplay = Display([display0, display1], Size(std.algorithm.max(resolutionTable[gamepad].width, resolutionTable[tv].width), resolutionTable[gamepad].height + resolutionTable[tv].height));
|
||||
xscreenmode = 4;
|
||||
}
|
||||
int grpw, grph;
|
||||
graphic.getSize(grpw, grph);
|
||||
//1024*1024?
|
||||
if ((mode == 5 || mode == 6) && (grpw != 1024 || grph != 1024))
|
||||
{
|
||||
graphic.setSize(1024, 1024);
|
||||
}
|
||||
else if (grpw != 512 || grph != 512)
|
||||
{
|
||||
graphic.setSize(512, 512);
|
||||
}
|
||||
displaynum = 0;
|
||||
console.changeDisplay(currentDisplay);
|
||||
for (int i = cast(int)currentDisplay.rect.length - 1; i >= 0; i--)
|
||||
@@ -539,7 +550,6 @@ class PetitComputer
|
||||
writeln(SDL_GetError.to!string);
|
||||
return;
|
||||
}
|
||||
console.GRPF.createTexture(renderer, textureScaleMode);
|
||||
chScreen(0, 0, 400, 240);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -557,11 +567,7 @@ class PetitComputer
|
||||
}
|
||||
int loopcnt;
|
||||
DerelictGL3.reload();
|
||||
foreach(g; graphic.GRP)
|
||||
{
|
||||
g.createTexture(renderer, textureScaleMode);
|
||||
g.createBuffer();
|
||||
}
|
||||
//3graphic.initGLGraphicPages();
|
||||
//glEnable(GL_BLEND);
|
||||
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
//glAlphaFunc(GL_GEQUAL, 0.5);
|
||||
|
||||
Reference in New Issue
Block a user