public override void Draw() { if (texture != null && alphaMap != null) { GUISystem.Instance.Renderer.DrawTexture(texture, textureUVRect, alphaMap, alphaMapUVRect, targetRect, rotation, textureColor.ToArgb()); if (OnRendering != null) { OnRendering(this, new GUIEventArgs()); } } }
//将指定的纹理旋转后绘制到小地图的目标区域,注意,目标区域和旋转中心使用小地图坐标系 private void DrawImageInMap(NResourceTexture2D texture, Rect sourceRect, Rect targetRect, float rotation, Vector2 rotCenter, Color4f color) { Vector2 srCenter = new Vector2(targetRect.left + targetRect.Width * 0.5f, targetRect.top + targetRect.Height * 0.5f); srCenter = MiniMapToScreen(srCenter); rotCenter = MiniMapToScreen(rotCenter); rotation += miniMap.BackgroundRenderComp.Rotation - (float)Math.PI; float width = targetRect.Width; float height = targetRect.Height; GUISystem.Instance.Renderer.DrawTexture(texture, sourceRect, new Rect(srCenter.x - width, srCenter.y - height, srCenter.x + width, srCenter.y + height), rotation, rotCenter, color.ToArgb()); }