public ContentArea(Game game, string routeName, TrackContent trackContent, EnumArray <string, ColorSetting> colorPreferences, TrackViewerViewSettings viewSettings) : base(game) { if (null == game) { throw new ArgumentNullException(nameof(game)); } if (null == colorPreferences) { throw new ArgumentNullException(nameof(colorPreferences)); } Enabled = false; RouteName = routeName; TrackContent = trackContent ?? throw new ArgumentNullException(nameof(trackContent)); bounds = trackContent.Bounds; spriteBatch = new SpriteBatch(GraphicsDevice); fontManager = FontManager.Exact("Segoe UI", System.Drawing.FontStyle.Regular); inputComponent = game.Components.OfType <MouseInputGameComponent>().Single(); inputComponent.AddMouseEvent(MouseMovedEventType.MouseMoved, MouseMove); foreach (ColorSetting setting in EnumExtension.GetValues <ColorSetting>()) { UpdateColor(setting, ColorExtension.FromName(colorPreferences[setting])); } this.viewSettings = viewSettings; game.Window.ClientSizeChanged += Window_ClientSizeChanged; }
public WorldCoordinatesComponent(Game game, System.Drawing.Font font, Color color, Vector2 position) : base(game, font, color, position) { Enabled = false; Visible = false; input = Game.Components.OfType <MouseInputGameComponent>().Single(); this.font = font; }