mirror of https://github.com/mgba-emu/mgba.git
GBA Video: Add window y offsetting
This commit is contained in:
parent
c8e1e14d3f
commit
4aed125b3e
|
@ -120,6 +120,8 @@ struct GBAVideoSoftwareRenderer {
|
||||||
struct GBAVideoWindowRegion h;
|
struct GBAVideoWindowRegion h;
|
||||||
struct GBAVideoWindowRegion v;
|
struct GBAVideoWindowRegion v;
|
||||||
struct WindowControl control;
|
struct WindowControl control;
|
||||||
|
int16_t offsetX;
|
||||||
|
int16_t offsetY;
|
||||||
} winN[2];
|
} winN[2];
|
||||||
|
|
||||||
struct WindowControl winout;
|
struct WindowControl winout;
|
||||||
|
|
|
@ -1099,6 +1099,10 @@ static void _GBACoreAdjustVideoLayer(struct mCore* core, size_t id, int32_t x, i
|
||||||
gbacore->renderer.objOffsetY = y;
|
gbacore->renderer.objOffsetY = y;
|
||||||
gbacore->renderer.oamDirty = 1;
|
gbacore->renderer.oamDirty = 1;
|
||||||
break;
|
break;
|
||||||
|
case GBA_LAYER_WIN0:
|
||||||
|
gbacore->renderer.winN[id - GBA_LAYER_WIN0].offsetX = x;
|
||||||
|
gbacore->renderer.winN[id - GBA_LAYER_WIN0].offsetY = y;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -443,13 +443,13 @@ static void GBAVideoSoftwareRendererWritePalette(struct GBAVideoRenderer* render
|
||||||
|
|
||||||
static void _breakWindow(struct GBAVideoSoftwareRenderer* softwareRenderer, struct WindowN* win, int y) {
|
static void _breakWindow(struct GBAVideoSoftwareRenderer* softwareRenderer, struct WindowN* win, int y) {
|
||||||
if (win->v.end >= win->v.start) {
|
if (win->v.end >= win->v.start) {
|
||||||
if (y >= win->v.end) {
|
if (y >= win->v.end + win->offsetY) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (y < win->v.start) {
|
if (y < win->v.start + win->offsetY) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (y >= win->v.end && y < win->v.start) {
|
} else if (y >= win->v.end + win->offsetY && y < win->v.start + win->offsetY) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (win->h.end > GBA_VIDEO_HORIZONTAL_PIXELS || win->h.end < win->h.start) {
|
if (win->h.end > GBA_VIDEO_HORIZONTAL_PIXELS || win->h.end < win->h.start) {
|
||||||
|
|
Loading…
Reference in New Issue