public void Draw(IRenderContext context, IRenderer renderer) { if (!p_Enabled) { return; } Monitor.Enter(p_Mutex); //allocate the cursor if (p_CursorTexture == null) { p_CursorTexture = context.AllocateTexture(getCursorBitmap(), "cursor"); } //get the current mouse position relative to the window Point mousePosition = p_Game.PointToClient(Cursor.Position); /*draw arrow?*/ if (p_CurrentArrow != Direction.NONE) { int mouseX = mousePosition.X; int mouseY = mousePosition.Y; int width = p_Size.Width; int height = p_Size.Height; //white polygon renderer.SetBrush(Brushes.White); /*draw all polygons for the arrow on screen and translate * position and scale*/ int polyLength = p_Polygon.Length; for (int y = 0; y < polyLength; y++) { PointF[] scale = p_Polygon[y]; int pointLength = scale.Length; Point[] points = new Point[pointLength]; for (int x = 0; x < pointLength; x++) { PointF p = scale[x]; points[x] = new Point( (int)(p.X * width) + mouseX, (int)(p.Y * height) + mouseY); } //draw poly renderer.FillPoly(points); } Monitor.Exit(p_Mutex); return; } renderer.SetTexture(p_CursorTexture); renderer.DrawTextureUnscaled( mousePosition.X, mousePosition.Y); Monitor.Exit(p_Mutex); }