AtomSampleViewerApplication_windows.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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 <AtomSampleViewerApplication.h>
  9. #include <AzCore/PlatformIncl.h>
  10. #include <AzCore/Component/ComponentApplication.h>
  11. #include <AzCore/Debug/Trace.h>
  12. #include <AzFramework/Asset/AssetProcessorMessages.h>
  13. namespace AtomSampleViewer
  14. {
  15. const bool AtomSampleViewerApplication::s_connectToAssetProcessor = true;
  16. BOOL CTRL_BREAK_HandlerRoutine(DWORD /*dwCtrlType*/)
  17. {
  18. AZ::ComponentApplication* app = nullptr;
  19. AZ::ComponentApplicationBus::BroadcastResult(app, &AZ::ComponentApplicationBus::Events::GetApplication);
  20. if (app)
  21. {
  22. app->Destroy();
  23. }
  24. return TRUE;
  25. }
  26. void AtomSampleViewerApplication::SetupConsoleHandlerRoutine()
  27. {
  28. // if we're in console mode, listen for events that close it.
  29. ::SetConsoleCtrlHandler(CTRL_BREAK_HandlerRoutine, true);
  30. }
  31. } // namespace AtomSampleViewer