public static WindowManager Initialize <T>(Game game, UserCommandController <T> userCommandController) where T : Enum { if (null == game) { throw new ArgumentNullException(nameof(game)); } if (null == instance) { instance = new WindowManager(game); instance.AddUserCommandEvents(userCommandController); } return(instance); }
protected void AddUserCommandEvents <T>(UserCommandController <T> userCommandController) where T : Enum { if (null == userCommandController) { throw new ArgumentNullException(nameof(userCommandController)); } Game.Components.OfType <KeyboardInputGameComponent>().Single().AddInputHandler(EscapeKey); userCommandController.AddEvent(CommonUserCommand.PointerMoved, MouseMovedEvent); userCommandController.AddEvent(CommonUserCommand.PointerPressed, MousePressedEvent); userCommandController.AddEvent(CommonUserCommand.PointerDown, MouseDownEvent); userCommandController.AddEvent(CommonUserCommand.PointerReleased, MouseReleasedEvent); userCommandController.AddEvent(CommonUserCommand.PointerDragged, MouseDraggingEvent); userCommandController.AddEvent(CommonUserCommand.VerticalScrollChanged, WindowScrollEvent); }
public static WindowManager <TWindowType> Initialize <T, TWindowType>(Game game, UserCommandController <T> userCommandController) where T : Enum where TWindowType : Enum { if (null == game) { throw new ArgumentNullException(nameof(game)); } if (null == WindowManager <TWindowType> .Instance) { WindowManager <TWindowType> .Initialize(game); WindowManager <TWindowType> .Instance.AddUserCommandEvents(userCommandController); } return(WindowManager <TWindowType> .Instance); }