Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface IController {
- void SetHandler( Action<Event> );
- void Update(); // invoked from the game loop, spams SetHandler for polling-type controllers
- }
- class KeyboardController : IController { // probably reacts immediately to form events
- public KeyboardController( Form listento ) {
- ...
- }
- ...
- }
- class XInputController : IController { // probably polls controller on this.Update();
- public XInputController( SlimDX.XInput.Controller ) {
- ...
- }
- ...
- }
- class Event {
- public virtual bool IsLocal { get { return false; }}
- }
- enum MenuNavigationType { Select, Cancel, Previous, Next, Increase, Decrease }
- class MenuNavigationEvent : Event {
- public override bool IsLocal { get { return true; }}
- public MenuNavigationType Type;
- }
- class UpdateGameControlsEvent : Event {
- public int ControlledObjectID;
- public Vector2 Manuvering, Aim;
- public bool Fire1, Fire2;
- // ...
- }
Add Comment
Please, Sign In to add comment