Game Development Reference
In-Depth Information
LeftControlStick = new ControlStick(_joystick, 0, 1);
RightControlStick = new ControlStick(_joystick, 4, 3);
}
public void Update()
{
LeftControlStick.Update();
RightControlStick.Update();
}
Now that there are some controls on the controller, it can be used in the test state
to move things around. The Update function of InputTestState updates
the SDL joystick system and then updates the controller, updating all of its
control values.
public void Update(double elapsedTime)
{
if (_useJoystick == false)
{
return;
}
Sdl.SDL_JoystickUpdate();
_controller.Update();
}
public void Render()
{
if (_useJoystick == false)
{
return;
}
Gl.glDisable(Gl.GL_TEXTURE_2D);
Gl.glClearColor(1, 1, 1, 0);
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT);
Gl.glPointSize(10.0f);
Gl.glBegin(Gl.GL_POINTS);
{
Gl.glColor3f(1, 0, 0);
Gl.glVertex2f(
_controller.LeftControlStick.X * 300,
Search WWH ::




Custom Search