1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00

Corrige GamePad

This commit is contained in:
Danilo 2024-05-21 16:21:01 -03:00
parent 80ff2d2fe5
commit 507e61c95b
3 changed files with 7 additions and 15 deletions

View File

@ -41,23 +41,22 @@ namespace xna {
}
void Game::Initialize() {
Keyboard::Initialize();
Mouse::Initialize();
GamePad::Initialize();
#if (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/)
//#if (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/)
Microsoft::WRL::Wrappers::RoInitializeWrapper initialize(RO_INIT_MULTITHREADED);
if (FAILED(initialize))
{
MessageBox(nullptr, "Ocorreu um erro ao chamar Microsoft::WRL::Wrappers::RoInitializeWrapper.", "XN65", MB_OK);
}
#else
//#else
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
if (FAILED(hr))
{
MessageBox(nullptr, "Ocorreu um erro ao chamar CoInitializeEx.", "XN65", MB_OK);
}
#endif
//#endif
Keyboard::Initialize();
Mouse::Initialize();
GamePad::Initialize();
_audioEngine = New<AudioEngine>();

View File

@ -4,7 +4,7 @@
namespace xna {
void GamePad::Initialize() {
impl = uNew<PlatformImplementation>();
impl->_dxGamePad = uNew<DirectX::GamePad>();
impl->_dxGamePad = uNew<DirectX::GamePad>();
}
GamePadState GamePad::GetState(PlayerIndex index) {

View File

@ -141,13 +141,6 @@ namespace xna {
};
struct GamePad::PlatformImplementation {
~PlatformImplementation() {
if (_dxGamePad) {
_dxGamePad->Suspend();
_dxGamePad = nullptr;
}
}
inline static uptr<DirectX::GamePad> _dxGamePad = nullptr;
};