/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); GameInput.Input.Set(new TouchHandler()); GameInput.Input.Set(new KeyboardHandler()); _subscription = GameInput.If(c => c.WasReleased(Keys.Escape)).Call(c => Exit()); }
/// <summary> /// Bind a custom input subscription. /// </summary> /// <param name="input">The custom input subscription.</param> public void Bind(IInputSubscription input) { input.Subscribe(); _subscriptions.Add(new SubscriptionPair { Input = input }); }
/// <summary> /// Bind the results of a function to an action, and a custom input subscription. /// </summary> /// <param name="function">The function that computes a value to output.</param> /// <param name="action">The action to perform when new output is computed.</param> /// <param name="input">The custom input subscription.</param> /// <typeparam name="T">The 1st type parameter.</typeparam> public void Bind <T>(Func <T> function, Action <T> action, IInputSubscription input) { input.Subscribe(); _subscriptions.Add(new SubscriptionPair { Output = new Computed <T> (function).Subscribe(action), Input = input }); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); //Controller.GraphicsDeviceManager.IsFullScreen = true; //Controller.GraphicsDeviceManager.PreferredBackBufferWidth = Controller.GraphicsDevice.DisplayMode.Width; //Controller.GraphicsDeviceManager.PreferredBackBufferHeight = Controller.GraphicsDevice.DisplayMode.Height; //Controller.GraphicsDeviceManager.ToggleFullScreen(); GameInput.Input.Set(new TouchHandler()); GameInput.Input.Set(new MouseHandler()); GameInput.Input.Set(new KeyboardHandler()); _subscription = GameInput.If(c => c.WasReleased(Keys.Escape) || c.WasReleased(MouseButtons.X1)).Call(c => Exit()); }
public InputCallback(IInputSubscription subscription) { Subscription = subscription; }