Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added support for a FORCE_PORTRAIT environment variable to allow use …

…in portrait
  • Loading branch information...
commit ff3e00fffe6ddddcdd6a5099145816d4225092f9 1 parent cff3ad3
@jgranick jgranick authored
View
3  .gitignore
@@ -0,0 +1,3 @@
+.DS_Store
+Device-*
+Simulator-*
View
11 src/video/playbook/SDL_playbookvideo.c
@@ -365,6 +365,13 @@ screen_window_t PLAYBOOK_CreateWindow(_THIS, SDL_Surface *current,
SDL_Surface *PLAYBOOK_SetVideoMode(_THIS, SDL_Surface *current,
int width, int height, int bpp, Uint32 flags)
{
+
+ if (getenv ("FORCE_PORTRAIT") != NULL) {
+ int cache = width;
+ width = height;
+ height = cache;
+ }
+
// fprintf(stderr, "SetVideoMode: %dx%d %dbpp\n", width, height, bpp);
if (width == 640 && height == 400) {
_priv->eventYOffset = 40;
@@ -404,9 +411,9 @@ SDL_Surface *PLAYBOOK_SetVideoMode(_THIS, SDL_Surface *current,
hwRatio = (float)hwResolution[0]/(float)hwResolution[1];
appRatio = (float)width/(float)height;
-// int sizeOfWindow[2] = {816, 478};
+ //int sizeOfWindow[2] = {600, 1204};
double newResolution[2];
- if(hwRatio > appRatio){
+ if(hwRatio < appRatio){
newResolution[0] = ((double)height / ((double)hwResolution[1] / (double)hwResolution[0]));
newResolution[1] = (double)height;
}else{
View
8 src/video/playbook/SDL_playbookvideo_gl.c
@@ -122,6 +122,14 @@ SDL_Surface *PLAYBOOK_SetVideoMode_GL(_THIS, SDL_Surface *current,
goto error3;
}
+
+ if (getenv ("FORCE_PORTRAIT") != NULL) {
+ int cache = sizeOfWindow[0];
+ sizeOfWindow[0] = sizeOfWindow[1];
+ sizeOfWindow[1] = cache;
+ }
+
+
rc = screen_set_window_property_iv(screenWindow, SCREEN_PROPERTY_SIZE, sizeOfWindow);
if (rc) {
SDL_SetError("Cannot resize window: %s", strerror(errno));
Please sign in to comment.
Something went wrong with that request. Please try again.