UrhoEngine.cs 931 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.IO;
  3. namespace Urho
  4. {
  5. public static class UrhoEngine
  6. {
  7. /// <summary>
  8. /// Init engine
  9. /// </summary>
  10. /// <param name="pathToAssets">Path to a folder containing "Data" folder. CurrentDirectory if null</param>
  11. public static void Init(string pathToAssets = null)
  12. {
  13. if (!string.IsNullOrEmpty(pathToAssets))
  14. {
  15. const string coreDataFile = "CoreData.pak";
  16. System.IO.File.Copy(
  17. sourceFileName: Path.Combine(Environment.CurrentDirectory, coreDataFile),
  18. destFileName: Path.Combine(pathToAssets, coreDataFile),
  19. overwrite: true);
  20. Environment.CurrentDirectory = pathToAssets;
  21. }
  22. if (Environment.OSVersion.Platform == PlatformID.Win32NT && !Environment.Is64BitProcess)
  23. {
  24. throw new NotSupportedException("MonoUrho for Windows supports only 64bit mode (change target platform from Any CPU or x86 to x64)");
  25. }
  26. Application.EngineInited = true;
  27. }
  28. }
  29. }