Launcher_Mac.mm 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <Launcher.h>
  9. #include <O3DEApplication_Mac.h>
  10. #include <../Common/Apple/Launcher_Apple.h>
  11. #include <../Common/UnixLike/Launcher_UnixLike.h>
  12. #include <AzCore/Math/Vector2.h>
  13. #if AZ_TESTS_ENABLED
  14. int main(int argc, char* argv[])
  15. {
  16. // TODO: Implement for Mac
  17. return static_cast<int>(O3DELauncher::ReturnCode::ErrUnitTestNotSupported);
  18. }
  19. #else
  20. int main(int argc, char* argv[])
  21. {
  22. const AZ::Debug::Trace tracer;
  23. // Ensure the process is a foreground application. Must be done before creating the application.
  24. ProcessSerialNumber processSerialNumber = { 0, kCurrentProcess };
  25. TransformProcessType(&processSerialNumber, kProcessTransformToForegroundApplication);
  26. // Create a memory pool, a custom AppKit application, and a custom AppKit application delegate.
  27. NSAutoreleasePool* autoreleasePool = [[NSAutoreleasePool alloc] init];
  28. [O3DEApplication_Mac sharedApplication];
  29. [NSApp setDelegate: [[O3DEApplicationDelegate_Mac alloc] init]];
  30. // Register some default application behaviours
  31. [[NSUserDefaults standardUserDefaults] registerDefaults:
  32. [[NSDictionary alloc] initWithObjectsAndKeys:
  33. [NSNumber numberWithBool: FALSE], @"AppleMomentumScrollSupported",
  34. [NSNumber numberWithBool: FALSE], @"ApplePressAndHoldEnabled",
  35. nil]];
  36. // Launch the AppKit application and release the memory pool.
  37. [NSApp finishLaunching];
  38. [autoreleasePool release];
  39. // run the Open 3D Engine application
  40. using namespace O3DELauncher;
  41. PlatformMainInfo mainInfo;
  42. mainInfo.m_updateResourceLimits = IncreaseResourceLimits;
  43. mainInfo.m_appResourcesPath = GetAppResourcePath();
  44. bool ret = mainInfo.CopyCommandLine(argc, argv);
  45. ReturnCode status = ret ?
  46. Run(mainInfo) :
  47. ReturnCode::ErrCommandLine;
  48. return static_cast<int>(status);
  49. }
  50. #endif // AZ_TESTS_ENABLED
  51. void CVar_OnViewportPosition([[maybe_unused]] const AZ::Vector2& value) {}