Hi Guys,
developing a new Irrlicht based App, we need to load an image as a Background texture, which is placed in an other directory as the irrlichtDevice's workingDirectory.
Is it possible to switch the workingDirectory to load this images, or is it possible to access directories outside of the workingDirectory?
Example:
- App Sandbox
------ Documents
----------- background.png
------ App-Data
----------- media (the working Directory)
----------------- all other textures
Regards,
Daniel
[iOS] Load Textures/Images outside of WorkingDirectory
-
- Posts: 61
- Joined: Mon Oct 08, 2012 1:46 pm
Re: [iOS] Load Textures/Images outside of WorkingDirectory
It's possible. You can do something like that:
or something like that (if you don't want to use objc):
Code: Select all
core::stringc filePath = [[[NSBundle mainBundle] resourcePath] UTF8String];
filePath += "/Documents/background.png";
Code: Select all
path filePath = irrDevice->getFileSystem()->getWorkingDirectory(); // AFAIK at default working dir is set to resources path, but I may be wrong
filePath += "../Documents/background.png";
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
-
- Posts: 61
- Joined: Mon Oct 08, 2012 1:46 pm
Re: [iOS] Load Textures/Images outside of WorkingDirectory
Thanks Nadro! We just found out, that it's possible to switch the directory while runtime.Nadro wrote:It's possible. You can do something like that:or something like that (if you don't want to use objc):Code: Select all
core::stringc filePath = [[[NSBundle mainBundle] resourcePath] UTF8String]; filePath += "/Documents/background.png";
Code: Select all
path filePath = irrDevice->getFileSystem()->getWorkingDirectory(); // AFAIK at default working dir is set to resources path, but I may be wrong filePath += "../Documents/background.png";
Code: Select all
stringc workingDir = device->getFileSystem()->getWorkingDirectory();
device->getFileSystem()->changeWorkingDirectoryTo(FAAppFrame::getFassadenBilderDirectory());
//LOAD IMAGE FOR BACKGROUND
loadImage = new E3DCLoadImage(device, smgr);
loadImage->loadImageForBackground(FAAppFrame::getCurrentFassadenBildName());
device->getFileSystem()->changeWorkingDirectoryTo(workingDir);