Example #1
0
            /// <summary>
            /// Draw a texture rotated around (x,y) blended with a diffuse texture.
            /// </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>
            /// <param name="diffuseTextureNo"></param>
            /// <param name="uoffd"></param>
            /// <param name="voffd"></param>
            /// <param name="umaxd"></param>
            /// <param name="vmaxd"></param>
            public void Draw(float x, float y, float nw, float nh, float zrot, float uoff, float voff, float umax, float vmax,
                             uint color, int blendableTextureNo, float uoffd, float voffd, float umaxd, float vmaxd,
                             FontEngineBlendMode blendMode)
            {
                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.FontEngineDrawTexture2(_textureNumber, x, y, nw, nh, uoff, voff, umax, vmax,
                                                    color, localTransform.Matrix,
                                                    blendableTextureNo, uoffd, voffd, umaxd, vmaxd,
                                                    blendMode);
                }
                else
                {
                    if (logTextures)
                    {
                        Log.Info("fontengine:Draw() ERROR. Texture is disposed:{0} {1}", _textureNumber.ToString(), _imageName);
                    }
                }
            }
Example #2
0
        private void Calculate()
        {
            // If we have finished an animation, reset the animation state
            // We do this here (rather than in Animate()) as we need the
            // _currentProcess information in the UpdateStates() function of the
            // window and control classes.

            float offset = _amount;

            if (_tweener != null)
            {
                offset = _tweener.Tween(_amount, 0.0f, 1.0f, 1.0f);
            }

            if (_effect == EffectType.Fade)
            {
                _matrix.SetFader(((float)(_endAlpha - _startAlpha) * offset + _startAlpha) * 0.01f);
            }
            else if (_effect == EffectType.Slide)
            {
                _matrix.SetTranslation((_endX - _startX) * offset + _startX, (_endY - _startY) * offset + _startY, 0);
            }
            else if (_effect == EffectType.RotateX)
            {
                _matrix.SetXRotation(((_endX - _startX) * offset + _startX) * DEGREE_TO_RADIAN, _centerX, _centerY, 1.0f);
            }
            else if (_effect == EffectType.RotateY)
            {
                _matrix.SetYRotation(((_endX - _startX) * offset + _startX) * DEGREE_TO_RADIAN, _centerX, _centerY, 1.0f);
            }
            else if (_effect == EffectType.RotateZ)
            {
                if (_clockHandle != ClockHandleType.None)
                {
                    SetClock();
                }
                _matrix.SetZRotation(((_endX - _startX) * offset + _startX) * DEGREE_TO_RADIAN, _centerX, _centerY,
                                     GUIGraphicsContext.PixelRatio);
            }
            else if (_effect == EffectType.Zoom)
            {
                float scaleX = ((_endX - _startX) * offset + _startX) * 0.01f;
                float scaleY = ((_endY - _startY) * offset + _startY) * 0.01f;
                _matrix.SetScaler(scaleX, scaleY, _centerX, _centerY);
            }
        }
 /// <summary>
 /// Rotates the control transform matrix by the specified angle (in degrees) around the z-axis.
 /// </summary>
 public static void RotateZ(float angle, float x, float y)
 {
   var m = new TransformMatrix();
   angle *= DegreeToRadian;
   m.SetZRotation(angle, x, y, 1.0f);
   UpdateFinalTransform(ControlTransform.multiplyAssign(m));
 }
Example #4
0
 /// <summary>
 /// Rotates the control transform matrix by the specified angle (in degrees) around the z-axis.
 /// </summary>
 public static void RotateZ(float angle, float x, float y)
 {
   TransformMatrix m = new TransformMatrix();
   angle *= DEGREE_TO_RADIAN;
   m.SetZRotation(angle, x, y, 1.0f);
   UpdateFinalTransform(ControlTransform.multiplyAssign(m));
 }
      public void Draw(float x, float y, float nw, float nh, float zrot, float uoff, float voff, float umax, float vmax,
                       int 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);

          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);
          }
        }
      }
Example #6
0
    /// <summary>
    /// Draw a texture rotated around (x,y) blended with a diffuse texture.
    /// </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>
    /// <param name="diffuseTextureNo"></param>
    /// <param name="uoffd"></param>
    /// <param name="voffd"></param>
    /// <param name="umaxd"></param>
    /// <param name="vmaxd"></param>
    public void Draw(float x, float y, float nw, float nh, float zrot, float uoff, float voff, 
                     float umax, float vmax, uint color, int blendableTextureNo, float uoffd, 
                     float voffd, float umaxd, float vmaxd, FontEngineBlendMode blendMode)
    {
      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.FontEngineDrawTexture2(_textureNumber, x, y, nw, nh, uoff, voff, umax, vmax,
                               color, localTransform.Matrix,
                               blendableTextureNo, uoffd, voffd, umaxd, vmaxd,
                               blendMode);
      }
    }