X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fwindows%2Fgamecontroller.cpp;h=46536b39d37acba729c300c02a748a7a825bd18f;hb=e82345f2c1286e684789854c7dbe32411bb0b05f;hp=43a947b5e3fb214e3f8d37ec524ec9895fdee001;hpb=130d5570e08c32d9db9d3e5324c2c8e99d1cdb02;p=libs%2Fgui.git diff --git a/source/input/windows/gamecontroller.cpp b/source/input/windows/gamecontroller.cpp index 43a947b..46536b3 100644 --- a/source/input/windows/gamecontroller.cpp +++ b/source/input/windows/gamecontroller.cpp @@ -1,7 +1,7 @@ -#include -#include #include "gamecontroller.h" #include "gamecontroller_platform.h" +#include +#include using namespace std; @@ -10,7 +10,8 @@ namespace Input { vector GameController::Private::detected_controllers; -GameController::GameController(unsigned index) +GameController::GameController(unsigned index): + Device(GAME_CONTROLLER) { if(!detect_done) detect(); @@ -33,7 +34,7 @@ GameController::GameController(unsigned index) GameController::~GameController() { - use_event_dispatcher(0); + use_event_dispatcher(nullptr); delete priv; } @@ -74,9 +75,9 @@ void GameController::use_event_dispatcher(IO::EventDispatcher *ed) else if(priv->event_pipe) { GameControllerTimerThread::remove_slot(*priv->timer_slot); - priv->timer_slot = 0; + priv->timer_slot = nullptr; delete priv->event_pipe; - priv->event_pipe = 0; + priv->event_pipe = nullptr; } } @@ -100,13 +101,6 @@ void GameController::tick(const Time::TimeDelta &) } -GameController::Private::Private(): - index(0), - last_packet_number(0), - event_pipe(0), - timer_slot(0) -{ } - bool GameController::Private::generate_event() { event_pipe->put(1); @@ -140,11 +134,10 @@ void GameController::Private::update_state(GameController &ctrl, const XINPUT_ST } -GameControllerTimerThread *GameControllerTimerThread::thread = 0; +GameControllerTimerThread *GameControllerTimerThread::thread = nullptr; GameControllerTimerThread::GameControllerTimerThread(): - Thread("GameController"), - n_users(0) + Thread("GameController") { launch(); } @@ -170,7 +163,7 @@ void GameControllerTimerThread::remove_slot(Time::Timer::Slot &slot) { thread->timer.add(Time::zero); delete thread; - thread = 0; + thread = nullptr; } }