00001 /***************************************************************************\ 00002 * Copyright (C) by University Paris-Est - MISS team 00003 * WiimoteNunchuk.cpp created in 12 2008. 00004 * Mail : biri@univ-mlv.fr 00005 * 00006 * This file is part of the OpenKraken-controller. 00007 * 00008 * The OpenKraken-controller is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation; either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * The OpenKraken-controller is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 * 00021 \***************************************************************************/ 00022 00023 #include "WiimoteNunchuk.hpp" 00024 #include "ControllerException.hpp" 00025 00026 namespace kn { 00027 00028 00029 /********************************* 00030 * Nunchuk Methods 00031 *********************************/ 00032 00033 Nunchuk::Nunchuk(wiimote* wiimote) 00034 : InputController(){ 00035 wm=wiimote; 00036 } 00037 00038 void Nunchuk::addEvent(const unsigned int& event){ 00039 while(eventsqueue.size() >= maxevents){ 00040 eventsqueue.pop(); 00041 } 00042 eventsqueue.push(event); 00043 this->flagAsUpdated(); 00044 } 00045 00046 void Nunchuk::clearEvents(void){ 00047 while(eventsqueue.size() != 0){ 00048 eventsqueue.pop(); 00049 } 00050 this->updateAsNotUpdated(); 00051 } 00052 00053 /*WiimoteMotion Nunchuk::getMotion(void)const{ 00054 WiimoteMotion acc; 00055 if(connected){ 00056 acc.roll = wm->exp.nunchuk.orient.roll; 00057 acc.absoluteroll = wm->exp.nunchuk.orient.a_roll; 00058 acc.pitch = wm->exp.nunchuk.orient.pitch; 00059 acc.absolutepitch = wm->exp.nunchuk.orient.a_pitch; 00060 acc.yaw = wm->exp.nunchuk.orient.yaw; 00061 acc.xforce = wm->exp.nunchuk.gforce.x; 00062 acc.yforce = wm->exp.nunchuk.gforce.y; 00063 acc.zforce = wm->exp.nunchuk.gforce.z; 00064 }else{ 00065 bzero(&acc,sizeof(WiimoteMotion)); 00066 } 00067 return acc; 00068 }*/ 00069 00070 /*WiimoteJoystick Nunchuk::getJoystick(void)const{ 00071 WiimoteJoystick js; 00072 if(connected){ 00073 js.angle = wm->exp.nunchuk.js.ang; 00074 js.magnitude = wm->exp.nunchuk.js.mag; 00075 00076 }else{ 00077 bzero(&js,sizeof(WiimoteJoystick)); 00078 } 00079 return js; 00080 }*/ 00081 }
1.5.8