/// <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); } } }
/// <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.FontEngineDrawTextureSync(_textureNumber, x, y, nw, nh, uoff, voff, umax, vmax, color, localTransform.Matrix); } }
public static void DrawText(Font fnt, float xpos, float ypos, Color color, string text, int maxWidth, int fontHeight) { FontManagerDrawText draw; draw.FontHeight = fontHeight; draw.Fnt = fnt; draw.Xpos = xpos; draw.Ypos = ypos; draw.Color = color.ToArgb(); draw.Text = text; draw.Matrix = (float[, ])GUIGraphicsContext.GetFinalMatrix().Clone(); draw.Viewport = GUIGraphicsContext.DX9Device.Viewport; if (maxWidth >= 0) { draw.Viewport.Width = ((int)GUIGraphicsContext.GetFinalTransform().TransformXCoord(xpos + maxWidth, 0, 0)) - draw.Viewport.X; } _listDrawText.Add(draw); _spriteUsed = true; }