ios stuff

This commit is contained in:
Vladislav Khorev 2013-03-04 20:27:47 +00:00
parent 013b1dc344
commit da5bd119ab
4 changed files with 16 additions and 13 deletions

View File

@ -32,23 +32,22 @@ namespace SE
[&] ()
{
result = f();
{
boost::mutex::scoped_lock lock(FunctionMutex);
boost::mutex::scoped_lock lock(ST::FunctionMutex);
functionCalled = true;
}
FunctionFinishedCondition.notify_one();
ST::FunctionFinishedCondition.notify_one();
};
ST::MainThreadIoService.post(func);
boost::mutex::scoped_lock lock(FunctionMutex);
boost::mutex::scoped_lock lock(ST::FunctionMutex);
while (!functionCalled)
{
FunctionFinishedCondition.wait(lock);
ST::FunctionFinishedCondition.wait(lock);
}
return result;

View File

@ -333,7 +333,7 @@ bool TModelManager::AddLiteModel(const std::string& filename, const std::string&
if (LiteModelMap.count(modelName) != 0)
return true;
boost::shared_array<byte> fileArr = CreateMemFromFile<byte>((ST::PathToResources + filename), fileSize);
boost::shared_array<unsigned char> fileArr = CreateMemFromFile<unsigned char>((ST::PathToResources + filename), fileSize);
if (!(fileArr[0] == 'L' && fileArr[1] == 'M' && fileArr[2] == 0 && fileArr[3] == 1))
throw ErrorFileNotCorrect(filename);

View File

@ -28,11 +28,10 @@ void TResourceManager::Update(cardinal timer)
SoundManager.Update(timer);
GUIManager.Update(timer);
//ST::MainThreadIoService.run();
ST::MainThreadIoService.run_one();
//ST::MainThreadIoService.reset();
ST::MainThreadIoService.poll_one();
ST::MainThreadIoService.reset();
}
TResourceManager::~TResourceManager()

View File

@ -18,7 +18,8 @@ namespace SE
std::string IosGetFileReadPath(const std::string& filename)
{
@autoreleasepool
{
NSString* nsFullFileName = [NSString stringWithCString:filename.c_str() encoding:NSUTF8StringEncoding];
NSString* nsFileShortName = [nsFullFileName lastPathComponent];
@ -32,11 +33,14 @@ std::string IosGetFileReadPath(const std::string& filename)
NSString *filePath = [[NSBundle mainBundle] pathForResource:nsFileShortNameWithoutExt ofType:nsFileExt inDirectory:nsFilePath];
return std::string([filePath UTF8String]);
}
}
std::string IosGetFilePathUserData(const std::string& filename)
{
@autoreleasepool
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
@ -47,6 +51,7 @@ std::string IosGetFilePathUserData(const std::string& filename)
NSString* file = [docDir stringByAppendingString:[NSString stringWithCString:filename.c_str() encoding:NSUTF8StringEncoding]];
return std::string([[NSFileManager defaultManager] fileSystemRepresentationWithPath:file]);
}
}
void IosSwitchToScreen()