Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
a36a856b
Commit
a36a856b
authored
Jun 10, 2011
by
Tim Angus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* SDL_IOS_ORIENTATIONS hint
parent
94e1b697
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
SDL_hints.h
include/SDL_hints.h
+11
-0
SDL_uikitwindow.m
src/video/uikit/SDL_uikitwindow.m
+32
-0
No files found.
include/SDL_hints.h
View file @
a36a856b
...
@@ -119,6 +119,17 @@ extern "C" {
...
@@ -119,6 +119,17 @@ extern "C" {
*/
*/
#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC"
#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC"
/**
* \brief A variable controlling which orientations are allowed on iOS.
*
* In some circumstances it is necessary to be able to explicitly control
* which UI orientations are allowed.
*
* This variable is a space delimited list of the following values:
* "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"
*/
#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
/**
/**
* \brief An enumeration of hint priorities
* \brief An enumeration of hint priorities
...
...
src/video/uikit/SDL_uikitwindow.m
View file @
a36a856b
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "SDL_video.h"
#include "SDL_video.h"
#include "SDL_mouse.h"
#include "SDL_mouse.h"
#include "SDL_assert.h"
#include "SDL_assert.h"
#include "SDL_hints.h"
#include "../SDL_sysvideo.h"
#include "../SDL_sysvideo.h"
#include "../SDL_pixels_c.h"
#include "../SDL_pixels_c.h"
#include "../../events/SDL_events_c.h"
#include "../../events/SDL_events_c.h"
...
@@ -48,6 +49,37 @@
...
@@ -48,6 +49,37 @@
}
}
-
(
BOOL
)
shouldAutorotateToInterfaceOrientation
:(
UIInterfaceOrientation
)
orient
{
-
(
BOOL
)
shouldAutorotateToInterfaceOrientation
:(
UIInterfaceOrientation
)
orient
{
const
char
*
orientationsCString
;
if
((
orientationsCString
=
SDL_GetHint
(
SDL_HINT_ORIENTATIONS
))
!=
NULL
)
{
BOOL
rotate
=
NO
;
NSString
*
orientationsNSString
=
[
NSString
stringWithCString
:
orientationsCString
encoding
:
NSUTF8StringEncoding
];
NSArray
*
orientations
=
[
orientationsNSString
componentsSeparatedByCharactersInSet
:
[
NSCharacterSet
characterSetWithCharactersInString
:
@" "
]];
switch
(
orient
)
{
case
UIInterfaceOrientationLandscapeLeft
:
rotate
=
[
orientations
containsObject
:
@"LandscapeLeft"
];
break
;
case
UIInterfaceOrientationLandscapeRight
:
rotate
=
[
orientations
containsObject
:
@"LandscapeRight"
];
break
;
case
UIInterfaceOrientationPortrait
:
rotate
=
[
orientations
containsObject
:
@"Portrait"
];
break
;
case
UIInterfaceOrientationPortraitUpsideDown
:
rotate
=
[
orientations
containsObject
:
@"PortraitUpsideDown"
];
break
;
default:
break
;
}
return
rotate
;
}
if
(
self
->
window
->
flags
&
SDL_WINDOW_RESIZABLE
)
{
if
(
self
->
window
->
flags
&
SDL_WINDOW_RESIZABLE
)
{
return
YES
;
// any orientation is okay.
return
YES
;
// any orientation is okay.
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment