Beispiel #1
0
 /// <summary>
 /// Draw a texture.
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="nw"></param>
 /// <param name="nh"></param>
 /// <param name="uoff"></param>
 /// <param name="voff"></param>
 /// <param name="umax"></param>
 /// <param name="vmax"></param>
 /// <param name="color"></param>
 public void Draw(float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax, uint color)
 {
     //string logline=String.Format("draw:#{0} {1} {2} {3} {4}",_textureNumber,x,y,nw,nh);
     //Trace.WriteLine(logline);
     if (_textureNumber >= 0)
     {
         float[,] matrix = GUIGraphicsContext.GetFinalMatrix();
         DXNative.FontEngineDrawTexture(_textureNumber, x, y, nw, nh, uoff, voff, umax, vmax, color, matrix);
     }
     else
     {
         if (logTextures)
         {
             Log.Info("fontengine:Draw() ERROR. Texture is disposed:{0} {1}", _textureNumber.ToString(), _imageName);
         }
     }
 }
Beispiel #2
0
            /// <summary>
            /// Draw a texture rotated around (x,y).
            /// </summary>
            /// <param name="x"></param>
            /// <param name="y"></param>
            /// <param name="nw"></param>
            /// <param name="nh"></param>
            /// <param name="zrot"></param>
            /// <param name="uoff"></param>
            /// <param name="voff"></param>
            /// <param name="umax"></param>
            /// <param name="vmax"></param>
            /// <param name="color"></param>
            public void Draw(float x, float y, float nw, float nh, float zrot, float uoff, float voff, float umax, float vmax,
                             uint color)
            {
                if (_textureNumber >= 0)
                {
                    // Rotate around the x,y point of the specified rectangle; maintain aspect ratio (1.0f)
                    TransformMatrix localTransform = new TransformMatrix();
                    localTransform.SetZRotation(zrot, x, y, 1.0f);
                    TransformMatrix finalTransform = GUIGraphicsContext.GetFinalTransform();
                    localTransform = finalTransform.multiply(localTransform);

                    DXNative.FontEngineDrawTexture(_textureNumber, x, y, nw, nh, uoff, voff, umax, vmax, color, localTransform.Matrix);
                }
                else
                {
                    if (logTextures)
                    {
                        Log.Info("fontengine:Draw() ERROR. Texture is disposed:{0} {1}", _textureNumber.ToString(), _imageName);
                    }
                }
            }