Index: src/Cube.mm ================================================================== --- src/Cube.mm +++ src/Cube.mm @@ -14,20 +14,10 @@ + (Cube *)sharedInstance { return (Cube *)OFApplication.sharedApplication.delegate; } -- (instancetype)init -{ - self = [super init]; - - _width = 1920; - _height = 1080; - - return self; -} - - (void)applicationDidFinishLaunching:(OFNotification *)notification { bool dedicated, windowed; int par = 0, uprate = 0, maxcl = 4; OFString *__autoreleasing sdesc, *__autoreleasing ip; @@ -95,10 +85,22 @@ empty_world(7, true); log(@"video: sdl"); if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) fatal(@"Unable to initialize SDL Video"); + + if (_width == 0 || _height == 0) { + SDL_DisplayMode mode; + + if (SDL_GetDesktopDisplayMode(0, &mode) == 0) { + _width = mode.w; + _height = mode.h; + } else { + _width = 1920; + _height = 1080; + } + } log(@"video: mode"); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); if ((_window = SDL_CreateWindow("cube engine", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, _width, _height,