iOS: Fix some input widgets being shifted offscreen

Android: Attempt to show error dialog when EGL context creation fails
Windows: Remove unnecessary Direct3D9Ex S_PRESENT_OCCLUDED result check
This commit is contained in:
UnknownShadow200 2022-06-01 20:18:42 +10:00
parent 5b27d4fc37
commit cb3d8db550
4 changed files with 18 additions and 9 deletions

View File

@ -20,7 +20,7 @@ You can download the game [from here](https://www.classicube.net/download/) and
* It does not reimplement Minecraft Classic versions before 0.30
#### System requirements
* Windows: 98 or later
* Windows: 95 or later
* macOS: 10.5 or later (can be compiled to work with 10.3/10.4 though)
* Linux: libcurl and libopenal
* Android: 2.3 or later

View File

@ -793,12 +793,6 @@ void Gfx_EndFrame(void) {
IDirect3DDevice9_EndScene(device);
cc_result res = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
/* Direct3D9Ex returns S_PRESENT_OCCLUDED when e.g.window is minimised */
if (res == S_PRESENT_OCCLUDED) {
TickReducedPerformance(); return;
}
EndReducedPerformance();
if (res) {
if (res != D3DERR_DEVICELOST) Logger_Abort2(res, "D3D9_EndFrame");
/* TODO: Make sure this actually works on all graphics cards. */

View File

@ -172,9 +172,11 @@ void GLContext_Create(void) {
ctx_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(ctx_display, NULL, NULL);
eglBindAPI(EGL_OPENGL_ES_API);
eglChooseConfig(ctx_display, attribs, &ctx_config, 1, &ctx_numConfig);
eglChooseConfig(ctx_display, attribs, &ctx_config, 1, &ctx_numConfig);
ctx_context = eglCreateContext(ctx_display, ctx_config, EGL_NO_CONTEXT, context_attribs);
if (!ctx_context) Logger_Abort2(eglGetError(), "Failed to create EGL context");
GLContext_InitSurface();
}

View File

@ -105,6 +105,7 @@ static UIInterfaceOrientationMask SupportedOrientations(void) {
}
static cc_bool kb_active;
static UITextField* kb_widget;
- (void)keyboardDidShow:(NSNotification*)notification {
NSDictionary* info = notification.userInfo;
if (kb_active) return;
@ -116,7 +117,14 @@ static cc_bool kb_active;
NSInteger curve = [[info objectForKey:UIKeyboardAnimationCurveUserInfoKey] integerValue];
CGRect kbFrame = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGRect winFrame = view_handle.frame;
winFrame.origin.y = -kbFrame.size.height;
cc_bool can_shift = true;
// would the active input widget be pushed offscreen?
if (kb_widget) {
can_shift = kb_widget.frame.origin.y > kbFrame.size.height;
}
if (can_shift) winFrame.origin.y = -kbFrame.size.height;
kb_widget = nil;
Platform_LogConst("APPEAR");
[UIView animateWithDuration:interval delay: 0.0 options:curve animations:^{
@ -128,6 +136,7 @@ static cc_bool kb_active;
NSDictionary* info = notification.userInfo;
if (!kb_active) return;
kb_active = false;
kb_widget = nil;
double interval = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
NSInteger curve = [[info objectForKey:UIKeyboardAnimationCurveUserInfoKey] integerValue];
@ -725,6 +734,10 @@ static NSString* cellID = @"CC_Cell";
return YES;
}
- (void)textFieldDidBeginEditing:(UITextField *)textField {
kb_widget = textField;
}
@end
static CCUIController* ui_controller;