/// <summary>
        ///
        /// </summary>
        /// <param name="sprite"></param>
        /// <param name="position"></param>
        /// <param name="size"></param>
        /// <param name="color"></param>
        public void Draw(ISprite sprite, BomberStuff.Core.Drawing.PointF position, BomberStuff.Core.Drawing.SizeF size, System.Drawing.Color color)
        {
            SDXSprite s = (SDXSprite)sprite;

            System.Diagnostics.Debug.Assert(s.Texture != null);

            float w = Form.ClientSize.Width;
            float h = Form.ClientSize.Height;

            Vector3 vPosition = new Vector3(w * position.X, h * position.Y, 0);

            Sprite.Draw((SDXSprite)sprite, new Vector3(), vPosition, color);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sprite"></param>
        /// <param name="position"></param>
        /// <param name="size"></param>
        /// <param name="color"></param>
        public void Draw(ISprite sprite, BomberStuff.Core.Drawing.PointF position, BomberStuff.Core.Drawing.SizeF size, System.Drawing.Color color)
        {
            Sprite    s = (Sprite)sprite;
            Rectangle src, dest;

            float w = Form.ClientSize.Width;
            float h = Form.ClientSize.Height;

            src  = new Rectangle(0, 0, s.Bitmap.Width, s.Bitmap.Height);
            dest = new Rectangle((int)Math.Round(w * position.X),
                                 (int)Math.Round(h * position.Y),
                                 (int)Math.Round(w * size.Width),
                                 (int)Math.Round(h * size.Height));

            Graphics.DrawImage(s.Bitmap, dest, src, GraphicsUnit.Pixel);
        }