public void Draw(FPCanvas canvas) { canvas.SetCurrentColor(Color.FromArgb(100, Color.White)); FPElevator.ElevatorTexture.Draw(new PointF(X, Y), WidthSegments, 1); canvas.DisableTexturing(); RectangleF start = elevatorStart.Rect; RectangleF end = this.Rect; canvas.SetCurrentColor(Color.FromArgb(255, 0, 255, 0)); canvas.DrawLine(start.MiddlePoint(), end.MiddlePoint()); }
public void Draw(FPCanvas canvas) { canvas.SetCurrentColor(Color.White); canvas.DisableBlend(); PointF offset = new PointF(FPMath.fmodf(backgroundOffset.X, 32.0f) - 32.0f, FPMath.fmodf(backgroundOffset.Y, 32.0f) - 32.0f); backgroundTexture.Draw(offset, (int)(Width / backgroundTexture.Width) + 3, (int)(Height / backgroundTexture.Height) + 2); foreach (var gameObject in gameObjects) { if (!gameObject.IsVisible) continue; if (!gameObject.IsTransparent) gameObject.Draw(canvas); } canvas.EnableBlend(); foreach (var gameObject in gameObjects) { if (!gameObject.IsVisible) continue; if (gameObject.IsTransparent) gameObject.Draw(canvas); } player.Draw(canvas); player.DrawSpeedUp(canvas); canvas.SetCurrentColor(Color.FromArgb(204, Color.White)); fontTexture.DrawText(string.Format("Diamonds: {0}/{1}", diamondsPicked, diamondsCount), new PointF(3.0f, 0.0f), 16, 16, 32, 13); string speedUpText = null; if (player.SpeedUpCounter > 0) speedUpText = string.Format(CultureInfo.InvariantCulture, "{0:f1}", (FPPlayer.maxSpeedUpCount - player.SpeedUpCounter) / 60.0f); if (!string.IsNullOrEmpty(speedUpText)) { canvas.SetCurrentColor(Color.FromArgb(204, 127, 255, 255)); fontTexture.DrawText(speedUpText, new PointF(430.0f, 285.0f), 16, 16, 32, 13); } }
private void DrawHandlesOnGameObject(FPCanvas canvas, FPGameObject gameObject) { RectangleF rect = gameObject.Rect; canvas.DisableTexturing(); canvas.SetCurrentColor(Color.FromArgb(204, Color.White)); canvas.DrawRectangle(rect); canvas.SetPointSize(6.0f); var draggedObject = DraggedObject; bool widthHandles = false; bool heightHandles = false; if (draggedObject != null) { widthHandles = draggedObject.WidthSegments > 0; heightHandles = draggedObject.HeightSegments > 0; } for (FPDragHandle handle = FPDragHandle.TopLeft; handle < FPDragHandle.Center; handle++) { if (!widthHandles && IsWidthHandle(handle)) continue; if (!heightHandles && IsHeightHandle(handle)) continue; if (handle == currentHandle) canvas.SetCurrentColor(Color.FromArgb(204, Color.Red)); else canvas.SetCurrentColor(Color.FromArgb(204, Color.Yellow)); PointF handlePoint = PointFromHandleAroundRect(handle, rect); canvas.DrawPoint(handlePoint); } }
public void DrawSpeedUp(FPCanvas canvas) { if (SpeedUpCounter <= 0) return; float value = Math.Abs(FPMath.sinf(Alpha)) * 0.5f + 0.5f; canvas.SetCurrentColor(Color.FromArgb((int)(255 * value), Color.White)); PointF position = new PointF(X - 16.0f, Y - 16.0f); jumpTexture.Draw(position); }
void DrawGrid(FPCanvas canvas) { Rectangle rect = levelView.ClientRectangle; rect.Offset(-(int)levelView.ViewOffset.X, -(int)levelView.ViewOffset.Y); rect.X /= 32; rect.Y /= 32; rect.X *= 32; rect.Y *= 32; canvas.SetCurrentColor(Color.FromArgb((int)(0.2 * 255), Color.White)); for (int y = rect.Top; y < rect.Bottom + 32; y += 32) canvas.DrawLine(new Point(rect.Left, y), new Point(rect.Right + 32, y)); for (int x = rect.Left; x < rect.Right + 32; x += 32) canvas.DrawLine(new Point(x, rect.Top), new Point(x, rect.Bottom + 32)); }