mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-08-12 12:19:05 +00:00
Smart pointer usage for input device handle
This commit is contained in:
parent
d584df8f5f
commit
98142731d8
@ -172,20 +172,20 @@ public:
|
|||||||
* using the relevant OS API. This thread blocks in a loop until an event is
|
* using the relevant OS API. This thread blocks in a loop until an event is
|
||||||
* received. Device pointers should only be manipulated by this thread using
|
* received. Device pointers should only be manipulated by this thread using
|
||||||
* the deviceConnected() and deviceDisconnected() callbacks. */
|
* the deviceConnected() and deviceDisconnected() callbacks. */
|
||||||
std::unique_ptr<boo::DolphinSmashAdapter> smashAdapter = NULL;
|
std::shared_ptr<boo::DolphinSmashAdapter> smashAdapter;
|
||||||
void deviceConnected(boo::DeviceToken& tok)
|
void deviceConnected(boo::DeviceToken& tok)
|
||||||
{
|
{
|
||||||
/* Device listener thread */
|
/* Device listener thread */
|
||||||
if (!smashAdapter)
|
if (!smashAdapter)
|
||||||
{
|
{
|
||||||
smashAdapter.reset(dynamic_cast<boo::DolphinSmashAdapter*>(tok.openAndGetDevice()));
|
smashAdapter = std::dynamic_pointer_cast<boo::DolphinSmashAdapter>(tok.openAndGetDevice());
|
||||||
smashAdapter->setCallback(&m_dolphinCb);
|
smashAdapter->setCallback(&m_dolphinCb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void deviceDisconnected(boo::DeviceToken&, boo::DeviceBase* device)
|
void deviceDisconnected(boo::DeviceToken&, boo::DeviceBase* device)
|
||||||
{
|
{
|
||||||
if (smashAdapter.get() == device)
|
if (smashAdapter.get() == device)
|
||||||
smashAdapter.reset(nullptr);
|
smashAdapter.reset();
|
||||||
}
|
}
|
||||||
void SetMotorState(EIOPort port, EMotorState state)
|
void SetMotorState(EIOPort port, EMotorState state)
|
||||||
{
|
{
|
||||||
|
2
hecl
2
hecl
@ -1 +1 @@
|
|||||||
Subproject commit 1327e4b4e8da8275e5a765e9a49802669df36fd8
|
Subproject commit 2d12cfe0d870fa80345e27b9185bd19d3bce0cd8
|
Loading…
x
Reference in New Issue
Block a user