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
7e612866
Commit
7e612866
authored
Sep 28, 2011
by
Kees Bakker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplied the code a bit in uikit/SDL_uikitvideo.m
parent
601a5ebf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
44 deletions
+11
-44
SDL_uikitvideo.m
src/video/uikit/SDL_uikitvideo.m
+11
-44
No files found.
src/video/uikit/SDL_uikitvideo.m
View file @
7e612866
...
@@ -118,32 +118,6 @@ The main screen should list a AxB mode for portrait orientation, and then
...
@@ -118,32 +118,6 @@ The main screen should list a AxB mode for portrait orientation, and then
*/
*/
static
CGSize
UIKit_ForcePortrait
(
const
CGSize
size
)
{
CGSize
retval
;
if
(
size
.
width
<
size
.
height
)
{
// portrait
retval
=
size
;
}
else
{
// landscape
retval
.
width
=
size
.
height
;
retval
.
height
=
size
.
width
;
}
return
retval
;
}
static
CGSize
UIKit_ForceLandscape
(
const
CGSize
size
)
{
CGSize
retval
;
if
(
size
.
width
>
size
.
height
)
{
// landscape
retval
=
size
;
}
else
{
// portrait
retval
.
width
=
size
.
height
;
retval
.
height
=
size
.
width
;
}
return
retval
;
}
static
void
static
void
UIKit_GetDisplayModes
(
_THIS
,
SDL_VideoDisplay
*
display
)
UIKit_GetDisplayModes
(
_THIS
,
SDL_VideoDisplay
*
display
)
{
{
...
@@ -156,18 +130,19 @@ UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
...
@@ -156,18 +130,19 @@ UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
if
(
!
SDL_UIKit_supports_multiple_displays
)
{
if
(
!
SDL_UIKit_supports_multiple_displays
)
{
const
CGRect
rect
=
[
uiscreen
bounds
];
const
CGRect
rect
=
[
uiscreen
bounds
];
mode
.
format
=
SDL_PIXELFORMAT_ABGR8888
;
mode
.
format
=
SDL_PIXELFORMAT_ABGR8888
;
mode
.
w
=
(
int
)
rect
.
size
.
width
;
mode
.
h
=
(
int
)
rect
.
size
.
height
;
mode
.
refresh_rate
=
0
;
mode
.
refresh_rate
=
0
;
mode
.
driverdata
=
NULL
;
mode
.
driverdata
=
NULL
;
mode
.
w
=
(
int
)
rect
.
size
.
width
;
mode
.
h
=
(
int
)
rect
.
size
.
height
;
SDL_AddDisplayMode
(
display
,
&
mode
);
SDL_AddDisplayMode
(
display
,
&
mode
);
mode
.
w
=
(
int
)
rect
.
size
.
height
;
// swap the orientation, add again.
mode
.
w
=
(
int
)
rect
.
size
.
height
;
// swap the orientation, add again.
mode
.
h
=
(
int
)
rect
.
size
.
width
;
mode
.
h
=
(
int
)
rect
.
size
.
width
;
SDL_AddDisplayMode
(
display
,
&
mode
);
SDL_AddDisplayMode
(
display
,
&
mode
);
return
;
return
;
}
}
const
BOOL
ismain
=
(
uiscreen
==
[
UIScreen
mainScreen
]);
const
NSArray
*
modes
=
[
uiscreen
availableModes
];
const
NSArray
*
modes
=
[
uiscreen
availableModes
];
for
(
UIScreenMode
*
uimode
in
[
uiscreen
availableModes
])
{
for
(
UIScreenMode
*
uimode
in
[
uiscreen
availableModes
])
{
CGSize
size
=
[
uimode
size
];
CGSize
size
=
[
uimode
size
];
...
@@ -177,20 +152,12 @@ UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
...
@@ -177,20 +152,12 @@ UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
mode
.
w
=
(
int
)
size
.
width
;
mode
.
w
=
(
int
)
size
.
width
;
mode
.
h
=
(
int
)
size
.
height
;
mode
.
h
=
(
int
)
size
.
height
;
if
(
SDL_AddDisplayMode
(
display
,
&
mode
))
if
(
SDL_AddDisplayMode
(
display
,
&
mode
))
[
uimode
retain
];
[
uimode
retain
];
// retain is needed because of mode.driverdata
if
(
ismain
)
{
// Add the mode twice, flipped to portrait and landscape.
// SDL_AddDisplayMode() will ignore duplicates.
size
=
UIKit_ForcePortrait
([
uimode
size
]);
mode
.
w
=
(
int
)
size
.
width
;
mode
.
h
=
(
int
)
size
.
height
;
if
(
SDL_AddDisplayMode
(
display
,
&
mode
))
[
uimode
retain
];
size
=
UIKit_ForceLandscape
(
size
);
if
(
uiscreen
==
[
UIScreen
mainScreen
])
{
mode
.
w
=
(
int
)
size
.
width
;
// Add the mode with swapped width/height
mode
.
h
=
(
int
)
size
.
height
;
mode
.
w
=
(
int
)
size
.
height
;
mode
.
h
=
(
int
)
size
.
width
;
if
(
SDL_AddDisplayMode
(
display
,
&
mode
))
if
(
SDL_AddDisplayMode
(
display
,
&
mode
))
[
uimode
retain
];
[
uimode
retain
];
}
}
...
@@ -239,8 +206,8 @@ UIKit_VideoInit(_THIS)
...
@@ -239,8 +206,8 @@ UIKit_VideoInit(_THIS)
// Just give 'em the whole main screen.
// Just give 'em the whole main screen.
UIScreen
*
uiscreen
=
[
UIScreen
mainScreen
];
UIScreen
*
uiscreen
=
[
UIScreen
mainScreen
];
UIScreenMode
*
uiscreenmode
=
[
uiscreen
currentMode
];
UIScreenMode
*
uiscreenmode
=
[
uiscreen
currentMode
];
const
CG
Rect
rect
=
[
uiscreen
bounds
]
;
const
CG
Size
size
=
[
uiscreen
bounds
].
size
;
UIKit_AddDisplay
(
uiscreen
,
uiscreenmode
,
(
int
)
rect
.
size
.
width
,
(
int
)
rect
.
size
.
height
);
UIKit_AddDisplay
(
uiscreen
,
uiscreenmode
,
(
int
)
size
.
width
,
(
int
)
size
.
height
);
}
else
{
}
else
{
for
(
UIScreen
*
uiscreen
in
[
UIScreen
screens
])
{
for
(
UIScreen
*
uiscreen
in
[
UIScreen
screens
])
{
// the main screen is the first element in the array.
// the main screen is the first element in the array.
...
...
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