IosPlatformInitializer.cs 609 B

123456789101112131415161718192021
  1. using System.Linq;
  2. using System.Runtime.InteropServices;
  3. using Foundation;
  4. namespace Urho.iOS
  5. {
  6. public static class IosUrhoInitializer
  7. {
  8. [DllImport(Consts.NativeImport)]
  9. static extern void InitSdl(string resDir, string docDir);
  10. internal static void OnInited()
  11. {
  12. string docsDir = NSSearchPath.GetDirectories(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.All, true).FirstOrDefault();
  13. string resourcesDir = NSBundle.MainBundle.ResourcePath;
  14. InitSdl(resourcesDir, docsDir);
  15. Sdl.SetMainReady();
  16. NSFileManager.DefaultManager.ChangeCurrentDirectory(resourcesDir);
  17. }
  18. }
  19. }