Пример #1
0
        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);
        }
Пример #2
0
 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();
 }
Пример #3
0
 public FrameBuilder WithBounds(float x, float y, int width, int height)
 {
     this.bounds = new RectangleGraphic(x.Round(), y.Round(), width, height);
     return(this);
 }
Пример #4
0
 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;
 }
Пример #5
0
 public FrameBuilder WithBounds(RectangleGraphic bounds)
 {
     this.bounds = bounds;
     return(this);
 }
Пример #6
0
 public override void Initialize(Stage stage)
 {
     base.Initialize(stage);
     Fill = GraphicData.GenerateGraphic("PlayerGraphicF") as RectangleGraphic;
 }
Пример #7
0
 public Enemy(Texture2D image, float x, float y, float scale, SpriteEffects spriteEffect, RectangleGraphic bounds)
     : base(image, x, y, scale, spriteEffect, bounds)
 {
 }
Пример #8
0
 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;
 }
Пример #9
0
 public EnhancedMapTile(Texture2D image, float x, float y, TileType tileType, float scale, SpriteEffects spriteEffect, RectangleGraphic bounds)
     : base(image, x, y, scale, spriteEffect, bounds, tileType)
 {
 }