public TextBox(int x, int y, int width, SpriteFont spriteFont, string defaultText = "", int characterLimit = -1, int borderThickness = 2) { box = new RectangleGraphic(x, y, width, spriteFont.LineSpacing + (borderThickness * 2)); box.Color = Color.White; box.BorderColor = Color.Black; box.BorderThickness = borderThickness; Text = defaultText; font = spriteFont; // make sure spacing between each letter is at least 1 so the cursor can fit inbetween if (spriteFont.Spacing < 1) { spriteFont.Spacing = 1; } if (spriteFont.DefaultCharacter == null) { spriteFont.DefaultCharacter = '?'; } CursorColor = Color.Black; BackColor = Color.White; BorderColor = Color.Black; TextColor = Color.Black; HighlightColor = new Color(50, 151, 253); // blue HighlightTextColor = Color.White; cursorBlinkTimer = new Stopwatch(); cursorBlinkTimer.SetWaitTime(500); cursorChangeTimer = new Stopwatch(); fontCharLength = (int)spriteFont.MeasureString("a").X; CharacterLimit = characterLimit; GameLoop.GameWindow.TextInput += Window_TextInput; clickTimer = new Stopwatch(); clickTimer.SetWaitTime(SystemInformation.DoubleClickTime); }
public HorizontalMovingPlatform(Texture2D image, Point startLocation, Point endLocation, TileType tileType, float scale, RectangleGraphic bounds, Direction startDirection) : base(image, startLocation.X, startLocation.Y, tileType, scale, SpriteEffects.None, bounds) { this.startLocation = startLocation; this.endLocation = endLocation; this.startDirection = startDirection; this.Initialize(); }
public FrameBuilder WithBounds(float x, float y, int width, int height) { this.bounds = new RectangleGraphic(x.Round(), y.Round(), width, height); return(this); }
public NPC(Texture2D image, float x, float y, int talkedToTime, float scale, SpriteEffects spriteEffect, RectangleGraphic bounds) : base(image, x, y, scale, spriteEffect, bounds) { this.message = CreateMessage(); this.talkedToTime = talkedToTime; }
public FrameBuilder WithBounds(RectangleGraphic bounds) { this.bounds = bounds; return(this); }
public override void Initialize(Stage stage) { base.Initialize(stage); Fill = GraphicData.GenerateGraphic("PlayerGraphicF") as RectangleGraphic; }
public Enemy(Texture2D image, float x, float y, float scale, SpriteEffects spriteEffect, RectangleGraphic bounds) : base(image, x, y, scale, spriteEffect, bounds) { }
public MapTile(Texture2D image, float x, float y, float scale, SpriteEffects spriteEffect, RectangleGraphic bounds, TileType tileType) : base(image, x, y, scale, spriteEffect, bounds) { TileType = tileType; }
public EnhancedMapTile(Texture2D image, float x, float y, TileType tileType, float scale, SpriteEffects spriteEffect, RectangleGraphic bounds) : base(image, x, y, scale, spriteEffect, bounds, tileType) { }