/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
release-23.4
Code/EnginePlugins/XBoxControllerPlugin/Startup.cpp
57 строк
1 KB
Jan Krassnigg
Fixes for static builds with VS2022
22 мар 2023, 20:15
22 мар 2023, 20:15
9281ae7
Код
Авторство
О чём код?
#include <Core/System/ControllerInput.h> #include <Foundation/Configuration/Startup.h> #include <XBoxControllerPlugin/InputDeviceXBox.h> static ezInputDeviceXBox360* g_InputDeviceXBox360 = nullptr; ezInputDeviceXBox360* ezInputDeviceXBox360::GetDevice() { if (g_InputDeviceXBox360 == nullptr) g_InputDeviceXBox360 = EZ_DEFAULT_NEW(ezInputDeviceXBox360); return g_InputDeviceXBox360; } void ezInputDeviceXBox360::DestroyAllDevices() { EZ_DEFAULT_DELETE(g_InputDeviceXBox360); } // clang-format off EZ_BEGIN_SUBSYSTEM_DECLARATION(InputDevices, InputDeviceXBox360) BEGIN_SUBSYSTEM_DEPENDENCIES "Foundation", "InputManager" END_SUBSYSTEM_DEPENDENCIES ON_CORESYSTEMS_STARTUP { } ON_CORESYSTEMS_SHUTDOWN { ezInputDeviceXBox360::DestroyAllDevices(); } ON_HIGHLEVELSYSTEMS_STARTUP { ezInputDeviceXBox360* pDevice = ezInputDeviceXBox360::GetDevice(); if(ezControllerInput::GetDevice() == nullptr) { ezControllerInput::SetDevice(pDevice); } } ON_HIGHLEVELSYSTEMS_SHUTDOWN { if(ezControllerInput::GetDevice() == g_InputDeviceXBox360) { ezControllerInput::SetDevice(nullptr); } ezInputDeviceXBox360::DestroyAllDevices(); } EZ_END_SUBSYSTEM_DECLARATION; // clang-format on