Guest User

Untitled

a guest
Jan 22nd, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. interface IController {
  2. void SetHandler( Action<Event> );
  3. void Update(); // invoked from the game loop, spams SetHandler for polling-type controllers
  4. }
  5.  
  6. class KeyboardController : IController { // probably reacts immediately to form events
  7. public KeyboardController( Form listento ) {
  8. ...
  9. }
  10. ...
  11. }
  12.  
  13. class XInputController : IController { // probably polls controller on this.Update();
  14. public XInputController( SlimDX.XInput.Controller ) {
  15. ...
  16. }
  17. ...
  18. }
  19.  
  20. class Event {
  21. public virtual bool IsLocal { get { return false; }}
  22. }
  23.  
  24. enum MenuNavigationType { Select, Cancel, Previous, Next, Increase, Decrease }
  25.  
  26. class MenuNavigationEvent : Event {
  27. public override bool IsLocal { get { return true; }}
  28. public MenuNavigationType Type;
  29. }
  30.  
  31. class UpdateGameControlsEvent : Event {
  32. public int ControlledObjectID;
  33. public Vector2 Manuvering, Aim;
  34. public bool Fire1, Fire2;
  35. // ...
  36. }
Add Comment
Please, Sign In to add comment