private void InitializeComponent() { EnableDragging = false; _return = new ButtonControl(); _mainMenu = new ButtonControl(); _exit = new ButtonControl(); // new game _return.Text = "Return"; _return.Bounds = new UniRectangle(15, 15, 150, 45); // continue _mainMenu.Text = "Main Menu"; _mainMenu.Bounds = new UniRectangle(15, 65, 150, 45); // load game _exit.Text = "Exit"; _exit.Bounds = new UniRectangle(15, 115, 150, 45); Children.Add(_return); Children.Add(_mainMenu); Children.Add(_exit); Bounds = new UniRectangle(10, 10, 180, 175); }
public override void LoadContent(DeviceContext context) { if (_mapImage == null) { return; } var playerMarker = new Bitmap(16, 16); using (var g = Graphics.FromImage(playerMarker)) { g.DrawLine(Pens.Black, 0, 8, 16, 8); g.DrawLine(Pens.Black, 8, 0, 8, 16); } var innerBounds = new UniRectangle(4, 24, _mapWindow.Bounds.Size.X - 4 - 3, _mapWindow.Bounds.Size.Y - 24 - 3); _mapControl = new MapControl { MarkerPosition = new Point(), PlayerMarker = ToDispose(new SpriteTexture(_engine.Device, playerMarker, new SharpDX.Vector2(), _engine.IsB8G8R8A8_UNormSupport)), MapTexture = ToDispose(new SpriteTexture(_engine.Device, _mapImage, new SharpDX.Vector2(), _engine.IsB8G8R8A8_UNormSupport)), Bounds = innerBounds }; _mapWindow.Children.Add(_mapControl); }
public ConsoleWindow(PythonInterpreter python, Screen screen, int width, int height) { _state = ConsoleState.Closed; _screen = screen; _python = python; EnableDragging = false; Width = width; Height = height; Bounds = new UniRectangle(20, ClosedY, Width, Height); Outputs = new List <ConsoleOutput>(); SetupControls(); // Whenever a new item is added to the output list scroll the slider to the bottom var outputList = OutputList.Items as ObservableList <string>; if (outputList != null) { outputList.ItemAdded += OutputListOnItemAdded; } }
private void InitializeComponent() { EnableDragging = false; _dialogText = new LabelControl(); _dialogText.Bounds = new UniRectangle( new UniScalar(0.0f, 15.0f), new UniScalar(0.0f, 15.0f), new UniScalar(1.0f, -30.0f), new UniScalar(1.0f, -85.0f) ); Children.Add(_dialogText); _optionsList = new ListControl(); _optionsList.Bounds = new UniRectangle(10, 10, new UniScalar(1, -20), 150); _optionsList.SelectionMode = ListSelectionMode.Single; _nextButton = new ButtonControl(); _nextButton.Text = "Continue"; _nextButton.Bounds = new UniRectangle( new UniScalar(1.0f, -110), new UniScalar(1.0f, -55f), new UniScalar(100), new UniScalar(45) ); Children.Add(_nextButton); Bounds = new UniRectangle( new UniScalar(0.0f, 0.0f), new UniScalar(1.0f, -225.0f), new UniScalar(1.0f, 0.0f), new UniScalar(0.0f, 225.0f) ); }
public ItemInfoWindow(IconFactory iconFactory, InputsManager inputManager) { _iconFactory = iconFactory; Title = "Information"; Bounds = new UniRectangle(700, 120, 200, 240); _cell = new InventoryCell(null, _iconFactory, new Vector2I(), inputManager) { DrawCellBackground = false, Bounds = new UniRectangle(10, 30, 64, 64) }; _nameLabel = new LabelControl { Bounds = new UniRectangle(80, 50, 100, 20), Autosizing = true }; _descriptionLabel = new LabelControl { Bounds = new UniRectangle(10, 80, 180, 100), Autosizing = true }; Children.Add(_descriptionLabel); Children.Add(_nameLabel); Children.Add(_cell); }
private void InitializeComponent() { Bounds = new UniRectangle( 10, 10, new UniScalar(1.0f, -20), 35 ); var label = new LabelControl(); label.Text = _ability.Name; label.Bounds = new UniRectangle(10, 5, 180, 30); Children.Add(label); label = new LabelControl(); label.Text = ((int)(_exp / 100)).ToString(); label.Bounds = new UniRectangle(190, 5, 30, 30); Children.Add(label); var progress = new ProgressControl(); progress.Progress = (_exp % 100) / 100.0f; progress.Bounds = new UniRectangle(225, 5, new UniScalar(1.0f, -270), new UniScalar(1.0f, -5.0f)); Children.Add(progress); label = new LabelControl(); label.Text = ((int)(_exp % 100)).ToString(); label.Bounds = new UniRectangle(new UniScalar(1.0f, -35), 5, 30, 30); Children.Add(label); }
private void InitializeComponent() { EnableDragging = false; Bounds = new UniRectangle( new UniScalar(0.0f, 0.0f), new UniScalar(0.0f, 0.0f), new UniScalar(1.0f, 0.0f), new UniScalar(0.0f, 95.0f) ); _statusButton = new ButtonControl(); _statusButton.Text = "Status"; _statusButton.Bounds = new UniRectangle( new UniScalar(0.025f, 0.0f), new UniScalar(0.0f, 15.0f), new UniScalar(0.30f, 0.0f), new UniScalar(0.0f, 65.0f) ); Children.Add(_statusButton); _inventoryButton = new ButtonControl(); _inventoryButton.Text = "Inventory"; _inventoryButton.Bounds = new UniRectangle( new UniScalar(0.35f, 0.0f), new UniScalar(0.0f, 15.0f), new UniScalar(0.30f, 0.0f), new UniScalar(0.0f, 65.0f) ); Children.Add(_inventoryButton); _settingsButton = new ButtonControl(); _settingsButton.Text = "Settings"; _settingsButton.Bounds = new UniRectangle( new UniScalar(0.675f, 0.0f), new UniScalar(0.0f, 15.0f), new UniScalar(0.30f, 0.0f), new UniScalar(0.0f, 65.0f) ); Children.Add(_settingsButton); }
private void InitializeComponent() { Bounds = new UniRectangle( new UniScalar(0.0f, 0.0f), new UniScalar(0.0f, 105.0f), new UniScalar(1.0f, 0.0f), new UniScalar(1.0f, -105.0f) ); EnableDragging = false; }
public DebugPerfControl(Control parent, UniRectangle bounds, Game game) { _game = game; this.Bounds = bounds; parent.Children.Add(this); BuildWindow(); }
protected Control(IContext context, string id, UniRectangle coordinates) : base(context, id) { Coordinates = coordinates; Overlay = false; Hovered = false; Visible = true; }
public TogglableButton(IContext context, string id, UniRectangle coordinates, string normalTexturePath, string toggledTexturePath, int radius = 0) : base(context, id, coordinates) { _normalTexturePath = normalTexturePath; _toggledTexturePath = toggledTexturePath; _radius = radius; CurrentState = State.Normal; }
public void DrawCustomTexture(SpriteTexture customTex, ref Rectangle textureSourceRect, ref RectangleF bounds, int groupId = 0) { var offset = new UniRectangle(0, 0, bounds.Width, bounds.Height); var destinationRegion = calculateDestinationRectangle( ref bounds, ref offset ); spriteRenderer.Draw(customTex, ref destinationRegion, ref textureSourceRect, ref _defaultColor, groupId); }
private void InitializeComponent() { EnableDragging = false; _controls = new List <QueuedCommandControl>(); Bounds = new UniRectangle( new UniScalar(0.0f, 0.0f), new UniScalar(1.0f, 0.0f), new UniScalar(0.0f, 300.0f), new UniScalar(0.0f, 100.0f) ); UpdateControls(); }
public GameComponentControl(Control parent, UniRectangle bounds, Game game) { this.Bounds = bounds; parent.Children.Add(this); _game = game; _game.GameComponents.ComponentAdded += GameComponents_Changed; _game.GameComponents.ComponentRemoved += GameComponents_Changed; BuildWindow(); }
public KeyBindingSettingsPanel(SettingsComponent parent, D3DEngine engine, UniRectangle bound) { _engine = engine; _engine.ScreenSize_Updated += engine_ScreenSize_Updated; _panelName = "Key Bindings"; _parent = parent; this.Bounds = bound; this.IsRendable = false; InitializeComponent(); }
public TooltipControl() { IsClickTransparent = true; Bounds = new UniRectangle(0, 0, 200, 100); _label = new LabelControl("description here") { Autosizing = true }; _label.Bounds = new UniRectangle(new UniScalar(0, 10), new UniScalar(0, 30), new UniScalar(1, 0), new UniScalar(1, 0)); Children.Add(_label); }
/// <summary> /// Draw a string with the given font, inside a fixed rectangle with the given horizontal and vertical alignment inside that rectangle. /// </summary> /// <param name="text">The string to write.</param> /// <param name="font">The font to use to draw. This must be y <see cref="FontDescriptor"/> object.</param> /// <param name="rect">The bounding rectangle to draw the string in.</param> /// <param name="hAlign">The horizontal alignment of the string within the bounding rectangle.</param> /// <param name="vAlign">The vertical alignment of the string within the bounding rectangle.</param> /// <exception cref="ArgumentException" />Thrown if the <see cref="IFontDescriptor" /> paramter is not a <see cref="FontDescriptor" /> object. public void DrawString(string text, IFontDescriptor font, UniRectangle rect, HorizontalAlignment hAlign, VerticalAlignment vAlign) { if (!(font is FontDescriptor ourFont)) { throw new ArgumentException(Resources.Error_FontDescriptorOfWrongSpecificType, nameof(font)); } if (rect is null) { throw new ArgumentNullException(nameof(rect)); } _core.DrawString(text, ourFont.Font, XBrushes.Black, new XRect(rect.Left, rect.Top, rect.Width, rect.Height), GetStringFormat(hAlign, vAlign)); }
/// <summary> /// Moves the control to a new location /// @Added by Steven /// </summary> /// <param name="offSetX"></param> /// <param name="offSetY"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="center"></param> /// <param name="XPos"></param> /// <param name="YPos"></param> /// <returns></returns> public static UniRectangle CenterBound(int offSetX, int offSetY, int width, int height, bool center = true, float XPos = 0.0f, float YPos = 0.0f) { if (center) { XPos = 0.5f; YPos = 0.5f; offSetX = offSetX + (-1 * width / 2); offSetY = offSetY + (-1 * height / 2); } UniRectangle bounds = new UniRectangle( new UniScalar(XPos, offSetX), new UniScalar(YPos, offSetY), width, height); return(bounds); }
private void InitializeComponent() { EnableDragging = false; Bounds = new UniRectangle( new UniScalar(0.2f, 15.0f), new UniScalar(0.0f, 105.0f), new UniScalar(0.8f, -15.0f), new UniScalar(1.0f, -105.0f) ); // // overview dialog // _overviewDialog = new CharacterOverviewDialog(); _overviewDialog.Bounds = new UniRectangle( new UniScalar(20), new UniScalar(0, 20.0F), new UniScalar(0.6F, -40.0F), new UniScalar(0.0f, 200.0f) ); Children.Add(_overviewDialog); // // stats dialog // _statsDialog = new CharacterStatsDialog(); _statsDialog.Bounds = new UniRectangle( new UniScalar(0.6F, 0F), new UniScalar(0.0F, 20.0F), new UniScalar(0.4F, -20.0F), new UniScalar(0.0f, 200.0f) ); Children.Add(_statsDialog); // // inventory dialog // _inventoryDialog = new CharacterInventoryDialog(); _inventoryDialog.Bounds = new UniRectangle( new UniScalar(0.0F, 20.0F), new UniScalar(0.0F, 233.0F), new UniScalar(0.6F, -40.0F), new UniScalar(0.0f, 152.0f) ); Children.Add(_inventoryDialog); // // ability dialog // _abilityDialog = new CharacterAbilityDialog(); _abilityDialog.Bounds = new UniRectangle( new UniScalar(20), new UniScalar(400), new UniScalar(1.0f, -40), new UniScalar(1.0f, -420.0f) ); Children.Add(_abilityDialog); }
public DebugOptionsControl(Control parent, UniRectangle bounds, Game game, DisplayInfo displayinfo, GeneralDebugComponent fps) { this.Bounds = bounds; parent.Children.Add(this); _fps = fps; _game = game; _displayinfo = displayinfo; BuildWindow(); }
private void ResizeTo(float x, float y) { var OldBounds = Bounds; var diffX = x - _grabX; var diffY = y - _grabY; var boundsX = Bounds.Size.X; var boundsY = Bounds.Size.Y; var locX = Bounds.Location.X; var locY = Bounds.Location.Y; if (_resizingSides.HasFlag(ResizingSides.Right)) { boundsX = new UniScalar(boundsX.Fraction, boundsX.Offset + diffX); } if (_resizingSides.HasFlag(ResizingSides.Left)) { boundsX = new UniScalar(boundsX.Fraction, boundsX.Offset - diffX); locX = new UniScalar(locX.Fraction, locX.Offset + diffX); } if (_resizingSides.HasFlag(ResizingSides.Bottom)) { boundsY = new UniScalar(boundsY.Fraction, boundsY.Offset + diffY); } if (_resizingSides.HasFlag(ResizingSides.Top)) { boundsY = new UniScalar(boundsY.Fraction, boundsY.Offset - diffY); locY = new UniScalar(locY.Fraction, locY.Offset + diffY); } Bounds = new UniRectangle(new UniVector(locX, locY), new UniVector(boundsX, boundsY)); if (GetAbsoluteBounds().Size.Width < 20 || GetAbsoluteBounds().Size.Height < 20) //Too Small { Bounds = OldBounds; } else { if (_resizingSides.HasFlag(ResizingSides.Right)) { _grabX = x; } if (_resizingSides.HasFlag(ResizingSides.Bottom)) { _grabY = y; } OnResize(OldBounds); } }
//the 2 DrawCustomTexture! public void DrawCustomTexture(SpriteTexture customTex, ref RectangleF bounds, int textureArrayIndex = 0, int groupId = 0, ByteColor?color = null) { var offset = new UniRectangle(0, 0, bounds.Width, bounds.Height); var destinationRegion = calculateDestinationRectangle( ref bounds, ref offset ); if (!color.HasValue) { color = _defaultColor; } ByteColor drawColor = color.Value; Rectangle srcRegion = new Rectangle(0, 0, customTex.Width, customTex.Height); spriteRenderer.Draw(customTex, ref destinationRegion, ref srcRegion, ref drawColor, textureArrayIndex, true, groupId); }
public PieChart(IContext context, string id, UniRectangle coordinates, int sliceNumber, Func <List <Tuple <CustomColor, double, string, string> > > valuesGenerator) : base(context, id, coordinates) { _sliceNumber = sliceNumber; _valuesGenerator = valuesGenerator; _shader = Context.Shaders.Get <Texture1DShader>(); var vertices = new VertexDefinition.PositionTexture[_sliceNumber * 3]; for (int i = 0; i < sliceNumber; i++) { Vector2 texture = new Vector2((0.5f + i) / _sliceNumber, 0.5f); vertices[i * 3] = new VertexDefinition.PositionTexture { texture = texture, position = new Vector3(0, 0, 0) }; vertices[i * 3 + 1] = new VertexDefinition.PositionTexture { texture = texture, position = new Vector3((float)Math.Sin(i * (Math.PI * 2) / _sliceNumber), -(float)Math.Cos(i * (Math.PI * 2) / _sliceNumber), 0) }; vertices[i * 3 + 2] = new VertexDefinition.PositionTexture { texture = texture, position = new Vector3((float)Math.Sin((i + 1) * (Math.PI * 2) / _sliceNumber), -(float)Math.Cos((i + 1) * (Math.PI * 2) / _sliceNumber), 0) }; } _vertexBuffer = Buffer.Create(context.DirectX.Device, vertices, new BufferDescription { Usage = ResourceUsage.Dynamic, SizeInBytes = Utilities.SizeOf <VertexDefinition.PositionTexture>() * _sliceNumber * 3, BindFlags = BindFlags.VertexBuffer, CpuAccessFlags = CpuAccessFlags.Write, OptionFlags = ResourceOptionFlags.None, StructureByteStride = 0 }); _data = new List <PieChartInfo> { new PieChartInfo(_sliceNumber, new CustomColor(0.2f, 0.2f, 0.2f), "NA", "NA") }; _colorTexture = GenerateTexture(Context, _sliceNumber); }
public SandboxToolBar(D3DEngine engine, PlayerEntityManager player, IconFactory iconFactory, InputsManager inputManager, EntityFactory factory ) : base(player, iconFactory, inputManager, factory) { _stBackground = new SpriteTexture(engine.Device, @"Images\Inventory\toolbar_bg.png"); _stToolbarSlot = new SpriteTexture(engine.Device, @"Images\Inventory\toolbar_slot.png"); _stToolbatSlotHover = new SpriteTexture(engine.Device, @"Images\Inventory\toolbar_slot_active.png"); Background = _stBackground; Bounds = new UniRectangle(0, 0, 656, 116); var offset = new Vector2I(50, 48); var size = new Vector2I(57, 57); for (int i = 0; i < _toolbarSlots.Count; i++) { var inventoryCell = _toolbarSlots[i]; inventoryCell.Bounds = new UniRectangle(offset.X + (size.X) * i, offset.Y, 42, 42); inventoryCell.CustomBackground = _stToolbarSlot; inventoryCell.CustomBackgroundHover = _stToolbatSlotHover; inventoryCell.DrawIconsGroupId = 3; inventoryCell.DrawIconsActiveCellId = 4; inventoryCell.Color = new ByteColor(255, 255, 255, 120); var label = new LabelControl { Text = (i + 1).ToString(), IsClickTransparent = true, Color = new ByteColor(255, 255, 255, 80), Bounds = new UniRectangle(offset.X + (size.X) * i + 18, offset.Y + 42, 10, 10), IsVisible = inventoryCell.Slot != null }; _numbersLabels.Add(label); Children.Add(label); } SlotChanged += SandboxToolBar_SlotChanged; }
public PieChart(IContext context, string id, UniRectangle coordinates, int sliceNumber, Func<List<Tuple<CustomColor, double, string, string>>> valuesGenerator) : base(context, id, coordinates) { _sliceNumber = sliceNumber; _valuesGenerator = valuesGenerator; _shader = Context.Shaders.Get<Texture1DShader>(); var vertices = new VertexDefinition.PositionTexture[_sliceNumber * 3]; for (int i = 0; i < sliceNumber; i++) { Vector2 texture = new Vector2((0.5f + i)/_sliceNumber, 0.5f); vertices[i * 3] = new VertexDefinition.PositionTexture { texture = texture, position = new Vector3(0, 0, 0) }; vertices[i * 3 + 1] = new VertexDefinition.PositionTexture { texture = texture, position = new Vector3((float)Math.Sin(i*(Math.PI * 2) / _sliceNumber), -(float)Math.Cos(i*(Math.PI * 2) / _sliceNumber), 0) }; vertices[i * 3 + 2] = new VertexDefinition.PositionTexture { texture = texture, position = new Vector3((float)Math.Sin((i+1) * (Math.PI * 2) / _sliceNumber), -(float)Math.Cos((i+1) * (Math.PI * 2) / _sliceNumber), 0) }; } _vertexBuffer = Buffer.Create(context.DirectX.Device, vertices, new BufferDescription { Usage = ResourceUsage.Dynamic, SizeInBytes = Utilities.SizeOf<VertexDefinition.PositionTexture>() * _sliceNumber * 3, BindFlags = BindFlags.VertexBuffer, CpuAccessFlags = CpuAccessFlags.Write, OptionFlags = ResourceOptionFlags.None, StructureByteStride = 0 }); _data = new List<PieChartInfo> { new PieChartInfo(_sliceNumber, new CustomColor(0.2f, 0.2f, 0.2f), "NA", "NA") }; _colorTexture = GenerateTexture(Context, _sliceNumber); }
public void DrawCustomTexture(SpriteTexture customTex, ref Rectangle textureSourceRect, ref RectangleF bounds, float rotation, SamplerState sampler, int groupId = 0, ByteColor?color = null) { var offset = new UniRectangle(0, 0, bounds.Width, bounds.Height); var destinationRegion = calculateDestinationRectangle( ref bounds, ref offset ); ByteColor col; if (!color.HasValue) { col = _defaultColor; } else { col = (ByteColor)color; } spriteRenderer.Draw(customTex, ref destinationRegion, ref textureSourceRect, ref col, rotation, sampler, drawGroupId: groupId); }
private void InitializeComponent() { EnableDragging = false; Bounds = new UniRectangle( new UniScalar(0.0f, 0.0f), new UniScalar(0.0f, 0.0f), new UniScalar(0.0f, 170.0f), new UniScalar(0.0f, 125.0f) ); _roundLabel = new LabelControl(); _roundNumber = new LabelControl(); _faction = new LabelControl(); _endTurn = new ButtonControl(); Children.Add(_roundLabel); Children.Add(_roundNumber); Children.Add(_faction); Children.Add(_endTurn); _faction.Bounds = new UniRectangle( new UniScalar(0.0f, 15.0f), new UniScalar(0.0f, 10.0f), new UniScalar(1.0f, -20.0f), new UniScalar(0.0f, 30.0f) ); _roundLabel.Bounds = new UniRectangle( new UniScalar(0.0f, 15.0f), new UniScalar(0.0f, 40.0f), new UniScalar(0.5f, -10.0f), new UniScalar(0.0f, 30.0f) ); _roundLabel.Text = "Round: "; _roundNumber.Bounds = new UniRectangle( new UniScalar(0.5f, 10.0f), new UniScalar(0.0f, 40.0f), new UniScalar(0.5f, -10.0f), new UniScalar(0.0f, 30.0f) ); _endTurn.Bounds = new UniRectangle( new UniScalar(0.0f, 10.0f), new UniScalar(0.0f, 70.0f), new UniScalar(1.0f, -20.0f), new UniScalar(0.0f, 45.0f) ); _endTurn.Text = "End Turn"; }
private void InitializeComponent() { Bounds = new UniRectangle( new UniScalar(0.0f, 0.0f), new UniScalar(0.0f, 105.0f), new UniScalar(0.2f, 0.0f), new UniScalar(1.0f, -105.0f) ); EnableDragging = false; for (var i = 0; i < _party.Count; i++) { var combatant = _party[i]; var partyButton = new ButtonControl(); partyButton.Text = combatant.Name; partyButton.Bounds = new UniRectangle( new UniScalar(0.0f, 15.0f), new UniScalar(0.0f, (75.0f * i) + 15.0f), new UniScalar(1.0f, -30.0f), new UniScalar(0.0f, 65.0f) ); partyButton.Pressed += (s, a) => ChangeCharacter(combatant); Children.Add(partyButton); } }
/// <summary> /// Calculates the absolute pixel position of a rectangle in unified coordinates /// </summary> /// <param name="bounds">Bounds of the drawing area in pixels</param> /// <param name="destination">Destination rectangle in unified coordinates</param> /// <returns> /// The destination rectangle converted to absolute pixel coordinates /// </returns> private static Rectangle calculateDestinationRectangle( ref RectangleF bounds, ref UniRectangle destination ) { int x = (int)(bounds.X + destination.Location.X.Offset); x += (int)(bounds.Width * destination.Location.X.Fraction); int y = (int)(bounds.Y + destination.Location.Y.Offset); y += (int)(bounds.Height * destination.Location.Y.Fraction); int width = (int)(destination.Size.X.Offset); width += (int)(bounds.Width * destination.Size.X.Fraction); int height = (int)(destination.Size.Y.Offset); height += (int)(bounds.Height * destination.Size.Y.Fraction); return(new Rectangle(x, y, width, height)); }
private void InitializeComponent() { EnableDragging = false; Bounds = new UniRectangle( new UniScalar(1.0f, -210.0f), new UniScalar(1.0f, -48.0f), new UniScalar(0.0f, 210.0f), new UniScalar(0.0f, 48.0f) ); _name = new LabelControl(); _name.Bounds = new UniRectangle( new UniScalar(0.0f, 10.0f), new UniScalar(0.0f, 10.0f), new UniScalar(1.0f, -35.0f), new UniScalar(0.0f, 20.0f) ); Children.Add(_name); _mana = new LabelControl(); _mana.Bounds = new UniRectangle( new UniScalar(1.0f, -30.0f), new UniScalar(0.0f, 10.0f), new UniScalar(0.0f, 25.0f), new UniScalar(0.0f, 20.0f) ); Children.Add(_mana); }
public override void OnControlDragged(Vector2I move) { Vector2I mousePosition = Context.UiManager.RelativePreviousMousePosition(Position); if ((mousePosition.X >= Size.X - 3) && (mousePosition.Y >= Size.Y - 3)) { Coordinates = new UniRectangle(Coordinates.Position, Coordinates.Size + new UniVector(move.X, move.Y)); Resize(); } else if (mousePosition.X >= Size.X - 3) { Coordinates = new UniRectangle(Coordinates.Position, Coordinates.Size + new UniVector(move.X, 0)); Resize(); } else if (mousePosition.Y >= Size.Y - 3) { Coordinates = new UniRectangle(Coordinates.Position, Coordinates.Size + new UniVector(0, move.Y)); Resize(); } else { Coordinates = new UniRectangle(Coordinates.Position + new UniVector(move.X, move.Y), Coordinates.Size); } }
public Panel(IContext context, string id, UniRectangle coordinates, Color color) : base(context, id, coordinates) { _color = color; }
public Minimap(IContext context, UniRectangle coordinates) : base(context, "minimap", coordinates) { }
public DynamicLabel(IContext context, string id, UniRectangle coordinates, Func<string> expression ) : base(context, id, coordinates, "") { Expression = expression; }
/// <summary> /// Calculates the absolute pixel position of a rectangle in unified coordinates /// </summary> /// <param name="bounds">Bounds of the drawing area in pixels</param> /// <param name="destination">Destination rectangle in unified coordinates</param> /// <returns> /// The destination rectangle converted to absolute pixel coordinates /// </returns> private static Rectangle calculateDestinationRectangle( ref RectangleF bounds, ref UniRectangle destination ) { int x = (int)(bounds.X + destination.Location.X.Offset); x += (int)(bounds.Width * destination.Location.X.Fraction); int y = (int)(bounds.Y + destination.Location.Y.Offset); y += (int)(bounds.Height * destination.Location.Y.Fraction); int width = (int)(destination.Size.X.Offset); width += (int)(bounds.Width * destination.Size.X.Fraction); int height = (int)(destination.Size.Y.Offset); height += (int)(bounds.Height * destination.Size.Y.Fraction); return new Rectangle(x, y, width, height); }
public HintPanel(IContext context, UniRectangle coordinates) : base(context, "hint_panel", coordinates, Color.Crimson) { }