Game Development Reference
In-Depth Information
public void Update(double elapsedTime)
{
if (_usingController)
{
Sdl.SDL_JoystickUpdate();
Controller.Update();
}
}
}
The Input class only supports one controller here, but it would be simple to
extend to several controllers if you wanted to support that.
Adding Better Mouse Support
The mouse support at the moment is quite minor. The position of the cursor
relative to the form is calculated in the form.cs and then this updates the input
class mouse position. The mouse input is bound to the form and so to some
extent the input class must be aware of the form. Make a new class called Mouse
in the Engine.Input namespace; this class will store information about the
current state of the mouse.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Engine.Input
{
public class Mouse
{
Form _parentForm;
Control _openGLControl;
public Point Position { get; set; }
public Mouse(Form form, Control openGLControl)
{
_parentForm = form;
_openGLControl = openGLControl;
}
 
Search WWH ::




Custom Search