Default to desktop resolution
FossilOrigin-Name: fd3bba533240e7de2e6ddec834f937cdcbcda3051229d035c2c0ad4030cb47dc
This commit is contained in:
parent
c6eebefd77
commit
5635fb24b6
1 changed files with 12 additions and 10 deletions
22
src/Cube.mm
22
src/Cube.mm
|
@ -16,16 +16,6 @@ VARP(minmillis, 0, 5, 1000);
|
||||||
return (Cube *)OFApplication.sharedApplication.delegate;
|
return (Cube *)OFApplication.sharedApplication.delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)init
|
|
||||||
{
|
|
||||||
self = [super init];
|
|
||||||
|
|
||||||
_width = 1920;
|
|
||||||
_height = 1080;
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(OFNotification *)notification
|
- (void)applicationDidFinishLaunching:(OFNotification *)notification
|
||||||
{
|
{
|
||||||
bool dedicated, windowed;
|
bool dedicated, windowed;
|
||||||
|
@ -98,6 +88,18 @@ VARP(minmillis, 0, 5, 1000);
|
||||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
|
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
|
||||||
fatal(@"Unable to initialize SDL Video");
|
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");
|
log("video: mode");
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
if ((_window = SDL_CreateWindow("cube engine", SDL_WINDOWPOS_UNDEFINED,
|
if ((_window = SDL_CreateWindow("cube engine", SDL_WINDOWPOS_UNDEFINED,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue