00001 #include <phGravisGamePadProData.h> 00002 #include <phbase.h> 00003 00004 /* ------------------------------------------------------------------------- */ 00005 phGravisGamePadProData::phGravisGamePadProData() 00006 { 00007 phFUNCTION("phGravisGamePadProData::~phGravisGamePadProData") 00008 int locked = 0; 00009 int rwlocked = 0; 00010 ph_joystick_key keys[] = 00011 { { phJOYSTICK_KEY_BUTTON,"red", 0 }, 00012 { phJOYSTICK_KEY_BUTTON,"yellow", 1 }, 00013 { phJOYSTICK_KEY_BUTTON,"green", 2 }, 00014 { phJOYSTICK_KEY_BUTTON,"blue", 3 }, 00015 { phJOYSTICK_KEY_BUTTON,"one_left", 4 }, 00016 { phJOYSTICK_KEY_BUTTON,"L1", 4 }, 00017 { phJOYSTICK_KEY_BUTTON,"one_right", 5 }, 00018 { phJOYSTICK_KEY_BUTTON,"R1", 5 }, 00019 { phJOYSTICK_KEY_BUTTON,"two_left", 6 }, 00020 { phJOYSTICK_KEY_BUTTON,"L2", 6 }, 00021 { phJOYSTICK_KEY_BUTTON,"two_right", 7 }, 00022 { phJOYSTICK_KEY_BUTTON,"R2", 7 }, 00023 { phJOYSTICK_KEY_BUTTON,"start", 8 }, 00024 { phJOYSTICK_KEY_BUTTON,"select", 9 }, 00025 { phJOYSTICK_KEY_AXIS, "x", 0 }, 00026 { phJOYSTICK_KEY_AXIS, "roll", 0 }, 00027 { phJOYSTICK_KEY_AXIS, "y", 1 }, 00028 { phJOYSTICK_KEY_AXIS, "pitch", 1 } 00029 }; 00030 uint32_t count = sizeof(keys) / sizeof(ph_joystick_key); 00031 00032 phTHIS_LOOSE_LOCK(locked); 00033 phTHIS_READLOCK_LOOSE(rwlocked); 00034 00035 rc = this->setKeys(keys,count); 00036 phPRINT_RC(rc,NULL,"setKeys()"); 00037 00038 phTHIS_RWUNLOCK_LOOSE(rwlocked); 00039 phTHIS_LOOSE_UNLOCK(locked); 00040 } 00041 00042 /* ------------------------------------------------------------------------- */ 00043 int32_t phGravisGamePadProData::select() 00044 { 00045 return this->get("select"); 00046 } 00047 00048 /* ------------------------------------------------------------------------- */ 00049 int32_t phGravisGamePadProData::start() 00050 { 00051 return this->get("start"); 00052 } 00053 00054 /* ------------------------------------------------------------------------- */ 00055 int32_t phGravisGamePadProData::red() 00056 { 00057 return this->get("red"); 00058 } 00059 00060 /* ------------------------------------------------------------------------- */ 00061 int32_t phGravisGamePadProData::blue() 00062 { 00063 return this->get("blue"); 00064 } 00065 00066 /* ------------------------------------------------------------------------- */ 00067 int32_t phGravisGamePadProData::green() 00068 { 00069 return this->get("green"); 00070 } 00071 00072 /* ------------------------------------------------------------------------- */ 00073 int32_t phGravisGamePadProData::yellow() 00074 { 00075 return this->get("yellow"); 00076 } 00077 00078 /* ------------------------------------------------------------------------- */ 00079 int32_t phGravisGamePadProData::one_left() 00080 { 00081 return this->get("one_left"); 00082 } 00083 00084 /* ------------------------------------------------------------------------- */ 00085 int32_t phGravisGamePadProData::one_right() 00086 { 00087 return this->get("one_right"); 00088 } 00089 00090 /* ------------------------------------------------------------------------- */ 00091 int32_t phGravisGamePadProData::two_left() 00092 { 00093 return this->get("two_left"); 00094 } 00095 00096 /* ------------------------------------------------------------------------- */ 00097 int32_t phGravisGamePadProData::two_right() 00098 { 00099 return this->get("two_right"); 00100 } 00101 00102 /* ------------------------------------------------------------------------- */ 00103 int32_t phGravisGamePadProData::L1() 00104 { 00105 return this->one_left(); 00106 } 00107 00108 /* ------------------------------------------------------------------------- */ 00109 int32_t phGravisGamePadProData::L2() 00110 { 00111 return this->two_left(); 00112 } 00113 00114 /* ------------------------------------------------------------------------- */ 00115 int32_t phGravisGamePadProData::R1() 00116 { 00117 return this->one_right(); 00118 } 00119 00120 /* ------------------------------------------------------------------------- */ 00121 int32_t phGravisGamePadProData::R2() 00122 { 00123 return this->two_right(); 00124 } 00125 00126
Copyright (C) 2002 - 2007 |
Philip D.S. Thoren ( pthoren@users.sourceforge.net ) University Of Massachusetts at Lowell Robotics Lab |