public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); int railAddX = Pointer.Width / 2; int railY = y + (Pointer.Height / 2) - (RailEdge.Height / 2); render.DrawSprite(RailEdge, new Vector2(x + railAddX, railY), Color.White); render.DrawSprite(RailEdge, new Vector2(x + railAddX + Width - RailEdge.Width, railY), Color.White); render.DrawSprite(RailMiddle, new Rectangle(x + railAddX + RailEdge.Width, railY, Width - RailEdge.Width * 2 - railAddX * 2, RailMiddle.Height), Color.White); render.DrawSprite(Pointer, new Vector2(PointerX, y), Color.White); //Dras milestones double stepPixelWidth = Math.Max((Width - RailEdge.Width * 2 - railAddX) * (StepValue / MaxValue), 1F); double stepX = x + railAddX; while (stepX < (x + Width - RailEdge.Width * 2 - railAddX)) { render.DrawSprite(Milestone, new Vector2((int)Math.Round(stepX, 0), y + Pointer.Height + PointerMilestoneMargin), Color.White); stepX += stepPixelWidth; } render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); render.DrawBody(new Rectangle(x, y, Width, Height), Color.White, TopBorder, TopRightCorner, RightBorder, BottomRightCorner, BottomBorder, BottomLeftCorner, LeftBorder, TopLeftCorner, Inside); string textToDraw = Text; if (HasFocus) { textToDraw = Text.Insert(CursorPosition, "|"); } Font.DrawString(textToDraw, new Point(x + LeftBorder.Width + textMargin, y + base.Height / 2 - Font.CharHeight / 2), FontColor, render); render.End(); }
public void Draw(IRender render, Vector2 position) { render.AddViewRect(new ViewRect((int)Math.Round(position.X, 0), (int)Math.Round(position.Y, 0), Width, Height)); if (currentAnimation == null) { return; } render.Begin(); for (int n = 0; n < currentAnimation.Textures.Length; n++) { if (textureTimes[n] <= CurrentTime && textureTimeToEnd[n] >= CurrentTime) { Vector2 pos = position; if (SpriteEffect == SpriteEffects.FlipHorizontally) { pos.X += currentAnimation.Width; } if (SpriteEffect == SpriteEffects.FlipVertically) { pos.Y += currentAnimation.Height; } currentAnimation.Textures[n].Draw(render, position, SpriteEffect); } } render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); render.DrawSprite(textureInUse, new Vector2(x, y), Color.White); render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { base.Project(gameTime, x, y, render); render.Begin(); render.DrawSprite(iconInUse, new Vector2(x + (Width / 2) - iconInUse.Width / 2, y + (Height / 2) - iconInUse.Height / 2), Color.White); render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); render.DrawRect(new Rectangle(x, y, Width, Height), BackgroundColor); Font.DrawString(Text, new Point(x, y), FontColor, render); render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); if (pages.Count == 0) { render.DrawSprite(ButtonTopLeftCorner, new Vector2(x, y), Color.White); render.DrawSprite(ButtonTopRightCorner, new Vector2(x + Width - ButtonTopRightCorner.Width, y), Color.White); render.DrawSprite(ButtonBottomLeftCorner, new Vector2(x, y + ButtonTopLeftCorner.Height + pageNameMargin + Font.CharHeight + pageNameMargin), Color.White); render.DrawSprite(ButtonBottomRightCorner, new Vector2(x + Width - ButtonBottomLeftCorner.Width, y + ButtonTopRightCorner.Height + pageNameMargin + Font.CharHeight + pageNameMargin), Color.White); render.DrawSprite(ButtonTopBorder, new Rectangle(x + ButtonTopLeftCorner.Width, y, Width - ButtonTopLeftCorner.Width - ButtonTopRightCorner.Width, ButtonTopBorder.Height), Color.White); render.DrawSprite(ButtonBottomBorder, new Rectangle(x + ButtonBottomLeftCorner.Width, y + ButtonTopLeftCorner.Height + pageNameMargin + Font.CharHeight + pageNameMargin, Width - ButtonBottomLeftCorner.Width - ButtonBottomRightCorner.Width, ButtonBottomBorder.Height), Color.White); render.DrawSprite(ButtonLeftBorder, new Rectangle(x, y + ButtonTopLeftCorner.Height, ButtonLeftBorder.Width, pageNameMargin + Font.CharHeight + pageNameMargin), Color.White); render.DrawSprite(ButtonRightBorder, new Rectangle(x + Width - ButtonRightBorder.Width, y + ButtonTopLeftCorner.Height, ButtonLeftBorder.Width, pageNameMargin + Font.CharHeight + pageNameMargin), Color.White); render.DrawSprite(ButtonInside, new Rectangle(x + ButtonTopLeftCorner.Width, y + ButtonTopBorder.Height, Width - ButtonLeftBorder.Width - ButtonRightBorder.Width, pageNameMargin + Font.CharHeight + pageNameMargin), Color.White); } else { int n = 0; int drawX = x; foreach (TabPage page in pages) { int size = Math.Min(Font.MeasureString(page.Name).X + ButtonLeftBorder.Width + ButtonRightBorder.Width, (int)Math.Round(Width * sizePercentages[n], 0)); bool pressed = n == pressedPage; DrawTab(drawX, y, render, page.Name, size, pressed); drawX += size; n += 1; } } y += HeaderSize; render.DrawSprite(TopLeftCorner, new Vector2(x, y), Color.White); render.DrawSprite(TopRightCorner, new Vector2(x + Width - TopRightCorner.Width, y), Color.White); render.DrawSprite(BottomLeftCorner, new Vector2(x, y + Height - HeaderSize - BottomLeftCorner.Height), Color.White); render.DrawSprite(BottomRightCorner, new Vector2(x + Width - BottomRightCorner.Width, y + Height - HeaderSize - BottomRightCorner.Height), Color.White); render.DrawSprite(TopBorder, new Rectangle(x + TopLeftCorner.Width, y, Width - TopLeftCorner.Width - TopRightCorner.Width, TopBorder.Height), Color.White); render.DrawSprite(BottomBorder, new Rectangle(x + BottomLeftCorner.Width, y + Height - HeaderSize - BottomBorder.Height, Width - BottomLeftCorner.Width - BottomRightCorner.Width, BottomBorder.Height), Color.White); render.DrawSprite(LeftBorder, new Rectangle(x, y + TopLeftCorner.Height, LeftBorder.Width, Height - HeaderSize - TopLeftCorner.Height - BottomLeftCorner.Height), Color.White); render.DrawSprite(RightBorder, new Rectangle(x + Width - RightBorder.Width, y + TopLeftCorner.Height, RightBorder.Width, Height - HeaderSize - TopRightCorner.Height - BottomRightCorner.Height), Color.White); render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { if (!DrawBorder) { return; } render.Begin(); render.DrawLine(new Vector2(x + borderPosition, y), new Vector2(x + borderPosition, y + Height), OuterBorderColor); render.DrawLine(new Vector2(x + borderPosition + BorderSize - 1, y), new Vector2(x + borderPosition + BorderSize - 1, y + Height), OuterBorderColor); render.DrawRect(new Rectangle(x + borderPosition, y, BorderSize - 2, Height), InnerBorderColor); render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); render.DrawBody(new Rectangle(x, y, Width, Height), Color.White, topInUse, topRightInUse, rightInUse, bottomRightInUse, bottomInUse, bottomLeftInUse, leftInUse, topLeftInUse, insideInUse); Font.DrawString(Title, new Point(x + (Width / 2), y + (Height / 2)), new Vector2(0.5F, 0.5F), Color.White, render); render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); ISprite barButtonLeft = leftButtonIsPressed ? BarButtonPressed : BarButton; ISprite barButtonRight = rightButtonIsPressed ? BarButtonPressed : BarButton; render.DrawSprite(barButtonLeft, new Vector2(x, y), Color.White); render.DrawSprite(BarInside, new Rectangle(x + BarButton.Width, y, Width - BarButton.Width * 2, BarInside.Height), Color.White); render.DrawSprite(barButtonRight, new Vector2(x + Width - BarButton.Width, y), SpriteEffects.FlipHorizontally, Color.White); int scrollerX = (int)Math.Round(x + BarButton.Width + ScrollerPosition, 0); render.DrawSprite(ScrollerEdge, new Vector2(scrollerX, y), Color.White); render.DrawSprite(ScrollerInside, new Rectangle(scrollerX + ScrollerEdge.Width, y, ScrollerSize - ScrollerEdge.Width * 2, ScrollerInside.Height), Color.White); render.DrawSprite(ScrollerEdge, new Vector2(scrollerX + ScrollerSize - ScrollerEdge.Width, y), SpriteEffects.FlipHorizontally, Color.White); render.DrawSprite(ScrollerCenter, new Vector2(scrollerX + ScrollerSize / 2 - ScrollerCenter.Width / 2, y), Color.White); render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); render.DrawBody(new Rectangle(x, y, Width, Height), Color.White, topInUse, topRightCornerInUse, RightBorder, BottomRightCorner, BottomBorder, BottomLeftCorner, LeftBorder, topLeftCornerInUse, Inside); if (Header) { Font.DrawString(titleToPrint, new Point(x + topLeftCornerInUse.Width, y + topLeftCornerInUse.Height / 2), new Vector2(0F, 0.5F), FontColor, render); DrawButtons(render, x, y); } render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); ISprite barButtonTop = leftButtonIsPressed ? BarButtonPressed : BarButton; ISprite barButtonBottom = rightButtonIsPressed ? BarButtonPressed : BarButton; render.DrawSprite(barButtonTop, new Vector2(x, y), Color.White); render.DrawSprite(BarInside, new Rectangle(x, y + barButtonTop.Height, Width, Height - barButtonTop.Height * 2), Color.White); render.DrawSprite(barButtonBottom, new Vector2(x, y + Height - barButtonBottom.Height), SpriteEffects.FlipVertically, Color.White); int scrollerY = (int)Math.Round(y + BarButton.Height + ScrollerPosition, 0); render.DrawSprite(ScrollerEdge, new Vector2(x, scrollerY), Color.White); render.DrawSprite(ScrollerInside, new Rectangle(x, scrollerY + ScrollerEdge.Height, Width, ScrollerSize - ScrollerEdge.Height * 2), Color.White); render.DrawSprite(ScrollerEdge, new Vector2(x, scrollerY + ScrollerSize - ScrollerEdge.Height), SpriteEffects.FlipVertically, Color.White); render.DrawSprite(ScrollerCenter, new Vector2(x, scrollerY + ScrollerSize / 2 - ScrollerCenter.Height / 2), Color.White); render.End(); }
void DrawOpen(GameTime gameTime, ViewRect viewRect) { if (IsClosed || !IsInitialized || !Activated || Hidden) { return; } viewRect.Add(MasterBoundaries); IRender render = GraphicsManager.GetRender(); int x = RealX; int y = RealY; render.AddViewRect(new ViewRect(x, y + TextFieldHeight, TextFieldWidth, OpenHeight - TextFieldHeight)); render.Begin(); render.DrawRect(new Rectangle(x, y + TextFieldHeight, TextFieldWidth, OpenHeight - TextFieldHeight), OpenBackgroundColor); //DrawSprite items int drawY = y + TextFieldHeight - ItemPositionY + itemMargin; foreach (string line in Items) { Rectangle area = new Rectangle(x, drawY, TextFieldWidth, Font.CharHeight + Font.VerticalSpace); if (IsMouseInRect(area)) { render.DrawRect(area, MouseOverElementColor); } Font.DrawString(line, new Point(x + itemMargin, drawY), OpenFontColor, render); drawY += Font.CharHeight + Font.VerticalSpace; } render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); render.DrawBody(new Rectangle(x, y, TextFieldWidth, TextFieldHeight), Color.White, TopBorder, TopRightCorner, RightBorder, BottomRightCorner, BottomBorder, BottomLeftCorner, LeftBorder, TopLeftCorner, Inside); Font.DrawString(CurrentLine, new Point(x + LeftBorder.Width + textMargin, y + TextFieldHeight / 2 - Font.CharHeight / 2), FontColor, render); render.End(); if (Open) { Parent.AddDrawDelegate(DrawOpen); } }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); if (World == null) { Font.DrawString("No World", new Point(x + Width / 2, y + Height / 2), new Vector2(0, 0), Color.White, render); render.End(); return; } float originX = ViewCamera.LookX; float originY = ViewCamera.LookY; if (ShowRegions) { var gridColor = new Color(100, 100, 100, 100); int width = (int)Math.Round(World.Width * ViewCamera.Zoom); int height = (int)Math.Round(World.Height * ViewCamera.Zoom); int regionSize = (int)Math.Round(World.RegionSize * ViewCamera.Zoom); int stop = width + x; for (int gridX = x; gridX < stop; gridX += regionSize) { render.DrawLine(new Vector2(gridX - originX, y - originY), new Vector2(gridX - originX, y + height - originY), gridColor); } stop = height + y; for (int gridY = y; gridY < stop; gridY += regionSize) { render.DrawLine(new Vector2(x - originX, gridY - originY), new Vector2(x + width - originX, gridY - originY), gridColor); } } foreach (Entity entity in World.EntityList) { //Color color = entity.EntityColor; //switch (entity.EntityName) //{ // case "Creature": // sprite = Creature; // double energyQ = ((Creature)entity).Energy.Value / ((Creature)entity).Energy.Max; // color.R = (byte)Math.Round(color.R * energyQ, 0); // color.G = (byte)Math.Round(color.G * energyQ, 0); // color.B = (byte)Math.Round(color.B * energyQ, 0); // break; // case "Food": // sprite = Food; // break; //} Type eType = entity.GetType(); int radius = (int)Math.Round(entity.Radius * ViewCamera.Zoom); Rectangle destRect = new Rectangle((int)Math.Round(x - originX + entity.Position.X * ViewCamera.Zoom, 0), (int)Math.Round(y - originY + entity.Position.Y * ViewCamera.Zoom, 0), radius * 2, radius * 2); if (EntityPaintersDictionary.ContainsKey(eType)) { foreach (var painter in EntityPaintersDictionary[eType]) { painter.Draw(gameTime, entity, destRect.X, destRect.Y, ViewCamera.Zoom, render); } } //render.DrawSprite(sprite, destRect, new Vector2(radius, radius), Color.Red, (float)entity.Rotation); if (entity == SelectedEntity) { destRect.X -= destRect.Width / 2; destRect.Y -= destRect.Height / 2; render.DrawHorizontalLine(new Point(destRect.X, destRect.Y), destRect.Width, Color.White); render.DrawHorizontalLine(new Point(destRect.X, destRect.Bottom), destRect.Width, Color.White); render.DrawVerticalLine(new Point(destRect.X, destRect.Y), destRect.Height, Color.White); render.DrawVerticalLine(new Point(destRect.Right, destRect.Y), destRect.Height, Color.White); } //if (entity.EntityName == "Creature" && entity == infoDrawCreature) //{ // var creature = (Creature)entity; // double rotation = (creature.Rotation - creature.EyeSpan / 2); // double rotationStep = creature.EyeSpan / creature.EyeNeuronsAmount; // float length = infoDrawCreature.ViewDistance; // for (int i = 0; i < creature.EyeNeuronsAmount + 1; i++) // { // float posX = (float)destRect.X; // float posY = (float)destRect.Y; // float lineX = (float)Math.Cos(rotation) * length + posX; // float lineY = (float)Math.Sin(rotation) * length + posY; // render.DrawLine(new Vector2(posX, posY), new Vector2(lineX, lineY), Color.Red); // rotation += rotationStep; // } //} } int tX = 10 + x; int tY = 30 + y; foreach (string s in stringsToDraw) { Font.DrawString(s, new Point(tX, tY), Color.White, render); tY += Font.CharHeight + 2; } stringsToDraw.Clear(); render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); render.DrawRect(new Rectangle(x, y, DrawSpaceWidth, DrawSpaceHeight), BackColor); int drawX = x; int drawY = y; for (int iy = 0; iy < BufferHeight; iy++) { for (int ix = 0; ix < BufferWidth; ix++) { if (display[ix, iy] != '\0') { Font.DrawChar(display[ix, iy], new Point(drawX, drawY), FontColor, render); } drawX += Font.CharWidth + Font.HorizontalSpace; } drawX = x - OriginX; drawY += Font.CharHeight + Font.VerticalSpace; } if (TerminalMode && drawCursor) { int sum = 0; int cursorY = Lines.Count - OriginY; int cursorX = OriginX; List <string> currentLineParts = new List <string>(); AddCurrentLineParts(currentLineParts); string lastPart = ""; bool partIsFullSize = false; foreach (string part in currentLineParts) { lastPart = part; sum += part.Length; if (inputMachine.Cursor <= sum) { partIsFullSize = part.Length == BufferWidth && sum == inputMachine.Cursor; break; } cursorY += 1; } if (partIsFullSize) { cursorX = OriginX; cursorY += 1; } else { cursorX = inputMachine.Cursor - sum + lastPart.Length; } int cursorHeight = (int)Math.Round(Font.CharHeight * CursorSize, 0); render.DrawRect(new Rectangle(cursorX * (Font.CharWidth + Font.HorizontalSpace) + x, cursorY * (Font.CharHeight + Font.VerticalSpace) + Font.CharHeight - cursorHeight + y, Font.CharWidth, cursorHeight), FontColor); } render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { if (drawFpsList.Count == meanFloor) { drawFpsList.RemoveAt(0); } double add = 1 / gameTime.ElapsedGameTime.TotalSeconds; if (!double.IsInfinity(add)) { drawFpsList.Add(1 / gameTime.ElapsedGameTime.TotalSeconds); } DrawFps = 0; foreach (double fps in drawFpsList) { DrawFps += fps; } DrawFps /= drawFpsList.Count; render.Begin(); Color background = BackgroundColor; Color fontColor = FontColor; Color bumpColor = BumpColor; const float transparencyFactor = 0.3F; if (CheckIfUnderMouse()) { background.R = Convert.ToByte(BackgroundColor.R * transparencyFactor); background.G = Convert.ToByte(BackgroundColor.G * transparencyFactor); background.B = Convert.ToByte(BackgroundColor.B * transparencyFactor); background.A = Convert.ToByte(BackgroundColor.A * transparencyFactor); fontColor.R = Convert.ToByte(FontColor.R * transparencyFactor); fontColor.G = Convert.ToByte(FontColor.G * transparencyFactor); fontColor.B = Convert.ToByte(FontColor.B * transparencyFactor); fontColor.A = Convert.ToByte(FontColor.A * transparencyFactor); bumpColor.R = Convert.ToByte(bumpColor.R * transparencyFactor); bumpColor.G = Convert.ToByte(bumpColor.G * transparencyFactor); bumpColor.B = Convert.ToByte(bumpColor.B * transparencyFactor); bumpColor.A = Convert.ToByte(bumpColor.A * transparencyFactor); } render.DrawRect(new Rectangle(x, y, Width, Height), background); //Draw bump render.DrawLine(new Vector2(x + bumpX, Height), new Vector2(x + bumpX, 0), bumpColor); //Move bump if (bumpX + speed > Width || bumpX + speed < 0) { speed = -speed; } bumpX += speed; if (ShowUpdateFps) { Font.DrawString("DrawFps: " + UpdateFps.ToString(), new Point(x, y), fontColor, render); } if (ShowDrawFps) { Font.DrawString("UpdateFps: " + DrawFps.ToString(), new Point(x, y + Font.CharHeight + margin), fontColor, render); } render.End(); }
public override void Project(Microsoft.Xna.Framework.GameTime gameTime, int x, int y, IRender render) { render.Begin(); int n = 0; int drawX = x + textMargin; foreach (string name in columnNames) { bool pressed = n == pressedColumnButton; int size = columnSizes[n]; bool quit = false; if (drawX + columnSizes[n] >= RealX + Width) { size = RealX + Width - drawX; quit = true; } DrawButton(drawX, y, render, name, size, pressed); if (quit) { break; } drawX += columnSizes[n]; n += 1; } y += HeaderSize; render.DrawSprite(TopLeftCorner, new Vector2(x, y), Color.White); render.DrawSprite(TopRightCorner, new Vector2(x + Width - TopRightCorner.Width, y), Color.White); render.DrawSprite(BottomLeftCorner, new Vector2(x, y + Height - HeaderSize - BottomLeftCorner.Height), Color.White); render.DrawSprite(BottomRightCorner, new Vector2(x + Width - BottomRightCorner.Width, y + Height - HeaderSize - BottomRightCorner.Height), Color.White); render.DrawSprite(TopBorder, new Rectangle(x + TopLeftCorner.Width, y, Width - TopLeftCorner.Width - TopRightCorner.Width, TopBorder.Height), Color.White); render.DrawSprite(BottomBorder, new Rectangle(x + BottomLeftCorner.Width, y + Height - HeaderSize - BottomBorder.Height, Width - BottomLeftCorner.Width - BottomRightCorner.Width, BottomBorder.Height), Color.White); render.DrawSprite(LeftBorder, new Rectangle(x, y + TopLeftCorner.Height, LeftBorder.Width, Height - HeaderSize - TopLeftCorner.Height - BottomLeftCorner.Height), Color.White); render.DrawSprite(RightBorder, new Rectangle(x + Width - RightBorder.Width, y + TopLeftCorner.Height, RightBorder.Width, Height - HeaderSize - TopRightCorner.Height - BottomRightCorner.Height), Color.White); render.DrawSprite(Inside, new Rectangle(x + TopLeftCorner.Width, y + TopLeftCorner.Height, Width - BottomLeftCorner.Width - BottomRightCorner.Width, Height - HeaderSize - TopLeftCorner.Height - BottomLeftCorner.Height), Color.White); render.End(); //DrawSprite list items: render.AddViewRect(new ViewRect(RealX + TopLeftCorner.Width, RealY + TopLeftCorner.Height + HeaderSize, Width - TopLeftCorner.Width - TopRightCorner.Width, Height - HeaderSize - TopLeftCorner.Height - BottomLeftCorner.Height)); render.Begin(); int rowX = RealX + TopLeftCorner.Width + textMargin; int rowY = RealY + TopLeftCorner.Height + HeaderSize + textMargin; int rowNumber = 0; foreach (ListBoxRow row in Values) { if (rowNumber == rowUnderMouse) { render.DrawRect(new Rectangle(rowX, rowY, Width - TopLeftCorner.Width - TopRightCorner.Width, Font.CharHeight + textMargin), ElementUnderMouseColor); } if (row == SelectedRow) { render.DrawRect(new Rectangle(rowX, rowY, Width - TopLeftCorner.Width - TopRightCorner.Width, Font.CharHeight + textMargin), SelectedElementColor); } int index = 0; foreach (object val in row.Values) { string valStr = val == null ? "NULL" : val.ToString(); Font.DrawString(valStr, new Point(rowX, rowY), ListElementColor, render); rowX += ColumnSizes[index]; index += 1; } rowX = RealX + TopLeftCorner.Width + textMargin; rowY += Font.CharHeight + textMargin; rowNumber += 1; } render.End(); }
void DrawMenu(GameTime gameTime, ViewRect viewRect) { if (IsClosed || !IsInitialized || !Activated || Hidden) { return; } viewRect.Add(MasterBoundaries); IRender render = GraphicsManager.GetRender(); int x = RealX; int y = RealY; int posX = x + menuItemMarginX; int posY = y + Height / 2 - Font.CharHeight / 2; int count = 0; foreach (var item in MenuItems) { int strinW = Font.MeasureString(item.Name).X; if (count == SelectedMenuItem && ItemIsOpen) { render.Begin(); Color color = count == SelectedMenuItem && item.Enabled ? FontHighlightColor : FontColor; render.DrawHorizontalLine(new Point(posX, y + menuItemMarginY), strinW, DropdownBorder); render.DrawVerticalLine(new Point(posX, y + menuItemMarginY), Height - menuItemMarginY + toolbarDropdownMargin, DropdownBorder); render.DrawVerticalLine(new Point(posX + strinW, y + menuItemMarginY), Height - menuItemMarginY + toolbarDropdownMargin, DropdownBorder); render.DrawRect(new Rectangle(posX + 1, y + menuItemMarginY + 1, strinW - 2, Height - menuItemMarginY + toolbarDropdownMargin - 2), DropdownBody); Font.DrawString(item.Name, new Point(posX + 1, posY), color, render); //DropdownMenu int top = y + Height + toolbarDropdownMargin - 1; render.DrawHorizontalLine(new Point(posX + strinW, top), dropdownMenuWidth - strinW, DropdownBorder); render.DrawHorizontalLine(new Point(posX, top + dropdownMenuHeight), dropdownMenuWidth, DropdownBorder); render.DrawVerticalLine(new Point(posX, top), dropdownMenuHeight, DropdownBorder); render.DrawVerticalLine(new Point(posX + dropdownMenuWidth - 1, top), dropdownMenuHeight, DropdownBorder); render.DrawRect(new Rectangle(posX + 1, top + 1, dropdownMenuWidth - 3, dropdownMenuHeight - 2), DropdownBody); int elemX = posX; int elemY = top + menuElemMarginY; var selectedItem = MenuItems[SelectedMenuItem]; int c = 0; foreach (var elem in selectedItem.Elements) { int elemH; if (elem.Name != null) { elemH = Font.MeasureString(elem.Name).Y + menuElemMarginY; } else { elemH = separatorHeight; } if (c == SelectedMenuElement && item.Enabled && elem.Enabled) { render.DrawRect(new Rectangle(elemX + 1, elemY - menuElemMarginY + 2, dropdownMenuWidth - 3, elemH - 2), ElementHighlightColor); } if (elem.IsSeparator) { render.DrawLine(new Vector2(elemX + separatorMargin, elemY + separatorHeight / 2), new Vector2(elemX + dropdownMenuWidth - separatorMargin, elemY + separatorHeight / 2), SeparatorColor); } else { Font.DrawString(elem.Name, new Point(elemX + menuElemMarginX, elemY), FontColor, render); } elemY += elemH; c += 1; } render.End(); } posX += strinW + menuItemMarginX; count += 1; } render.Reset(); }
public override void Project(Microsoft.Xna.Framework.GameTime gameTime, int x, int y, IRender render) { base.Project(gameTime, x, y, render); const int geneHeight = 3; render.Begin(); render.DrawRect(new Rectangle(x, y, Width, Height), Color.White); //Genome1 if (Genome == null) { render.End(); return; } var geneDict = Genome.NetChromosome.GetGeneInfo(); int headerX = x + 5; int posY = y + 5; int genome2PosY = posY; foreach (var geneListKey in geneDict.Keys) { var geneList = geneDict[geneListKey]; int stringWidth = Font.MeasureString(geneListKey).X; Font.DrawString(geneListKey, new Point(headerX, posY), Color.Black, render); genome2PosY = Math.Max(DrawGenes(headerX, posY + Font.CharHeight + 2, geneList, render, stringWidth, geneHeight), genome2PosY); headerX += stringWidth + 4; } //Genome2 if (Genome2 == null) { render.End(); return; } geneDict = Genome2.NetChromosome.GetGeneInfo(); headerX = x + 5; posY = genome2PosY += 5; foreach (var geneListKey in geneDict.Keys) { var geneList = geneDict[geneListKey]; int stringWidth = Font.MeasureString(geneListKey).X; Font.DrawString(geneListKey, new Point(headerX, posY), Color.Black, render); genome2PosY = Math.Max(DrawGenes(headerX, posY + Font.CharHeight + 2, geneList, render, stringWidth, geneHeight), genome2PosY); headerX += stringWidth + 4; } //ChildGenome if (ChildGenome == null) { render.End(); return; } geneDict = ChildGenome.NetChromosome.GetGeneInfo(); headerX = x + 5; posY = genome2PosY += 5; foreach (var geneListKey in geneDict.Keys) { var geneList = geneDict[geneListKey]; int stringWidth = Font.MeasureString(geneListKey).X; Font.DrawString(geneListKey, new Point(headerX, posY), Color.Black, render); genome2PosY = Math.Max(DrawGenes(headerX, posY + Font.CharHeight + 2, geneList, render, stringWidth, geneHeight), genome2PosY); headerX += stringWidth + 4; } render.End(); }
public void DrawCursor(IRender render, float mouseX, float mouseY) { render.Begin(); render.DrawSprite(cursorInUse, new Vector2(mouseX, mouseY), Color.White); render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { ViewRect orig = render.GetViewRect(); render.Begin(); ISprite iconUpSignInUse = UpIsPressed ? IconUpSignPressed : IconUpSign; ISprite iconInsideInUse = UpIsPressed ? IconInsidePressed : IconInside; // /-------\ // | /|\ | // | / | \ | // | | | // \-------/ render.DrawSprite(IconTop, new Vector2(x, y), Color.White); render.DrawSprite(IconLeft, new Rectangle(x, y + IconTop.Height, IconLeft.Width, UpperFieldHeight - IconTop.Height - IconBottom.Height), Color.White); render.DrawSprite(IconRight, new Rectangle(x + IconTop.Width - IconRight.Width, y + IconTop.Height, IconRight.Width, UpperFieldHeight - IconTop.Height - IconBottom.Height), Color.White); render.DrawSprite(IconBottom, new Vector2(x, y + UpperFieldHeight - IconBottom.Height), Color.White); render.DrawSprite(iconInsideInUse, new Rectangle(x + IconLeft.Width, y + IconTop.Height, IconTop.Width - IconLeft.Width - IconRight.Width, UpperFieldHeight - IconTop.Height - IconBottom.Height), Color.White); render.DrawSprite(IconUpSign, new Vector2(x + IconLeft.Width + ((IconTop.Width - IconLeft.Width - IconRight.Width) / 2) - (IconUpSign.Width / 2), y + (UpperFieldHeight / 2) - (IconUpSign.Height / 2)), Color.White); //UPPER FIELD: //Top render.DrawSprite(TopBorder, new Rectangle(x + IconTop.Width, y, Width - IconTop.Width - TopRightCorner.Width, TopBorder.Height), Color.White); //TopRight render.DrawSprite(TopRightCorner, new Vector2(x + Width - TopRightCorner.Width, y), Color.White); //Right render.DrawSprite(RightBorder, new Rectangle(x + Width - RightBorder.Width, y + TopRightCorner.Height, RightBorder.Width, UpperFieldHeight - TopRightCorner.Height - UpperFieldBottomRightCorner.Height), Color.White); //BottomRight render.DrawSprite(UpperFieldBottomRightCorner, new Vector2(x + Width - UpperFieldBottomRightCorner.Width, y + UpperFieldHeight - UpperFieldBottomRightCorner.Height), Color.White); //Bottom render.DrawSprite(BottomBorder, new Rectangle(x + IconTop.Width, y + UpperFieldHeight - BottomBorder.Height, Width - IconTop.Width - TopRightCorner.Width, BottomBorder.Height), Color.White); //Inside render.DrawSprite(Inside, new Rectangle(x + IconTop.Width, y + TopBorder.Height, Width - IconTop.Width - RightBorder.Width, UpperFieldHeight - TopBorder.Height - BottomBorder.Height), Color.White); //LOWER FIELD: //Middle render.DrawSprite(MiddleBorder, new Rectangle(x + LeftBorder.Width, y + UpperFieldHeight, LowerFieldWidth - LeftBorder.Width - RightBorder.Width, MiddleBorder.Height), Color.White); //Right render.DrawSprite(RightBorder, new Rectangle(x + LowerFieldWidth - RightBorder.Width, y + UpperFieldHeight, RightBorder.Width, LowerFieldHeight - BottomRightCorner.Height), Color.White); //BottomRight render.DrawSprite(BottomRightCorner, new Vector2(x + LowerFieldWidth - BottomRightCorner.Width, y + UpperFieldHeight + LowerFieldHeight - BottomRightCorner.Height), Color.White); //Bottom render.DrawSprite(BottomBorder, new Rectangle(x + BottomLeftCorner.Width, y + UpperFieldHeight + LowerFieldHeight - BottomBorder.Height, LowerFieldWidth - BottomLeftCorner.Width - BottomRightCorner.Width, BottomBorder.Height), Color.White); //BottomLeft render.DrawSprite(BottomLeftCorner, new Vector2(x, y + UpperFieldHeight + LowerFieldHeight - BottomLeftCorner.Height), Color.White); //Left render.DrawSprite(LeftBorder, new Rectangle(x, y + UpperFieldHeight, LeftBorder.Width, LowerFieldHeight - BottomLeftCorner.Height), Color.White); //Inside render.DrawSprite(Inside, new Rectangle(x + LeftBorder.Width, y + UpperFieldHeight + MiddleBorder.Height, LowerFieldWidth - LeftBorder.Width - RightBorder.Width, LowerFieldHeight - MiddleBorder.Height - BottomBorder.Height), Color.White); render.End(); render.SetViewRect(orig.AddGet(new ViewRect(RealX + IconTop.Width + TextMargin, RealY + TopBorder.Height + TextMargin, Width - IconTop.Width - RightBorder.Width - TextMargin * 2, UpperFieldHeight - TopBorder.Height - MiddleBorder.Height - TextMargin * 2))); render.Begin(); string textToDraw = Text; if (HasFocus) { textToDraw = Text.Insert(CursorPosition, "|"); } Font.DrawString(textToDraw, new Point(RealX + IconTop.Width + TextMargin, RealY + TopBorder.Height + TextMargin), FontColor, render); render.End(); render.SetViewRect(orig.AddGet(new ViewRect(selectorX, selectorY, selectorWidth, selectorHeight))); render.Begin(); int drawX = selectorX + textAreaOriginX; int drawY = selectorY + textAreaOriginY; //DrawSprite filedir Font.DrawString(CurrentDirectory.FullName, new Point(drawX, drawY), FontColor, render); drawY += TextMargin + Font.CharHeight; render.DrawLine(new Vector2(drawX, drawY), new Vector2(selectorX + selectorWidth, drawY), SeparatorColor); drawY += 1 + TextMargin; foreach (DirectoryInfo d in directoryList) { if (selectedDirectories.Contains(d)) { render.DrawRect(new Rectangle(selectorX, drawY, selectorWidth, Font.CharHeight + Font.VerticalSpace), SelectedColor); } render.DrawSprite(FolderSign, new Vector2(drawX, drawY), Color.White); Font.DrawString(d.Name, new Point(drawX + FolderSign.Width + TextMargin, drawY), FontColor, render); drawY += Font.CharHeight + Font.VerticalSpace; } foreach (FileInfo f in fileList) { if (selectedFiles.Contains(f)) { render.DrawRect(new Rectangle(selectorX, drawY, selectorWidth, Font.CharHeight + Font.VerticalSpace), SelectedColor); } Font.DrawString(f.Name, new Point(drawX, drawY), FontColor, render); drawY += Font.CharHeight + Font.VerticalSpace; } render.End(); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); render.DrawRect(new Rectangle(x, y, Width, Height), BackgroundColor); render.End(); }