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
795a68e8
Commit
795a68e8
authored
Nov 10, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work in progress fixing support for rotated video modes
parent
97ae2354
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
7 deletions
+54
-7
SDL_uikitvideo.m
src/video/uikit/SDL_uikitvideo.m
+7
-0
SDL_uikitviewcontroller.m
src/video/uikit/SDL_uikitviewcontroller.m
+5
-5
SDL_uikitwindow.m
src/video/uikit/SDL_uikitwindow.m
+42
-2
No files found.
src/video/uikit/SDL_uikitvideo.m
View file @
795a68e8
...
@@ -238,6 +238,13 @@ UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
...
@@ -238,6 +238,13 @@ UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
}
else
{
}
else
{
UIScreenMode
*
uimode
=
(
UIScreenMode
*
)
mode
->
driverdata
;
UIScreenMode
*
uimode
=
(
UIScreenMode
*
)
mode
->
driverdata
;
[
uiscreen
setCurrentMode
:
uimode
];
[
uiscreen
setCurrentMode
:
uimode
];
CGSize
size
=
[
uimode
size
];
if
(
size
.
width
>=
size
.
height
)
{
[[
UIApplication
sharedApplication
]
setStatusBarOrientation
:
UIInterfaceOrientationLandscapeRight
animated
:
NO
];
}
else
{
[[
UIApplication
sharedApplication
]
setStatusBarOrientation
:
UIInterfaceOrientationPortrait
animated
:
NO
];
}
}
}
return
0
;
return
0
;
...
...
src/video/uikit/SDL_uikitviewcontroller.m
View file @
795a68e8
...
@@ -111,15 +111,11 @@
...
@@ -111,15 +111,11 @@
// Send a resized event when the orientation changes.
// Send a resized event when the orientation changes.
-
(
void
)
didRotateFromInterfaceOrientation
:
(
UIInterfaceOrientation
)
fromInterfaceOrientation
-
(
void
)
didRotateFromInterfaceOrientation
:
(
UIInterfaceOrientation
)
fromInterfaceOrientation
{
{
if
((
self
->
window
->
flags
&
SDL_WINDOW_RESIZABLE
)
==
0
)
{
return
;
// don't care, we're just flipping over in this case.
}
const
UIInterfaceOrientation
toInterfaceOrientation
=
[
self
interfaceOrientation
];
const
UIInterfaceOrientation
toInterfaceOrientation
=
[
self
interfaceOrientation
];
SDL_WindowData
*
data
=
self
->
window
->
driverdata
;
SDL_WindowData
*
data
=
self
->
window
->
driverdata
;
UIWindow
*
uiwindow
=
data
->
uiwindow
;
UIWindow
*
uiwindow
=
data
->
uiwindow
;
UIScreen
*
uiscreen
=
[
uiwindow
screen
];
UIScreen
*
uiscreen
=
[
uiwindow
screen
];
const
int
noborder
=
self
->
window
->
flags
&
SDL_WINDOW_BORDERLESS
;
const
int
noborder
=
(
self
->
window
->
flags
&
(
SDL_WINDOW_FULLSCREEN
|
SDL_WINDOW_BORDERLESS
))
;
CGRect
frame
=
noborder
?
[
uiscreen
bounds
]
:
[
uiscreen
applicationFrame
];
CGRect
frame
=
noborder
?
[
uiscreen
bounds
]
:
[
uiscreen
applicationFrame
];
const
CGSize
size
=
frame
.
size
;
const
CGSize
size
=
frame
.
size
;
int
w
,
h
;
int
w
,
h
;
...
@@ -142,6 +138,10 @@
...
@@ -142,6 +138,10 @@
return
;
return
;
}
}
if
(
w
==
frame
.
size
.
width
&&
h
==
frame
.
size
.
height
)
{
return
;
}
frame
.
size
.
width
=
w
;
frame
.
size
.
width
=
w
;
frame
.
size
.
height
=
h
;
frame
.
size
.
height
=
h
;
frame
.
origin
.
x
=
0
;
frame
.
origin
.
x
=
0
;
...
...
src/video/uikit/SDL_uikitwindow.m
View file @
795a68e8
...
@@ -63,9 +63,28 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo
...
@@ -63,9 +63,28 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo
{
{
window
->
x
=
0
;
window
->
x
=
0
;
window
->
y
=
0
;
window
->
y
=
0
;
/* We can pick either width or height here and we'll rotate the
screen to match, so we pick the closest to what we wanted.
*/
if
(
window
->
w
>=
window
->
h
)
{
if
(
uiwindow
.
frame
.
size
.
width
>
uiwindow
.
frame
.
size
.
height
)
{
window
->
w
=
(
int
)
uiwindow
.
frame
.
size
.
width
;
window
->
h
=
(
int
)
uiwindow
.
frame
.
size
.
height
;
}
else
{
window
->
w
=
(
int
)
uiwindow
.
frame
.
size
.
height
;
window
->
h
=
(
int
)
uiwindow
.
frame
.
size
.
width
;
}
}
else
{
if
(
uiwindow
.
frame
.
size
.
width
>
uiwindow
.
frame
.
size
.
height
)
{
window
->
w
=
(
int
)
uiwindow
.
frame
.
size
.
height
;
window
->
h
=
(
int
)
uiwindow
.
frame
.
size
.
width
;
}
else
{
window
->
w
=
(
int
)
uiwindow
.
frame
.
size
.
width
;
window
->
w
=
(
int
)
uiwindow
.
frame
.
size
.
width
;
window
->
h
=
(
int
)
uiwindow
.
frame
.
size
.
height
;
window
->
h
=
(
int
)
uiwindow
.
frame
.
size
.
height
;
}
}
}
}
window
->
driverdata
=
data
;
window
->
driverdata
=
data
;
...
@@ -199,6 +218,27 @@ UIKit_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
...
@@ -199,6 +218,27 @@ UIKit_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
[
UIApplication
sharedApplication
].
statusBarHidden
=
NO
;
[
UIApplication
sharedApplication
].
statusBarHidden
=
NO
;
uiwindow
.
frame
=
[
uiscreen
applicationFrame
];
uiwindow
.
frame
=
[
uiscreen
applicationFrame
];
}
}
/* We can pick either width or height here and we'll rotate the
screen to match, so we pick the closest to what we wanted.
*/
if
(
window
->
w
>=
window
->
h
)
{
if
(
uiwindow
.
frame
.
size
.
width
>
uiwindow
.
frame
.
size
.
height
)
{
window
->
w
=
(
int
)
uiwindow
.
frame
.
size
.
width
;
window
->
h
=
(
int
)
uiwindow
.
frame
.
size
.
height
;
}
else
{
window
->
w
=
(
int
)
uiwindow
.
frame
.
size
.
height
;
window
->
h
=
(
int
)
uiwindow
.
frame
.
size
.
width
;
}
}
else
{
if
(
uiwindow
.
frame
.
size
.
width
>
uiwindow
.
frame
.
size
.
height
)
{
window
->
w
=
(
int
)
uiwindow
.
frame
.
size
.
height
;
window
->
h
=
(
int
)
uiwindow
.
frame
.
size
.
width
;
}
else
{
window
->
w
=
(
int
)
uiwindow
.
frame
.
size
.
width
;
window
->
h
=
(
int
)
uiwindow
.
frame
.
size
.
height
;
}
}
}
}
void
void
...
...
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