Well, I recently got a Bluetooth adapter, and I hooked up my Wiimote to it. I've been using GlovePIE, but I realized that while fun, game development with it is obviously limited. I set out to get some C++ scripts for the wiimote, and found cWiimote. I compiled and verified that everything worked. I downloaded NeHe's second lesson, and slapped in the cWiimote code, which worked as well. Then I looked up how to draw text in OpenGL(NeHe lesson 13), and slapped that in there, too. Now, I'm drawing the "supposed" X,Y, and Z values of the acceloromaters, but they don't change. I'm fairly positive I messed something up, but I'm not sure where.
Keep in mind, I'm also pretty noobish at programming, so sorry for any obvious errors.
So, heres my wii_draw() function that gets called within DrawGLScene.
void wii_draw()
{
float wX,wY,wZ;
glTranslatef(0.0f,0.0f,-1.0f);
// Pulsing Colors Based On Text Position
//glColor3f(1.0f*float(cos(cnt1)),1.0f*float(sin(cnt2)),1.0f-0.5f*float(cos(cnt1+cnt2)));
// Position The Text On The Screen
glRasterPos2f(-5, -2);
cWiiMote wiimote;
if (wiimote.ConnectToDevice() && wiimote.StartDataStream())
{
wiimote.HeartBeat();
//wiimote.SetVibration(1);
//wiimote.SetLEDs(1,0,1,0);
wiimote.GetCalibratedAcceleration(wX,wY,wZ);
glPrint("W:[X:%+1.2f,Y:%+1.2f,Z:%+1.2f]",wX,wY,wZ); // Print GL Text To The Screen
}
else
glPrint("Connection failed.");
//cnt1+=0.051f; // Increase The First Counter
//cnt2+=0.005f; // Increase The Second Counter
}
And here's the GetCalibratedAcceleration function, from cWiimote.
void cWiiMote::GetCalibratedAcceleration(float & x, float & y, float &z) const
{
x = (mLastMotionReport.mX - mAccelCalibrationData.mXZero) / (float)(mAccelCalibrationData.mXG- mAccelCalibrationData.mXZero);
y = (mLastMotionReport.mY - mAccelCalibrationData.mYZero) / (float)(mAccelCalibrationData.mYG- mAccelCalibrationData.mYZero);
z = (mLastMotionReport.mZ - mAccelCalibrationData.mZZero) / (float)(mAccelCalibrationData.mZG- mAccelCalibrationData.mZZero);
}
Again, sorry if I've made an obvious/noob mistake. :P
[Edited by - Tsunekuni on March 4, 2007 7:49:55 PM]