diff --git a/project/src/backend/sdl/SDLWindow.cpp b/project/src/backend/sdl/SDLWindow.cpp index 07cd39693b..ebae078944 100644 --- a/project/src/backend/sdl/SDLWindow.cpp +++ b/project/src/backend/sdl/SDLWindow.cpp @@ -323,6 +323,15 @@ namespace lime { } #endif + if (!sdlWindow && (flags & (WINDOW_FLAG_HW_AA | WINDOW_FLAG_HW_AA_HIRES))) { + + // Retry without antialiasing - emulators and some devices don't support MSAA + SDL_GL_SetAttribute (SDL_GL_MULTISAMPLEBUFFERS, 0); + SDL_GL_SetAttribute (SDL_GL_MULTISAMPLESAMPLES, 0); + sdlWindow = SDL_CreateWindow (title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, sdlWindowFlags); + + } + if (!sdlWindow) { printf ("Could not create SDL window: %s.\n", SDL_GetError ()); @@ -797,10 +806,9 @@ namespace lime { int SDLWindow::GetHeight () { - int width; - int height; + int height = 0; - SDL_GetWindowSize (sdlWindow, &width, &height); + SDL_GetWindowSize (sdlWindow, NULL, &height); return height; @@ -880,10 +888,9 @@ namespace lime { int SDLWindow::GetWidth () { - int width; - int height; + int width = 0; - SDL_GetWindowSize (sdlWindow, &width, &height); + SDL_GetWindowSize (sdlWindow, &width, NULL); return width; @@ -1439,7 +1446,16 @@ namespace lime { Window* CreateWindow (Application* application, int width, int height, int flags, const char* title) { - return new SDLWindow (application, width, height, flags, title); + SDLWindow* window = new SDLWindow (application, width, height, flags, title); + + if (!window->sdlWindow) { + + delete window; + return nullptr; + + } + + return window; } diff --git a/src/lime/_internal/backend/native/NativeWindow.hx b/src/lime/_internal/backend/native/NativeWindow.hx index 0f6028a296..630149e42a 100644 --- a/src/lime/_internal/backend/native/NativeWindow.hx +++ b/src/lime/_internal/backend/native/NativeWindow.hx @@ -115,17 +115,20 @@ class NativeWindow #if (!macro && lime_cffi) handle = NativeCFFI.lime_window_create(parent.application.__backend.handle, width, height, flags, title); - if (handle != null) + if (handle == null) { - parent.__width = NativeCFFI.lime_window_get_width(handle); + frameRate = resolvedFrameRate; + return; + } - parent.__height = NativeCFFI.lime_window_get_height(handle); - parent.__x = NativeCFFI.lime_window_get_x(handle); - parent.__y = NativeCFFI.lime_window_get_y(handle); - parent.__hidden = (Reflect.hasField(attributes, "hidden") && attributes.hidden); + parent.__width = NativeCFFI.lime_window_get_width(handle); - parent.id = NativeCFFI.lime_window_get_id(handle); - } + parent.__height = NativeCFFI.lime_window_get_height(handle); + parent.__x = NativeCFFI.lime_window_get_x(handle); + parent.__y = NativeCFFI.lime_window_get_y(handle); + parent.__hidden = (Reflect.hasField(attributes, "hidden") && attributes.hidden); + + parent.id = NativeCFFI.lime_window_get_id(handle); parent.__scale = NativeCFFI.lime_window_get_scale(handle); var context = new RenderContext();