示例#1
0
        //绘画图片
        public bool DrawImage(Device pD3DDevice, CPoint ptRotationOffset, double fRadian, char chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight, int cbAlpha)
        {
            if (_Sprite == null)
            {
                return(false);
            }

            if (fRadian == FishDefine.M_PI)
            {
                float degrees1 = (float)(fRadian * (180 / FishDefine.M_PI));
            }

            float degrees = (float)(fRadian * (180 / FishDefine.M_PI));

            Rectangle srcRectangle = new Rectangle(nXSource, nYSource, nSourceWidth, nSourceHeight);

            //Color color = Color.FromArgb( cbAlpha, Color.White );

            _Sprite.Begin(SpriteFlags.SortTexture | SpriteFlags.AlphaBlend);
            //sprite.Draw(_Texture, srcRectangle, Vector3.Empty, new Vector3(nXDest, nYDest, 0), cbAlpha );

            //_Sprite.Transform = Matrix.Scaling((float)nDestWidth / nSourceWidth, (float)nDestHeight / nSourceHeight, 0.0f);

            _Sprite.Transform = Matrix.RotationZ((float)-fRadian) * Matrix.Scaling((float)nDestWidth / nSourceWidth, (float)nDestHeight / nSourceHeight, 0.0f) * Matrix.Translation(nXDest, nYDest, 0);

            _Sprite.Draw(_Texture, srcRectangle, new Vector3(ptRotationOffset.x, ptRotationOffset.y, 0), new Vector3(0, 0, 0), Color.FromArgb(cbAlpha, Color.White).ToArgb());

            //_Sprite.Draw(_Texture, Vector3.Empty, new Vector3(nXDest, nYDest, 0), Color.White.ToArgb());
            _Sprite.End();

            //sprite.Begin(SpriteFlags.None);
            //sprite.Draw2D(_Texture, Rectangle.Empty, Rectangle.Empty,
            //              new Point(5, 5), Color.White);
            //sprite.End();

            return(true);
        }
示例#2
0
 //绘画函数
 //绘画图片
 public bool DrawImage(Device pD3DDevice, CPoint ptRotationOffset, double fRadian, char chDirection, int nXDest, int nYDest, int cbAlpha)
 {
     return(DrawImage(pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, m_ImageSize.cx, m_ImageSize.cy, 0, 0, cbAlpha));
 }
示例#3
0
 //绘画图片
 public bool DrawImage(Device pD3DDevice, CPoint ptRotationOffset, double fRadian, char chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int cbAlpha)
 {
     // ok
     return(DrawImage(pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nDestWidth, nDestHeight, cbAlpha));
 }
示例#4
0
 //绘画图片
 public bool DrawImage(Device pD3DDevice, CPoint ptRotationOffset, double fRadian, char chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource)
 {
     return(DrawImage(pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, m_ImageSize.cx - nXSource, m_ImageSize.cy - nYSource, 255));
 }