mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 10:35:11 -04:00
Switch: Respond to exit requests and avoid relying on assumptions about stride of framebuffer
This commit is contained in:
parent
34d2e868fc
commit
b548cfa231
@ -44,6 +44,9 @@ static void Applet_Event(AppletHookType type, void* param) {
|
|||||||
if (type == AppletHookType_OnOperationMode) {
|
if (type == AppletHookType_OnOperationMode) {
|
||||||
SetResolution();
|
SetResolution();
|
||||||
Event_RaiseVoid(&WindowEvents.Resized);
|
Event_RaiseVoid(&WindowEvents.Resized);
|
||||||
|
} else if (type == AppletHookType_OnExitRequest) {
|
||||||
|
Window_Main.Exists = false;
|
||||||
|
Window_RequestClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,13 +150,11 @@ static void ProcessTouchInput(void) {
|
|||||||
currX = state.touches[0].x;
|
currX = state.touches[0].x;
|
||||||
currY = state.touches[0].y;
|
currY = state.touches[0].y;
|
||||||
Input_AddTouch(0, currX, currY);
|
Input_AddTouch(0, currX, currY);
|
||||||
}
|
} else if (state.count) { // stylus is down
|
||||||
else if (state.count) { // stylus is down
|
|
||||||
currX = state.touches[0].x;
|
currX = state.touches[0].x;
|
||||||
currY = state.touches[0].y;
|
currY = state.touches[0].y;
|
||||||
Input_UpdateTouch(0, currX, currY);
|
Input_UpdateTouch(0, currX, currY);
|
||||||
}
|
} else if (!state.count && prev_touchcount) { // stylus was lifted
|
||||||
else if (!state.count && prev_touchcount) { // stylus was lifted
|
|
||||||
Input_RemoveTouch(0, currX, currY);
|
Input_RemoveTouch(0, currX, currY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,10 +207,12 @@ void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
|
|||||||
// flip upside down
|
// flip upside down
|
||||||
for (cc_uint32 y = r.y; y < r.y + r.Height; y++)
|
for (cc_uint32 y = r.y; y < r.y + r.Height; y++)
|
||||||
{
|
{
|
||||||
|
BitmapCol* src = Bitmap_GetRow(bmp, y);
|
||||||
|
cc_uint32* dst = framebuf + y * stride / sizeof(cc_uint32);
|
||||||
|
|
||||||
for (cc_uint32 x = r.x; x < r.x + r.Width; x++)
|
for (cc_uint32 x = r.x; x < r.x + r.Width; x++)
|
||||||
{
|
{
|
||||||
cc_uint32 pos = y * stride / sizeof(cc_uint32) + x;
|
dst[x] = src[x];
|
||||||
framebuf[pos] = bmp->scan0[pos];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ void GLContext_Create(void) {
|
|||||||
#elif defined CC_BUILD_GLES
|
#elif defined CC_BUILD_GLES
|
||||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
|
||||||
#else
|
#else
|
||||||
#error "Can't determine appropriate EGL_RENDERABLE_TYPE"
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||||
#endif
|
#endif
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user