public IEnumerable <IAggregator> GetAggregators(AggregationTarget target) { var aggegators = new List <IAggregator>(); if (target.HasTargetFlag(AggregationTarget.Mouse)) { yield return(new MouseControlAggregator(InputManager.Mouse)); } if (target.HasTargetFlag(AggregationTarget.Keyboard)) { yield return(Script.ForKeyboard(InputManager.KeyboardInputKeys)); } if (target.HasTargetFlag(AggregationTarget.GamePad)) { yield return(Script.ForGamePad(InputManager.GamePadInputKeys)); } if (target.HasTargetFlag(AggregationTarget.Touch)) { //not implemented yet } }
public GemGui(Game game, int targetResolutionWidth, int targetResolutionHeight, AggregationTarget aggregationTarget = AggregationTarget.All, TargetPlatform controlTarget = TargetPlatform.Windows, IConfigurationResolver configuration = null) { this.configuration = configuration ?? new DefaultConfiguration(); this.aggregationTarget = aggregationTarget; this.settings = new Settings(game, new Vector2(targetResolutionWidth, targetResolutionHeight)); this.controlFactory = this.configuration.GetControlFactory(controlTarget); this.HostTransition = () => TimedTransition.Default; this.screenManager = new ScreenManager(game, settings, DrawTheRest); this.style = new Style(new TextureFactory(game.GraphicsDevice)); game.Components.Add(screenManager); game.Components.Add(new Input.InputManager(game)); _fontContainer = new AssetContainer <SpriteFont>(game.Content); _textureContainer = new AssetContainer <Texture2D>(game.Content); }
/// <summary> /// Helper extension for AggregationTarget enum for checking if an instance has a specific flag. /// This is a Enum.HasFlag duplicate, but AggregationTarget specific, because HasFlag is has performance costs /// </summary> public static bool HasTargetFlag(this AggregationTarget target, AggregationTarget flag) { return((target & flag) != 0); }