Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions project/src/backend/sdl/SDLWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ());
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

}

Expand Down
19 changes: 11 additions & 8 deletions src/lime/_internal/backend/native/NativeWindow.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down