macMain.mm 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #import "app/mainLoop.h"
  23. #import "platform/platformInput.h"
  24. #import "console/console.h"
  25. #import "platformPOSIX/POSIXStdConsole.h"
  26. #import "platformPOSIX/POSIXState.h"
  27. extern void InitWindowingSystem();
  28. //------------------------------------------------------------------------------
  29. void Platform::init()
  30. {
  31. StdConsole::create();
  32. stdConsole->enable(true);
  33. Con::printf("Initializing platform...");
  34. // Set the platform variable for the scripts
  35. Con::setVariable( "$platform", "macos" );
  36. Input::init();
  37. //installRedBookDevices();
  38. #ifndef TORQUE_DEDICATED
  39. // if we're not dedicated do more initialization
  40. InitWindowingSystem();
  41. #endif
  42. }
  43. //------------------------------------------------------------------------------
  44. void Platform::shutdown()
  45. {
  46. }
  47. //------------------------------------------------------------------------------
  48. extern "C"
  49. {
  50. bool torque_engineinit(int argc, const char **argv);
  51. int torque_enginetick();
  52. S32 torque_getreturnstatus();
  53. bool torque_engineshutdown();
  54. int torque_macmain(int argc, const char **argv)
  55. {
  56. if (!torque_engineinit(argc, argv))
  57. return 1;
  58. while(torque_enginetick())
  59. {
  60. }
  61. torque_engineshutdown();
  62. return torque_getreturnstatus();
  63. }
  64. }
  65. extern S32 TorqueMain(S32 argc, const char **argv);
  66. #if !defined(TORQUE_SHARED)
  67. int main(int argc, const char **argv)
  68. {
  69. return TorqueMain(argc, argv);
  70. }
  71. #endif