public override void Render <TSurface, TSource>(ScreenRenderer <TSurface, TSource> r) { if (!ModalVisible) { return; } var layer = r.GetLayerGraphics("hi_res_overlay"); System.Drawing.Rectangle sidebar = new System.Drawing.Rectangle(EditorRendering.SidebarX, 0, EditorRendering.SidebarWidth, 720); layer.FillRect(sidebar, Color.FromArgb(45, 45, 48)); layer.FillRect(new System.Drawing.Rectangle(sidebar.X + EditorRendering.SidebarMargin, sidebar.Y + EditorRendering.SidebarMargin, sidebar.Width - 2 * EditorRendering.SidebarMargin, sidebar.Height - 2 * EditorRendering.SidebarMargin), Color.FromArgb(37, 37, 38)); int x = EditorRendering.SidebarX + 2 * EditorRendering.SidebarMargin; int y = EditorRendering.SidebarMargin + 4; new TextUnit(EditorMenuSystem.CogIcon, new[] { "Top", "Right", "Bottom", "Left" }[FaceIndex] +" Face").Render(r, layer, new Point(x, y), 2); y += 20; layer.FillRect(new System.Drawing.Rectangle(x - 2 * EditorRendering.SidebarMargin, y, EditorRendering.SidebarWidth - 2 * EditorRendering.SidebarMargin, 3), Color.FromArgb(45, 45, 48)); y += 8; int index = 0; foreach (IMemberSummary member in Members) { TextUnit label = member.Label; label.Color = SelectedPropertyIndex == index ? Color.CornflowerBlue : Color.White; label.Render(r, layer, new Point(x + 8, y), 2); y += 24; index++; } }
public override void Render <TSurface, TSource>(ScreenRenderer <TSurface, TSource> r) { var layer = r.GetLayerGraphics("hi_res_overlay"); layer.Clear(Color.FromArgb(31, 24, 51)); System.Drawing.Size layerSize = layer.GetSize(); var logo = r.SpriteManager["logo"]; System.Drawing.Size logoSize = r.GraphicsContext.GetSize(logo); logoSize.Width *= 4; logoSize.Height *= 4; layer.Draw(logo, new System.Drawing.Rectangle(layerSize.Width / 2 - logoSize.Width / 2, layerSize.Height / 2 - logoSize.Height / 2, logoSize.Width, logoSize.Height)); if (Delay <= 0) { TextUnit text = new TextUnit(new Sprite("x_icons", new Rectangle(0, -4, 9 * 4, 9 * 4), new Rectangle(0, 0, 9, 9)) { Modifiers = Sprite.Mod_InputType }, " Start", Color.FromArgb(182, 203, 207)); System.Drawing.Size textSize = text.GetSize(4); text.Render(r, layer, new Point(layerSize.Width / 2 - textSize.Width / 2, layerSize.Height / 2 + logoSize.Height / 2 + 32), 4); } }
public override void Render <TSurface, TSource>(ScreenRenderer <TSurface, TSource> r) { if (!ModalActive) { return; } var layer = r.GetLayerGraphics("hi_res_overlay"); if (Label != null) { TextUnit label = new TextUnit(Label); label.Render(r, layer, new Point(80 - 18, 500 - 18 - 30 - 30), 3); } TextUnit textDisplay = new TextUnit(Display); layer.FillRect(new System.Drawing.Rectangle(80 - 18, 500 - 18 - 30 - 7, 40 * 13 - 4, 36 - 3), Color.FromArgb(27, 27, 28)); textDisplay.Render(r, layer, new Point(80 - 18 + 4, 500 - 18 - 30), 3); if (CaretBlinkingProgress <= CaretBlinkingPeriod / 2) { int caretX = 80 - 18 + new TextUnit(Display.Substring(0, CaretIndex)).GetSize(3).Width + 6; layer.FillRect(new System.Drawing.Rectangle(caretX, 500 - 18 - 30, 2, 24), Color.White); } foreach (GUIButton button in Pad) { button.Render(r, layer, new Vector2D(80, 500)); } }
public override void Render <TSurface, TSource>(ScreenRenderer <TSurface, TSource> r) { if (!ModalActive) { return; } if (Dirty) { bool negative = Display.StartsWith("-"); if (negative) { Display = Display.Substring(1); } if (Display.Length == 0) { Display = "0"; negative = false; } int i; for (i = 0; i < Display.Length; i++) { if (Display[i] == '0' && i + 1 < Display.Length && Display[i + 1] != '.') { continue; } else { break; } } Display = (negative ? "-" : "") + Display.Substring(i); Dirty = false; } var layer = r.GetLayerGraphics("hi_res_overlay"); if (Label != null) { TextUnit label = new TextUnit(Label); label.Render(r, layer, new Point(80 - 18, 500 - 18 - 30 - 30), 3); } TextUnit numberDisplay = new TextUnit(Display); layer.FillRect(new System.Drawing.Rectangle(80 - 18, 500 - 18 - 30 - 7, 40 * 3 - 4, 36 - 3), Color.FromArgb(27, 27, 28)); numberDisplay.Render(r, layer, new Point(80 - 18 + 4, 500 - 18 - 30), 3); foreach (GUIButton button in Pad) { button.Render(r, layer, new Vector2D(80, 500)); } }
public override void Render <TSurface, TSource>(ScreenRenderer <TSurface, TSource> r) { if (!ModalVisible) { return; } SelectedIndex = Math.Max(-1, Math.Min(SelectedIndex, Owner.Entities.Count - 1)); StartOffset = Math.Max(-1, Math.Min(StartOffset, Owner.Entities.Count - 1)); var layer = r.GetLayerGraphics("hi_res_overlay"); int y = 14; int x = EditorRendering.SidebarX + EditorRendering.SidebarMargin + 4; List <Entity> entities = Owner.Entities.ToList(); int index = StartOffset; for (; index < entities.Count; index++) { if (index == -1) { GUIButton button = new GUIButton(new Vector2D(x - 4 + EditorRendering.SidebarMargin, y), "Add Entity", new EntityComponentSystem.Util.Rectangle(0, 0, EditorRendering.SidebarWidth - 4 * EditorRendering.SidebarMargin, 24)) { TextSize = 2 }; button.Highlighted = SelectedIndex == -1; button.Render(r, layer, Vector2D.Empty); y += 24 + 8; } else { Entity entity = entities[index]; if (index == SelectedIndex) { layer.FillRect(new System.Drawing.Rectangle(x - 4, y, EditorRendering.SidebarWidth - 2 * EditorRendering.SidebarMargin, 20), ModalActive ? Color.CornflowerBlue : Color.FromArgb(63, 63, 70)); } TextUnit label = new TextUnit(entity.Name); label.Render <TSurface, TSource>(r, layer, new Point(x, y + 2), 2); y += 20; if (y > 720 - 16) { break; } } } AmountVisible = index - StartOffset - 1; if (RemoveTimer > 0 && SelectedIndex >= 0) { TextUnit removingLabel = new TextUnit("Removing " + entities[SelectedIndex].Name + new string('.', RemoveTimer / 25)); System.Drawing.Size labelSize = removingLabel.GetSize(3); removingLabel.Render(r, layer, new Point(EditorRendering.SidebarX - labelSize.Width, layer.GetSize().Height - labelSize.Height), 3); } }
public override void Render <TSurface, TSource>(ScreenRenderer <TSurface, TSource> r) { var layer = r.GetLayerGraphics("hi_res_overlay"); layer.Draw(r.SpriteManager["parallax_bg"], new Rectangle(new Point(0, 0), layer.GetSize()), new System.Drawing.Rectangle(0, 0, 320, 180)); layer.Draw(r.SpriteManager["parallax_bg"], new Rectangle(new Point(0, 0), layer.GetSize()), new System.Drawing.Rectangle(0, 180, 320, 180)); layer.Draw(r.SpriteManager["parallax_bg"], new Rectangle(new Point(0, 0), layer.GetSize()), new System.Drawing.Rectangle(0, 360, 320, 180)); TextUnit label = new TextUnit("Loading" + new string('.', (int)(Timer * 3) + 1)); Size labelSize = label.GetSize(5); label.Render(r, layer, new Point(0, layer.GetSize().Height - labelSize.Height), 5); }
public virtual void Render <TSurface, TSource>(ScreenRenderer <TSurface, TSource> r, DirectGraphicsContext <TSurface, TSource> layer, Vector2D offset) { if (!Enabled) { return; } layer.FillRect((Bounds + (Position + offset)).ToDrawing(), Highlighted ? Focused ? Color.CornflowerBlue : Color.FromArgb(63, 63, 70) : Color.FromArgb(37, 37, 38)); TextUnit label = new TextUnit(Display); Rectangle displayBounds = (Bounds + (Position + offset)); System.Drawing.Size labelSize = label.GetSize(TextSize); label.Render(r, layer, new Point((int)(displayBounds.X + displayBounds.Width / 2 - labelSize.Width / 2), (int)(displayBounds.Y + displayBounds.Height / 2 - labelSize.Height / 2)), TextSize); }
public override void Render <TSurface, TSource>(ScreenRenderer <TSurface, TSource> r) { if (!ModalVisible) { return; } var layer = r.GetLayerGraphics("hi_res_overlay"); System.Drawing.Rectangle sidebar = new System.Drawing.Rectangle(EditorRendering.SidebarX, 0, EditorRendering.SidebarWidth, 720); layer.FillRect(sidebar, Color.FromArgb(45, 45, 48)); layer.FillRect(new System.Drawing.Rectangle(sidebar.X + EditorRendering.SidebarMargin, sidebar.Y + EditorRendering.SidebarMargin, sidebar.Width - 2 * EditorRendering.SidebarMargin, sidebar.Height - 2 * EditorRendering.SidebarMargin), Color.FromArgb(37, 37, 38)); int x = EditorRendering.SidebarX + 2 * EditorRendering.SidebarMargin; int y = EditorRendering.SidebarMargin + 4; new TextUnit(EditorMenuSystem.CogIcon, "Edit Sprite Source").Render(r, layer, new Point(x, y), 2); y += 20; layer.FillRect(new System.Drawing.Rectangle(x - 2 * EditorRendering.SidebarMargin, y, EditorRendering.SidebarWidth - 2 * EditorRendering.SidebarMargin, 3), Color.FromArgb(45, 45, 48)); y += 8; int index = 0; foreach (IMemberSummary member in Members) { TextUnit label = member.Label; label.Color = SelectedPropertyIndex == index ? Color.CornflowerBlue : Color.White; label.Render(r, layer, new Point(x + 8, y), 1); y += 16; index++; } var texture = r.SpriteManager[Sprite.Texture]; System.Drawing.Size textureSize = r.GraphicsContext.GetSize(texture); System.Drawing.Rectangle previewRectangle = new System.Drawing.Rectangle(EditorRendering.SidebarX + EditorRendering.SidebarMargin, layer.GetSize().Height - EditorRendering.SidebarWidth + EditorRendering.SidebarMargin, EditorRendering.SidebarWidth - 2 * EditorRendering.SidebarMargin, EditorRendering.SidebarWidth - 2 * EditorRendering.SidebarMargin); layer.FillRect(previewRectangle, Color.White); layer.Draw(texture, previewRectangle); }
public override void Render <TSurface, TSource>(ScreenRenderer <TSurface, TSource> r) { if (!ModalActive) { return; } SelectedIndex = Math.Max(0, Math.Min(SelectedIndex, Options.Count - 1)); StartOffset = Math.Max(0, Math.Min(StartOffset, Options.Count - 1)); var layer = r.GetLayerGraphics("hi_res_overlay"); System.Drawing.Rectangle sidebar = new System.Drawing.Rectangle(EditorRendering.SidebarX, 0, EditorRendering.SidebarWidth, 720); int titleHeight = 24; layer.FillRect(sidebar, Color.FromArgb(45, 45, 48)); layer.FillRect(new System.Drawing.Rectangle(sidebar.X + EditorRendering.SidebarMargin, sidebar.Y + EditorRendering.SidebarMargin + titleHeight, sidebar.Width - 2 * EditorRendering.SidebarMargin, sidebar.Height - 2 * EditorRendering.SidebarMargin - titleHeight), Color.FromArgb(37, 37, 38)); int y = 10 + titleHeight; int x = EditorRendering.SidebarX + EditorRendering.SidebarMargin; new TextUnit(Title).Render(r, layer, new Point(x + 8, 10), 2); int index = StartOffset; for (; index < Options.Count; index++) { string identifier = Options[index]; if (index == SelectedIndex) { layer.FillRect(new System.Drawing.Rectangle(x, y, EditorRendering.SidebarWidth - 2 * EditorRendering.SidebarMargin, 20), ModalActive ? Color.CornflowerBlue : Color.FromArgb(63, 63, 70)); } TextUnit label = new TextUnit(identifier); label.Render <TSurface, TSource>(r, layer, new Point(x, y + 2), 2); y += 20; if (y > 720 - 16) { break; } } AmountVisible = index - StartOffset - 1; }
public override void Render <TSurface, TSource>(ScreenRenderer <TSurface, TSource> r) { if (!ModalVisible) { return; } var layer = r.GetLayerGraphics("hi_res_overlay"); System.Drawing.Rectangle sidebar = new System.Drawing.Rectangle(EditorRendering.SidebarX, 0, EditorRendering.SidebarWidth, 720); layer.FillRect(sidebar, Color.FromArgb(45, 45, 48)); layer.FillRect(new System.Drawing.Rectangle(sidebar.X + EditorRendering.SidebarMargin, sidebar.Y + EditorRendering.SidebarMargin, sidebar.Width - 2 * EditorRendering.SidebarMargin, sidebar.Height - 2 * EditorRendering.SidebarMargin), Color.FromArgb(37, 37, 38)); int x = EditorRendering.SidebarX + 2 * EditorRendering.SidebarMargin; int y = EditorRendering.SidebarMargin + 4; new TextUnit(EntityViewSystem.ObjectIcon, "Edit sprite animations", Color.White).Render(r, layer, new Point(x, y), 2); y += 20; layer.FillRect(new System.Drawing.Rectangle(x - 2 * EditorRendering.SidebarMargin, y, EditorRendering.SidebarWidth - 2 * EditorRendering.SidebarMargin, 3), Color.FromArgb(45, 45, 48)); y += 8; AnimationRenderOffsets.Clear(); int startY = 0; int index = 0; foreach (ObjectSummary animation in Animations.Select(a => new ObjectSummary(Owner, a))) { AnimationRenderOffsets.Add(y); bool doRender = index >= ListFromIndex; if (index == ListFromIndex) { startY = y; y = 2 * EditorRendering.SidebarMargin + 20 + 22 + 20 + 8; } if (index == SelectedAnimationIndex && doRender) { layer.FillRect(new System.Drawing.Rectangle(x - 4, y - 2, EditorRendering.SidebarWidth - 2 * EditorRendering.SidebarMargin, 20), ComponentLocked ? Color.FromArgb(63, 63, 70) : Color.CornflowerBlue); } if (doRender) { new TextUnit( //new Sprite("editor", new Rectangle(0, 0, 16, 16), new Rectangle(0, 32, 16, 16)), "Animation " + (index + 1)) .Render(r, layer, new Point(x, y), 2); } y += 24; int memberIndex = 0; foreach (IMemberSummary member in animation.Members.Values) { if (doRender) { TextUnit label = member.Label; label.Color = ComponentLocked && SelectedAnimationIndex == index ? (memberIndex == SelectedPropertyIndex ? Color.CornflowerBlue : Color.White) : Color.Gray; label.Render(r, layer, new Point(x + 8, y), 1); } y += 16; memberIndex++; } y += 16; index++; } { AnimationRenderOffsets.Add(y); GUIButton button = new GUIButton(new Vector2D(x, y), "Add Animation", new Rectangle(0, 0, EditorRendering.SidebarWidth - 4 * EditorRendering.SidebarMargin, 24)) { TextSize = 2 }; button.Highlighted = SelectedAnimationIndex == Animations.Count; button.Render(r, layer, Vector2D.Empty); for (int i = 0; i < ListFromIndex; i++) { AnimationRenderOffsets[i] -= startY; } index++; y += 32; } if (RemoveTimer > 0 && SelectedAnimationIndex >= 0 && SelectedAnimationIndex < Animations.Count) { TextUnit removingLabel = new TextUnit("Removing Animation " + (SelectedAnimationIndex + 1) + new string('.', RemoveTimer / 25)); System.Drawing.Size labelSize = removingLabel.GetSize(3); removingLabel.Render(r, layer, new Point(EditorRendering.SidebarX - labelSize.Width, layer.GetSize().Height - labelSize.Height), 3); } }
public override void Render <TSurface, TSource>(ScreenRenderer <TSurface, TSource> r) { if (!ModalVisible) { return; } if (!Owner.Entities.ContainsId(Selected)) { return; } var layer = r.GetLayerGraphics("hi_res_overlay"); Entity entity = Owner.Entities[Selected]; int x = EditorRendering.SidebarX + 2 * EditorRendering.SidebarMargin; int y = EditorRendering.SidebarMargin + 4; new TextUnit(ObjectIcon, entity.Name, SelectedComponentIndex == -2 ? Color.CornflowerBlue : Color.White).Render(r, layer, new Point(x, y), 2); y += 20; new TextUnit("ID: " + Selected, Color.DarkGray).Render(r, layer, new Point(x, y), 1); y += 22; if (SelectedComponentIndex == -1) { layer.FillRect(new System.Drawing.Rectangle(x - 4, y - 2, EditorRendering.SidebarWidth - 2 * EditorRendering.SidebarMargin, 20), Color.CornflowerBlue); } SetCheckboxChecked(entity.Active); new TextUnit(CheckboxIcon, "Active").Render(r, layer, new Point(x, y), 2); y += 20; layer.FillRect(new System.Drawing.Rectangle(x - 2 * EditorRendering.SidebarMargin, y, EditorRendering.SidebarWidth - 2 * EditorRendering.SidebarMargin, 3), Color.FromArgb(45, 45, 48)); y += 8; ComponentRenderOffsets.Clear(); int startY = 0; int index = 0; foreach (ComponentSummary component in Helper.Components.Values) { ComponentRenderOffsets.Add(y); bool doRender = index >= ListFromIndex; if (index == ListFromIndex) { startY = y; y = 2 * EditorRendering.SidebarMargin + 20 + 22 + 20 + 8; } if (index == SelectedComponentIndex && doRender) { layer.FillRect(new System.Drawing.Rectangle(x - 4, y - 2, EditorRendering.SidebarWidth - 2 * EditorRendering.SidebarMargin, 20), ComponentLocked ? Color.FromArgb(63, 63, 70) : Color.CornflowerBlue); } if (doRender) { new TextUnit( //new Sprite("editor", new Rectangle(0, 0, 16, 16), new Rectangle(0, 32, 16, 16)), component.ComponentName) .Render(r, layer, new Point(x, y), 2); } y += 24; int memberIndex = 0; foreach (IMemberSummary member in component.Members.Values) { if (doRender) { TextUnit label = member.Label; label.Color = ComponentLocked && SelectedComponentIndex == index ? (memberIndex == SelectedPropertyIndex ? Color.CornflowerBlue : Color.White) : Color.Gray; label.Render(r, layer, new Point(x + 8, y), 1); } y += 16; memberIndex++; } y += 16; index++; } { ComponentRenderOffsets.Add(y); GUIButton button = new GUIButton(new Vector2D(x, y), "Add Component", new Rectangle(0, 0, EditorRendering.SidebarWidth - 4 * EditorRendering.SidebarMargin, 24)) { TextSize = 2 }; button.Highlighted = SelectedComponentIndex == Helper.Components.Count; button.Render(r, layer, Vector2D.Empty); for (int i = 0; i < ListFromIndex; i++) { ComponentRenderOffsets[i] -= startY; } index++; y += 32; } { ComponentRenderOffsets.Add(y); GUIButton button = new GUIButton(new Vector2D(x, y), "Save Prefab", new Rectangle(0, 0, EditorRendering.SidebarWidth - 4 * EditorRendering.SidebarMargin, 24)) { TextSize = 2 }; button.Highlighted = SelectedComponentIndex == Helper.Components.Count + 1; button.Render(r, layer, Vector2D.Empty); for (int i = 0; i < ListFromIndex; i++) { ComponentRenderOffsets[i] -= startY; } index++; y += 32; } if (RemoveTimer > 0 && SelectedComponentIndex >= 0 && SelectedComponentIndex < Helper.Components.Count) { TextUnit removingLabel = new TextUnit("Removing " + Helper.Components.ElementAt(SelectedComponentIndex).Key + new string('.', RemoveTimer / 25)); System.Drawing.Size labelSize = removingLabel.GetSize(3); removingLabel.Render(r, layer, new Point(EditorRendering.SidebarX - labelSize.Width, layer.GetSize().Height - labelSize.Height), 3); } }