mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
Corrige GamePad
This commit is contained in:
parent
80ff2d2fe5
commit
507e61c95b
@ -41,23 +41,22 @@ namespace xna {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Game::Initialize() {
|
void Game::Initialize() {
|
||||||
Keyboard::Initialize();
|
//#if (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/)
|
||||||
Mouse::Initialize();
|
|
||||||
GamePad::Initialize();
|
|
||||||
|
|
||||||
#if (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/)
|
|
||||||
Microsoft::WRL::Wrappers::RoInitializeWrapper initialize(RO_INIT_MULTITHREADED);
|
Microsoft::WRL::Wrappers::RoInitializeWrapper initialize(RO_INIT_MULTITHREADED);
|
||||||
if (FAILED(initialize))
|
if (FAILED(initialize))
|
||||||
{
|
{
|
||||||
MessageBox(nullptr, "Ocorreu um erro ao chamar Microsoft::WRL::Wrappers::RoInitializeWrapper.", "XN65", MB_OK);
|
MessageBox(nullptr, "Ocorreu um erro ao chamar Microsoft::WRL::Wrappers::RoInitializeWrapper.", "XN65", MB_OK);
|
||||||
}
|
}
|
||||||
#else
|
//#else
|
||||||
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
MessageBox(nullptr, "Ocorreu um erro ao chamar CoInitializeEx.", "XN65", MB_OK);
|
MessageBox(nullptr, "Ocorreu um erro ao chamar CoInitializeEx.", "XN65", MB_OK);
|
||||||
}
|
}
|
||||||
#endif
|
//#endif
|
||||||
|
Keyboard::Initialize();
|
||||||
|
Mouse::Initialize();
|
||||||
|
GamePad::Initialize();
|
||||||
|
|
||||||
_audioEngine = New<AudioEngine>();
|
_audioEngine = New<AudioEngine>();
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
namespace xna {
|
namespace xna {
|
||||||
void GamePad::Initialize() {
|
void GamePad::Initialize() {
|
||||||
impl = uNew<PlatformImplementation>();
|
impl = uNew<PlatformImplementation>();
|
||||||
impl->_dxGamePad = uNew<DirectX::GamePad>();
|
impl->_dxGamePad = uNew<DirectX::GamePad>();
|
||||||
}
|
}
|
||||||
|
|
||||||
GamePadState GamePad::GetState(PlayerIndex index) {
|
GamePadState GamePad::GetState(PlayerIndex index) {
|
||||||
|
@ -141,13 +141,6 @@ namespace xna {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct GamePad::PlatformImplementation {
|
struct GamePad::PlatformImplementation {
|
||||||
~PlatformImplementation() {
|
|
||||||
if (_dxGamePad) {
|
|
||||||
_dxGamePad->Suspend();
|
|
||||||
_dxGamePad = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline static uptr<DirectX::GamePad> _dxGamePad = nullptr;
|
inline static uptr<DirectX::GamePad> _dxGamePad = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user