private void HandleMapEditorCameraRotation() { if (!_isInMapEditorMode) { return; } var screenResolution = ScreenUtility.GetScreenResolution(); if (Control.MouseButtons == MouseButtons.Right) { if (!_isRotatingMapEditorCamera) { Cursor.Position = new Point((int)screenResolution.X / 2, (int)screenResolution.Y / 2); } var deltaCursorPosition = new Vector2( Cursor.Position.X / screenResolution.X - 0.5f, Cursor.Position.Y / screenResolution.Y - 0.5f ); _mapEditorCamera.Rotate(new Vector3(-deltaCursorPosition.Y, 0, -deltaCursorPosition.X)); Cursor.Position = new Point((int)screenResolution.X / 2, (int)screenResolution.Y / 2); _isRotatingMapEditorCamera = true; } else { if (_isRotatingMapEditorCamera) { Cursor.Position = new Point((int)screenResolution.X / 2, (int)screenResolution.Y / 2); } Hud.ShowCursorThisFrame(); _isRotatingMapEditorCamera = false; } }
public override void Draw() { var screenResolution = ScreenUtility.GetScreenResolution(); var normalizedSize = new Vector2( AbsoluteSize.X / screenResolution.X, AbsoluteSize.Y / screenResolution.Y ); var normalizedPositionOffset = new Vector2( normalizedSize.X / 2, normalizedSize.Y ); var normalizedPosition = NormalizedScreenPosition + normalizedPositionOffset; NativeUtility.DrawRectangle(normalizedPosition, normalizedSize, Color); }