コード例 #1
0
ファイル: ScoreIndicator.cs プロジェクト: ThuCommix/Sharpex2D
 /// <summary>
 /// Initializes a new ScoreIndicator class.
 /// </summary>
 public ScoreIndicator()
 {
     LifeTime = 750;
     Position = new Vector2(0);
     IsVisible = true;
     _font = new Font("Segoe UI", 18, TypefaceStyle.Bold);
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: ThuCommix/Sharpex2D
        /// <summary>
        ///     Initializes a new Player class.
        /// </summary>
        /// <param name="texture">The Texture.</param>
        /// <param name="texture2">The ErasedTexture.</param>
        public Player(Texture2D texture, Texture2D texture2)
        {
            _erased = texture2;
            Bounds = new Polygon(new Vector2(1, 6), new Vector2(5, 4), new Vector2(11, 0), new Vector2(22, 0), new Vector2(28, 6),
                new Vector2(28, 11), new Vector2(31, 15), new Vector2(28, 21), new Vector2(19, 21), new Vector2(18, 23),
                new Vector2(9, 23), new Vector2(0, 13), new Vector2(1, 7));
            _pen = new Pen(Color.White, 1);
            _spriteSheet = new AnimatedSpriteSheet(texture) {AutoUpdate = true};
            _spriteSheet.Add(new Keyframe(new Rectangle(0, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(32, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(64, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(96, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(128, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(160, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(192, 0, 32, 24), 100));

            _spriteSheet.Add(new Keyframe(new Rectangle(224, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(256, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(288, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(320, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(352, 0, 32, 24), 100));

            Position = new Vector2(300, 230);
            Velocity = new Vector2(0, 0);
        }
コード例 #3
0
ファイル: GamepadState.cs プロジェクト: ThuCommix/Sharpex2D
        /// <summary>
        /// Initializes a new GamepadState class.
        /// </summary>
        /// <param name="dpadUp">The DPadUp State.</param>
        /// <param name="dpadDown">The DPadDown State.</param>
        /// <param name="dpadLeft">The DPadLeft State.</param>
        /// <param name="dpadRight">The DPadRight State.</param>
        /// <param name="aPressed">The A button State.</param>
        /// <param name="bPressed">The B button State.</param>
        /// <param name="yPressed">The Y button State.</param>
        /// <param name="xPressed">The X button State.</param>
        /// <param name="backPressed">The Back button State.</param>
        /// <param name="startPressed">The Start button State.</param>
        /// <param name="leftShoulder">The LeftShoulder Button.</param>
        /// <param name="rightShoulder">The RightShoulder Button.</param>
        /// <param name="leftStick">The LeftstickState.</param>
        /// <param name="rightStick">The RightstickState</param>
        /// <param name="guide">The Guide State.</param>
        /// <param name="leftTrigger">The LeftTrigger.</param>
        /// <param name="rightTrigger">The RightTrigger.</param>
        /// <param name="thumbLeft">The Left Thumbstick Position.</param>
        /// <param name="thumbRight">The Right Thumbstick Position.</param>
        internal GamepadState(bool dpadUp, bool dpadDown, bool dpadLeft, bool dpadRight, bool aPressed, bool bPressed,
            bool yPressed, bool xPressed, bool backPressed, bool startPressed, bool leftShoulder, bool rightShoulder,
            bool leftStick, bool rightStick, bool guide, float leftTrigger, float rightTrigger, Vector2 thumbLeft,
            Vector2 thumbRight)
        {
            _states = new Dictionary<GamepadButtons, bool>();
            _states.Add(GamepadButtons.Up, dpadUp);
            _states.Add(GamepadButtons.Down, dpadDown);
            _states.Add(GamepadButtons.Left, dpadLeft);
            _states.Add(GamepadButtons.Right, dpadRight);
            _states.Add(GamepadButtons.A, aPressed);
            _states.Add(GamepadButtons.B, bPressed);
            _states.Add(GamepadButtons.Y, yPressed);
            _states.Add(GamepadButtons.X, xPressed);
            _states.Add(GamepadButtons.Back, backPressed);
            _states.Add(GamepadButtons.Start, startPressed);
            _states.Add(GamepadButtons.LeftShoulder, leftShoulder);
            _states.Add(GamepadButtons.RightShoulder, rightShoulder);
            _states.Add(GamepadButtons.LeftStick, leftStick);
            _states.Add(GamepadButtons.RightStick, rightStick);
            _states.Add(GamepadButtons.Guide, guide);

            LeftTrigger = leftTrigger;
            RightTrigger = rightTrigger;
            LeftThumbStick = new Vector2(thumbLeft.X, thumbLeft.Y);
            RightThumbStick = new Vector2(thumbRight.X, thumbRight.Y);
        }
コード例 #4
0
ファイル: Scoreboard.cs プロジェクト: ThuCommix/Sharpex2D
 /// <summary>
 /// Initializes a new Scoreboard class.
 /// </summary>
 public Scoreboard()
 {
     _scoreFont = new Font("Segoe UI", 30, TypefaceStyle.Bold);
     _healthFont = new Font("Segoe UI", 20, TypefaceStyle.Bold);
     _scorePosition = new Vector2(5, 0);
     _healthPosition = new Vector2(5, 40);
 }
コード例 #5
0
ファイル: FadeableText.cs プロジェクト: ThuCommix/Sharpex2D
 /// <summary>
 /// Initializes a new FadeableText.
 /// </summary>
 public FadeableText()
 {
     Text = "Fadeable Text1";
     Font = new Font("Segoe UI", 9, TypefaceStyle.Regular);
     Position = new Vector2(0, 0);
     FadeInVelocity = 1;
     FadeOutVelocity = 2;
 }
コード例 #6
0
ファイル: Ellipse.cs プロジェクト: ThuCommix/Sharpex2D
 /// <summary>
 /// Initializes a new Ellipse class.
 /// </summary>
 /// <param name="radiusX">The X-Radius.</param>
 /// <param name="radiusY">The Y-Radius.</param>
 /// <param name="Position">The position.</param>
 public Ellipse(float radiusX, float radiusY, Vector2 Position)
     : this()
 {
     RadiusX = radiusX;
     RadiusY = radiusY;
     _position = Position;
     _polygon = new Polygon();
     UpdateEllipse();
 }
コード例 #7
0
ファイル: MouseState.cs プロジェクト: ThuCommix/Sharpex2D
        /// <summary>
        /// Initializes a new MouseState class.
        /// </summary>
        /// <param name="reference">The Reference.</param>
        /// <param name="position">The Position.</param>
        internal MouseState(Dictionary<MouseButtons, bool> reference, Vector2 position)
        {
            Position = new Vector2(position.X, position.Y);
            _reference = new Dictionary<MouseButtons, bool>();

            foreach (KeyValuePair<MouseButtons, bool> pair in reference)
            {
                _reference.Add(pair.Key, pair.Value);
            }
        }
コード例 #8
0
ファイル: Pipe.cs プロジェクト: ThuCommix/Sharpex2D
        /// <summary>
        ///     Initializes a new Pipe class.
        /// </summary>
        public Pipe(int height, int gateway)
        {
            TopPipeHeight = height - 22;
            BottomPipeHeight = 480 - gateway - height;

            BottomPipeY = height + gateway + 22;

            GatewaySize = gateway;
            Position = new Vector2(200, 0);
        }
コード例 #9
0
ファイル: DirectXGraphics.cs プロジェクト: szlatyka/Sharpex2D
        /// <summary>
        /// Draws a Line between two points.
        /// </summary>
        /// <param name="pen">The Pen.</param>
        /// <param name="start">The Startpoint.</param>
        /// <param name="target">The Targetpoint.</param>
        public void DrawLine(Pen pen, Vector2 start, Vector2 target)
        {
            var dxPen = pen.Instance as DirectXPen;

            if (dxPen == null)
            {
                throw new ArgumentException("DirectX11 expects a DirectXPen as resource.");
            }
            DirectXHelper.RenderTarget.DrawLine(DirectXHelper.ConvertVector(start), DirectXHelper.ConvertVector(target),
                                                dxPen.GetPen(), dxPen.Width);
        }
コード例 #10
0
        /// <summary>
        /// Draws a string.
        /// </summary>
        /// <param name="text">The Text.</param>
        /// <param name="font">The Font.</param>
        /// <param name="position">The Position.</param>
        /// <param name="color">The Color.</param>
        public void DrawString(string text, Font font, Vector2 position, Color color)
        {
            var dxFont = font.Instance as DirectXFont;

            if (dxFont == null)
            {
                throw new ArgumentException("DirectX10 expects a DirectXFont as resource.");
            }

            _renderTarget.DrawText(text, dxFont.GetFont(),
                                   new RectangleF(position.X, position.Y, 9999, 9999), DirectXHelper.ConvertSolidColorBrush(color));
        }
コード例 #11
0
ファイル: MenuScene.cs プロジェクト: ThuCommix/Sharpex2D
        /// <summary>
        /// Initializes the scene.
        /// </summary>
        public override void Initialize()
        {
            _menuPosition = new Vector2(0, 0);

            _menuButton1 = new MenuButton(UIManager)
            {
                Text = "Start new game",
                Position = new Vector2(250, 200),
            };
            _menuButton3 = new MenuButton(UIManager)
            {
                Text = "Exit",
                Position = new Vector2(250, 240),
            };
        }
コード例 #12
0
        /// <summary>
        ///     Updates the object.
        /// </summary>
        /// <param name="gameTime">The GameTime.</param>
        public void Update(GameTime gameTime)
        {
            _position1 = new Vector2(_position1.X - 0.5f, _position1.Y);
            _position2 = new Vector2(_position2.X - 0.5f, _position2.Y);

            if (_position1.X <= -640)
            {
                _position1.X = 638;
            }

            if (_position2.X <= -640)
            {
                _position2.X = 638;
            }
        }
コード例 #13
0
        /// <summary>
        /// Draws a Texture.
        /// </summary>
        /// <param name="texture">The Texture.</param>
        /// <param name="position">The Position.</param>
        /// <param name="opacity">The Opacity.</param>
        /// <param name="color">The Color.</param>
        public void DrawTexture(Texture2D texture, Vector2 position, Color color, float opacity = 1)
        {
            var dxTexture = texture as DirectXTexture;

            if (dxTexture == null)
            {
                throw new ArgumentException("DirectX10 expects a DirectXTexture as resource.");
            }
            Bitmap dxBmp = dxTexture.GetBitmap();

            _renderTarget.DrawBitmap(dxBmp,
                                     new RectangleF(position.X, position.Y, texture.Width, texture.Height), opacity,
                                     InterpolationMode == InterpolationMode.Linear
                    ? SlimDX.Direct2D.InterpolationMode.Linear
                    : SlimDX.Direct2D.InterpolationMode.NearestNeighbor);
        }
コード例 #14
0
ファイル: Player.cs プロジェクト: ThuCommix/Sharpex2D
        /// <summary>
        /// Initializes a new Player class.
        /// </summary>
        /// <param name="playerTexture">The PlayerTexture.</param>
        public Player(Texture2D playerTexture)
        {
            Sprite = new AnimatedSpriteSheet(playerTexture) {AutoUpdate = true};

            Sprite.Add(new Keyframe(new Rectangle(0, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(115, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(230, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(345, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(460, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(575, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(690, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(805, 0, 115, 69), 50));

            Position = new Vector2(0, 190);
            Health = 100;
        }
コード例 #15
0
ファイル: DirectXGraphics.cs プロジェクト: szlatyka/Sharpex2D
        /// <summary>
        /// Draws a Texture.
        /// </summary>
        /// <param name="spriteSheet">The SpriteSheet.</param>
        /// <param name="position">The Position.</param>
        /// <param name="color">The Color.</param>
        /// <param name="opacity">The Opacity.</param>
        public void DrawTexture(SpriteSheet spriteSheet, Vector2 position, Color color, float opacity = 1)
        {
            var dxTexture = spriteSheet.Texture2D as DirectXTexture;

            if (dxTexture == null)
            {
                throw new ArgumentException("DirectX11 expects a DirectXTexture as resource.");
            }
            Bitmap dxBmp = dxTexture.GetBitmap();

            DirectXHelper.RenderTarget.DrawBitmap(dxBmp,
                                                  new RectangleF(position.X, position.Y, spriteSheet.Rectangle.Width, spriteSheet.Rectangle.Height),
                                                  opacity,
                                                  InterpolationMode == InterpolationMode.Linear
                    ? BitmapInterpolationMode.Linear
                    : BitmapInterpolationMode.NearestNeighbor, DirectXHelper.ConvertRectangle(spriteSheet.Rectangle));
        }
コード例 #16
0
ファイル: Enemy.cs プロジェクト: ThuCommix/Sharpex2D
        /// <summary>
        /// Initializes a new Enemy class.
        /// </summary>
        /// <param name="enemyTexture">The EnemyTexture.</param>
        public Enemy(Texture2D enemyTexture)
        {
            Sprite = new AnimatedSpriteSheet(enemyTexture) {AutoUpdate = true};

            Sprite.Add(new Keyframe(new Rectangle(0, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(47, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(94, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(141, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(188, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(235, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(282, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(329, 0, 47, 61), 30));

            Position = new Vector2(0, 0);
            Health = 100;
            MaximumHealth = Health;
            Velocity = 0.1f;
            _isVisible = true;
            EnableHPBar = true;
        }
コード例 #17
0
ファイル: Skybox.cs プロジェクト: ThuCommix/Sharpex2D
        /// <summary>
        /// Initializes a new Skybox class.
        /// </summary>
        /// <param name="skyTextures">The SkyTextures.</param>
        public Skybox(Texture2D[] skyTextures)
        {
            //Skybox supports 3 layers, background, layer 1, layer 2

            _background = skyTextures[0];
            _layer1 = skyTextures[1];
            _layer2 = skyTextures[2];

            _backgroundPosition = new Vector2(0, 0);
            _layer1Position1 = new Vector2(0, 0);
            _layer2Position1 = new Vector2(0, 0);

            _layer1Position2 = new Vector2(800, 0);
            _layer2Position2 = new Vector2(800, 0);

            _layer1Position3 = new Vector2(1600, 0);
            _layer2Position3 = new Vector2(1600, 0);

            IsActive = true;
        }
コード例 #18
0
ファイル: Explosion.cs プロジェクト: ThuCommix/Sharpex2D
        /// <summary>
        /// Initializes a new Explosion class.
        /// </summary>
        /// <param name="explosionTexture">The ExplosionTexture.</param>
        public Explosion(Texture2D explosionTexture)
        {
            Sprite = new AnimatedSpriteSheet(explosionTexture) {AutoUpdate = true};

            Sprite.Add(new Keyframe(new Rectangle(0, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(133.5f, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(267, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(400.5f, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(534, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(667.5f, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(801, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(934.5f, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(1068, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(1201.5f, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(1335, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(1468.5f, 0, 133.5f, 134), 20));

            Position = new Vector2(0, 0);
            _isVisible = true;
            RemainingLifeTime = 300;
        }
コード例 #19
0
        public override void OnDraw(SpriteBatch spriteBatch)
        {
            //if (AnimationComplete)
            //    return;

            if (this.IsMouseHoverState)
            {
                this.Pen.Color = Color.FromArgb((int)currentAlpha, 255, 255, 0);
            }
            else
            {
                this.Pen.Color = Color.FromArgb((int)currentAlpha, 255, 255, 255);
            }

            float x = (float)(this.Position.X + (double)(this.Size.Width / 2) - spriteBatch.MeasureString(this.Text, this.Font).X / 2.0);
            float y = (float)(this.Position.Y + (double)(this.Size.Height / 2) - spriteBatch.MeasureString(this.Text, this.Font).Y / 2.0);
            Vector2 center = new Vector2(x, y);

            spriteBatch.DrawRectangle(this.Pen, Sharpex2D.Common.Extensions.UIBoundsExtension.ToRectangle(this.Bounds));
            spriteBatch.DrawString(this.Text, this.Font, center, Color.FromArgb((int)currentAlpha, 255, 255, 255));
        }
コード例 #20
0
ファイル: UISize.cs プロジェクト: ThuCommix/Sharpex2D
 /// <summary>
 /// Initializes a new UISize class.
 /// </summary>
 public UISize()
 {
     _size = new Vector2(0, 0);
 }
コード例 #21
0
ファイル: Schlaeger.cs プロジェクト: LasterOfDesaster/Pong
 public Schlaeger(Vector2 startPosition)
 {
     this.Position = startPosition;
     inputManager = SGL.Components.Get<InputManager>();
     gd = SGL.Components.Get<GraphicsDevice>();
 }
コード例 #22
0
 /// <summary>
 ///     Initializes the AnimatedBackground class.
 /// </summary>
 /// <param name="bgTexture">The BackgroundTexture.</param>
 public AnimatedBackground(Texture2D bgTexture)
 {
     _texture = bgTexture;
     _position1 = new Vector2(0, 0);
     _position2 = new Vector2(638, 0);
 }
コード例 #23
0
ファイル: PauseScene.cs プロジェクト: LasterOfDesaster/Pong
        /// <summary>
        /// Zeichnen der Elemente
        /// </summary>
        /// <param name="spriteBatch"></param>
        /// <param name="gameTime"></param>
        public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            switch (SceneMode)
            {
                case SceneMode.FirstStart:
                    text = "Bereit?";
                    gameScene.Draw(spriteBatch, gameTime);
                    break;

                case SceneMode.Paused:
                    text = "Pausiert";
                    break;

                case SceneMode.WonLost:
                    break;

                case SceneMode.Scored:
                    text = "Bereit?";
                    gameScene.Draw(spriteBatch, gameTime);
                    break;

                default:
                    break;
            }
            font = new Font("Arial", 50, TypefaceStyle.Bold);
            position = new Vector2()
            {
                X = (graphicsDevice.BackBuffer.Width - spriteBatch.MeasureString(text, font).X) / 2,
                Y = 100
            };
            color = Color.White;
            spriteBatch.DrawString(text, font, position, color);
        }
コード例 #24
0
ファイル: Projectile.cs プロジェクト: ThuCommix/Sharpex2D
 /// <summary>
 /// Updates the projectile.
 /// </summary>
 /// <param name="gameTime">The GameTime.</param>
 public override void Update(GameTime gameTime)
 {
     Position = new Vector2(Position.X + (Velocity*gameTime.ElapsedGameTime), Position.Y);
     Bounds = new Rectangle(Position, new Vector2(46, 16));
 }
コード例 #25
0
ファイル: EntityComposer.cs プロジェクト: ThuCommix/Sharpex2D
        /// <summary>
        /// Creates a new explosion.
        /// </summary>
        /// <param name="position">The Position.</param>
        private void CreateExplosion(Vector2 position)
        {
            var explosion = new Explosion(_explosionTexture) {Position = position};

            Explosions.Add(explosion);
        }
コード例 #26
0
        /// <summary>
        /// Draws a Texture.
        /// </summary>
        /// <param name="spriteSheet">The SpriteSheet.</param>
        /// <param name="position">The Position.</param>
        /// <param name="color">The Color.</param>
        /// <param name="opacity">The Opacity.</param>
        public void DrawTexture(SpriteSheet spriteSheet, Vector2 position, Color color, float opacity = 1)
        {
            var dxTexture = spriteSheet.Texture2D as DirectXTexture;
            if (dxTexture == null) throw new ArgumentException("DirectX10 expects a DirectXTexture as resource.");
            Bitmap dxBmp = dxTexture.GetBitmap();

            DirectXHelper.RenderTarget.DrawBitmap(dxBmp,
                new RectangleF(position.X, position.Y, spriteSheet.Rectangle.Width, spriteSheet.Rectangle.Height),
                opacity,
                InterpolationMode == InterpolationMode.Linear
                    ? SlimDX.Direct2D.InterpolationMode.Linear
                    : SlimDX.Direct2D.InterpolationMode.NearestNeighbor,
                DirectXHelper.ConvertRectangleF(spriteSheet.Rectangle));
        }
コード例 #27
0
 /// <summary>
 /// Draws a Texture.
 /// </summary>
 /// <param name="texture">The Texture.</param>
 /// <param name="position">The Position.</param>
 /// <param name="opacity">The Opacity.</param>
 /// <param name="color">The Color.</param>
 public void DrawTexture(Texture2D texture, Vector2 position, Color color, float opacity = 1)
 {
     var dxTexture = texture as DirectXTexture;
     if (dxTexture == null) throw new ArgumentException("DirectX10 expects a DirectXTexture as resource.");
     Bitmap dxBmp = dxTexture.GetBitmap();
     _renderTarget.DrawBitmap(dxBmp,
         new RectangleF(position.X, position.Y, texture.Width, texture.Height), opacity,
         InterpolationMode == InterpolationMode.Linear
             ? SlimDX.Direct2D.InterpolationMode.Linear
             : SlimDX.Direct2D.InterpolationMode.NearestNeighbor);
 }
コード例 #28
0
        /// <summary>
        /// Draws a string.
        /// </summary>
        /// <param name="text">The Text.</param>
        /// <param name="font">The Font.</param>
        /// <param name="position">The Position.</param>
        /// <param name="color">The Color.</param>
        public void DrawString(string text, Font font, Vector2 position, Color color)
        {
            var dxFont = font.Instance as DirectXFont;
            if (dxFont == null) throw new ArgumentException("DirectX10 expects a DirectXFont as resource.");

            _renderTarget.DrawText(text, dxFont.GetFont(),
                new RectangleF(position.X, position.Y, 9999, 9999), DirectXHelper.ConvertSolidColorBrush(color));
        }
コード例 #29
0
        /// <summary>
        /// Draws a Line between two points.
        /// </summary>
        /// <param name="pen">The Pen.</param>
        /// <param name="start">The Startpoint.</param>
        /// <param name="target">The Targetpoint.</param>
        public void DrawLine(Pen pen, Vector2 start, Vector2 target)
        {
            var dxPen = pen.Instance as DirectXPen;
            if (dxPen == null) throw new ArgumentException("DirectX10 expects a DirectXPen as resource.");

            _renderTarget.DrawLine(dxPen.GetPen(), DirectXHelper.ConvertPointF(start),
                DirectXHelper.ConvertPointF(target));
        }
コード例 #30
0
ファイル: Tile.cs プロジェクト: klausklapper/strat-game
 /// <summary>
 /// Initializes a new instance of the <see cref="Tile"/> class.
 /// </summary>
 /// <param name="location">
 /// The location.
 /// </param>
 /// <param name="texture2D">
 /// The texture 2 d.
 /// </param>
 public Tile(Vector2 location, Texture2D texture2D)
 {
     this.Location = location;
     this.Texture2D = texture2D;
 }
コード例 #31
0
ファイル: Ellipse.cs プロジェクト: ThuCommix/Sharpex2D
 /// <summary>
 /// Initializes a new Ellipse class.
 /// </summary>
 /// <param name="Radiuses">Vector representing X and Y radiuses</param>
 /// <param name="radiusY">The position.</param>
 public Ellipse(Vector2 Radiuses, Vector2 Position)
     : this(Radiuses.X, Radiuses.Y, Position)
 {
 }
コード例 #32
0
ファイル: UISize.cs プロジェクト: ThuCommix/Sharpex2D
 /// <summary>
 /// Initializes a new UISize class.
 /// </summary>
 /// <param name="width">The Width.</param>
 /// <param name="height">The Height.</param>
 public UISize(int width, int height)
 {
     _size = new Vector2(width, height);
 }
コード例 #33
0
ファイル: Projectile.cs プロジェクト: ThuCommix/Sharpex2D
 /// <summary>
 /// Initializes a new Projectile class.
 /// </summary>
 /// <param name="projectileTexture">The ProjectileTexture.</param>
 public Projectile(Texture2D projectileTexture)
 {
     Texture = projectileTexture;
     Position = new Vector2(0);
     Bounds = new Rectangle(Position, new Vector2(46, 16));
 }
コード例 #34
0
ファイル: EntityComposer.cs プロジェクト: ThuCommix/Sharpex2D
 /// <summary>
 /// Creates a new DamageIndicator.
 /// </summary>
 /// <param name="position">The Position.</param>
 /// <param name="score">The Score.</param>
 /// <param name="color">The Color.</param>
 private void CreateScoreIndicator(Vector2 position, int score, Color color)
 {
     var indicator = new ScoreIndicator {Position = position, Score = score, Color = color};
     _scoreIndicators.Add(indicator);
 }