I'd be happy to provide that. Here's the function in the context of the basic cube you requested:
#include "DarkGDK.h"
void CheckInput();
void DarkGDK()
{
dbMakeObjectCube(1,50);
while(LoopGDK())
{
CheckInput();
dbSync();
}
return;
}
void CheckInput()
{
/******************************************************************
* PreCondition: The game scenario has been loaded correctly
* PostCondition: The appropriate camera action will be applied
* Description: This functions handles the input for the game
* Algorithm: If "Left Arrow" is pressed, Strafe Left
* If "Right Arrow" is pressed, Strafe Right
* If "Up Arrow" is pressed, move forward
* If "Down Arrow" is pressed, move backwards
* Establish where the mouse moved to
* Rotate the camera based on the mouse movement
******************************************************************/
//If the Left Arrow is pressed
if(dbLeftKey())
{
//Strafe left
dbTurnCameraLeft(90);
dbMoveCamera(2);
dbTurnCameraRight(90);
}
else
//If the Right Arrow is pressed
if(dbRightKey())
{
//Strafe Right
dbTurnCameraRight(90);
dbMoveCamera(2);
dbTurnCameraLeft(90);
}
//If Up Arrow is pressed
if(dbUpKey())
dbMoveCamera(2);
else
//If Down Arrow is pressed
if(dbDownKey())
dbMoveCamera(-2);
// create a rotation axis based on mouse movement
fCameraAngleX = dbWrapValue(fCameraAngleX + dbMouseMoveY() * 0.4);
fCameraAngleY = dbWrapValue(fCameraAngleY + dbMouseMoveX() * 0.4);
// rotate camera
dbXRotateCamera(fCameraAngleX);
dbYRotateCamera(fCameraAngleY);
return;
}
As you can see, there's not a lot to it. Camera goes forward with up, backwards with down, strafe with left/right, and you turn the view with the mouse. It's almost straight out of the Tutorial provided with Dark GDK labeled "Game Level." I hope that's helpful!
"...The Protoss do not run from their enemies. Aiur is our homeworld, it is here that we shall make our stand!" -Aldaris