User Tools

Site Tools


en:tutorials:ipadport

This is an old revision of the document!


Porting a game to the iPad

In the following I'm going to describe problems I stumpled upon while porting a game based on the orx engine from windows to the ipad.

File layout

There are different ways in which you can layout your project. If you've worked on Unix systems you probably separated all binaries from the config and other data files. Maybe it looks like this:

bin/somexecutable
bin/someexecutable.ini
cfg/config.ini
data/pic1.png
data/pic2.png
It's now important to know that you can not do this on the iOS platform. Your executable will always reside in the root folder. So once the game is copied to the device it will look like this: somexecutable someexecutable.ini cfg/config.ini data/pic1.png data/pic2.png </code> As all the paths are relative to the executable you have to change all the paths both in the config files and the sources. It's not that big a deal, you just have to be aware of that fact.

Landscape mode

There is no real support for a landscape mode. Displaying a Display where the width is greater than the height will give you weird results. So the way to go is to setup everythign in portrait mode. However you will properly have several UI elements that are attached to a Camera. So if you rotate the camera they will be rotated as well. To solve this you create a new Camera that will be used for all the UI elements. The camera will not be associated with a viewport but have the “real” camera as a parent. furthermore it will will rotate everything by 90 in the other direction. the config will in the end look something like this:

[Display]
ScreenWidth   = 768
ScreenHeight  = 1024
Title = FancyIPadApp

[Viewport]
Camera          = Camera
BackgroundColor = (153,153,153)

;Camera for UI positioning
[UICamera@Camera]
ParentCamera = Camera
;important: the following is not a typo!
;use width and height here in the "correct" way.
;this is important when using when positioning objects in the normalized scale of the parent's space (between 0 and 1)
FrustumWidth  = 1280
FrustumHeight = 960
Rotation = -90

[Camera]
FrustumWidth  = 960
FrustumHeight = 1280
Rotation = 90
FrustumFar    = 1000.0
FrustumNear   = 0.0

[SomeBGImage]
Graphic = BGGraphic 
Position = (0, 0, 0.0001)
ParentCamera = UICamera
UseParentSpace = position
Pivot = center

en/tutorials/ipadport.1302767325.txt.gz · Last modified: 2017/05/30 00:50 (7 years ago) (external edit)