Resources in iOS

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
User avatar
affentanz
Kobold
Posts: 30
Joined: Tue Sep 03, 2013 10:34 pm
x 2

Resources in iOS

Post by affentanz »

I try to load resources in an iOS application with

Code: Select all

Ogre::ResourceGroupManager::getSingleton().addResourceLocation("Media/Sinbad.zip", "Zip", "General");
but I get the following error message:
An exception has occurred: OGRE EXCEPTION(7:InternalErrorException): Media/Sinbad.zip - error whilst opening archive: Unable to read zip file. in ZipArchive::checkZzipError at /path-to-ogre-source/OgreMain/src/OgreZip.cpp (line 310)
I know that this probably is because the zip isn't found or isn't in the app archive. But I can't figure out how to load resources in iOS. In my CMakeLists file there is this command, but it didn't helped:

Code: Select all

COMMAND ditto "${PROJECT_SOURCE_DIR}/assets" "${OGRE_SAMPLE_CONTENTS_PATH}/Media"
Can someone explain what to mention when using resources in an ios app?
farrer
Halfling
Posts: 64
Joined: Mon Sep 12, 2011 7:35 pm
x 13

Re: Resources in iOS

Post by farrer »

You should load them prefixed with Ogre::macBundlePath():

Code: Select all

#include <OGRE/iOS/macUtils.h>

(...)

Ogre::ResourceGroupManager::getSingleton().addResourceLocation(Ogre::macBundlePath() + "/Media/Sinbad.zip", "Zip", "General");

And make sure that the "Media/Sinbad.zip" is in your created application.

(side note: put them inner #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS to make the code portable is a good idea).
User avatar
affentanz
Kobold
Posts: 30
Joined: Tue Sep 03, 2013 10:34 pm
x 2

Re: Resources in iOS

Post by affentanz »

Thank you, that did it!

Now I just have to figure out how to get touch input. But I will have a look in the sample browser code for that.
Post Reply