Skip to content

Commit

Permalink
Extended init_desc to have more options for window flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
holoeye-photonics committed Apr 26, 2017
1 parent 2325055 commit 9919de7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
14 changes: 12 additions & 2 deletions oxygine/src/core/oxygine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ namespace oxygine
log::messageln("SDL build");


SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1");
SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, desc.allow_screensaver ? "1" : "0");

SDL_Init(SDL_INIT_VIDEO);

Expand Down Expand Up @@ -368,11 +368,21 @@ namespace oxygine

SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);

int flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;
int flags = SDL_WINDOW_OPENGL;

#if TARGET_OS_IPHONE
flags |= SDL_WINDOW_SHOWN;
flags |= SDL_WINDOW_BORDERLESS;
flags |= SDL_WINDOW_ALLOW_HIGHDPI;
#else
if(desc.show_window)
flags |= SDL_WINDOW_SHOWN;

if(desc.borderless)
flags |= SDL_WINDOW_BORDERLESS;

if(desc.resizable)
flags |= SDL_WINDOW_RESIZABLE;
#endif

//SDL_DisplayMode mode;
Expand Down
25 changes: 17 additions & 8 deletions oxygine/src/core/oxygine.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,37 @@ namespace oxygine
{
struct init_desc
{
init_desc() : mode24bpp(true), w(-1), h(-1), fullscreen(false), title("Oxygine"), vsync(true), appName(0), companyName(0), force_gles(false) {}
init_desc() :w(-1), h(-1), mode24bpp(true), vsync(true), fullscreen(false), resizable(false), borderless(false), show_window(true), force_gles(false), allow_screensaver(true), title("Oxygine"), appName(0), companyName(0) {}

/**sets 24 bits per pixel, otherwise sets 16 bits per pixel?*/
bool mode24bpp;
/**display width*/
int w;
/**display height*/
int h;

/**sets 24 bits per pixel, otherwise sets 16 bits per pixel?*/
unsigned int mode24bpp :1;
/**vertical sync*/
bool vsync;
unsigned int vsync :1;
/**fullscreen mode*/
bool fullscreen;
unsigned int fullscreen :1;
/**can the window be resized*/
unsigned int resizable :1;
/**borderless window*/
unsigned int borderless :1;
/**will the window be visible*/
unsigned int show_window :1;
/**use OpenGLES driver. Could be used on Windows for emulation OpenGLES via Direct3D*/
unsigned int force_gles :1;
/**allow screensaver*/
unsigned int allow_screensaver :1;

/**window title*/
const char* title;

/** Application name to be used as part of the file system directory for writable storage. If appName is empty files would be written next to working directory*/
const char* appName;
/** Company name to be used as part of the file system directory for writable storage*/
const char* companyName;

/**use OpenGLES driver. Could be used on Windows for emulation OpenGLES via Direct3D*/
bool force_gles;
};

void init0();
Expand Down

0 comments on commit 9919de7

Please sign in to comment.