]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/linux/gamecontroller.cpp
Add a type enumeration for devices
[libs/gui.git] / source / input / linux / gamecontroller.cpp
index f0139e96baeb4b04f150bf463c5fa7f84701a83f..d0029e8fe3c4bbad1249bb4fdcea6b1baca1d7b6 100644 (file)
@@ -16,6 +16,7 @@ namespace Input {
 vector<string> GameController::Private::detected_controllers;
 
 GameController::GameController(unsigned index):
+       Device(GAME_CONTROLLER),
        event_disp(0)
 {
        if(!detect_done)
@@ -79,11 +80,11 @@ void GameController::tick()
                unsigned count = len/sizeof(js_event);
                for(unsigned i=0; i<count; ++i)
                {
-                       unsigned type = events[i].type&0x7F;
+                       unsigned etype = events[i].type&0x7F;
                        bool init = events[i].type&JS_EVENT_INIT;
-                       if(type==JS_EVENT_AXIS)
+                       if(etype==JS_EVENT_AXIS)
                                set_axis_value(events[i].number, events[i].value/32768.0f, !init);
-                       else if(type==JS_EVENT_BUTTON)
+                       else if(etype==JS_EVENT_BUTTON)
                                set_button_state(events[i].number, events[i].value, !init);
                }