public void Render(MapControl control, IFlatGuiGraphics graphics) { if (control.MapTexture != null) { RectangleF bound = control.GetAbsoluteBounds(); graphics.DrawCustomTexture(control.MapTexture, ref bound); } if (control.PlayerMarker != null) { var bounds = control.GetAbsoluteBounds(); var scaleX = control.MapTexture.Width / bounds.Width; var scaleY = control.MapTexture.Height / bounds.Height; var point = control.MarkerPosition; point.Offset(control.MapTexture.Width / 2, control.MapTexture.Height / 2); point = new Point((int)(bounds.X + point.X / scaleX), (int)(bounds.Y + point.Y / scaleY)); RectangleF bound = new RectangleF( point.X - control.PlayerMarker.Width / 2, point.Y - control.PlayerMarker.Height / 2, control.PlayerMarker.Width, control.PlayerMarker.Height); graphics.DrawCustomTexture(control.PlayerMarker, ref bound); } }
public virtual void InitializeComponent() { Children.Clear(); _recipesList = new ListControl { SelectionMode = ListSelectionMode.Single }; _recipesList.Bounds = new UniRectangle(200, 200, 200, 120); _recipesList.SelectionChanged += RecipesListOnSelectionChanged; _hostModel = new ModelControl(_iconFactory.VoxelModelManager) { Bounds = new UniRectangle(20, 20, 210, 170) }; _hostModel.AlterTransform = Matrix.Identity; Children.Add(_hostModel); // craft button const int buttonWidth = 185; const int buttomHeight = 50; _craftButton = new ButtonControl { Text = "Craft", Bounds = new UniRectangle(244, 330, buttonWidth, buttomHeight) }; _resultModel = new ModelControl(_iconFactory.VoxelModelManager) { Bounds = new UniRectangle(210, 20, 190, 120) }; _hostModel.Bounds.Size.X = 200; _ingredientsRect = new RectangleF(200, 145, 200, 42); _ingredientCells = new List <InventoryCell>(); for (int i = 0; i < 6; i++) { var cell = new InventoryCell(null, _iconFactory, new Vector2I(), _inputsManager) { DrawIconsGroupId = 5, DrawIconsActiveCellId = 6, IsVisible = false }; _ingredientCells.Add(cell); } }