public static void DrawSelectionBox(DevicePanel d, int x, int y, int Transparency, System.Drawing.Color BackgroundBoxColor, System.Drawing.Color BorderBoxColor, Classes.Scene.EditorEntity e, string boxText) { if (Methods.Solution.SolutionState.Main.ShowEntitySelectionBoxes && IsObjectOnScreen(d, e)) { if (e.RenderNotFound) { d.DrawRectangle(x, y, x + Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_WIDTH, y + Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_HEIGHT, System.Drawing.Color.FromArgb(Transparency, BackgroundBoxColor)); } else { d.DrawRectangle(x, y, x + Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_WIDTH, y + Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_HEIGHT, GetSelectedColor(BorderBoxColor, e)); } d.DrawLine(x, y, x + Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_WIDTH, y, System.Drawing.Color.FromArgb(Transparency, BorderBoxColor)); d.DrawLine(x, y, x, y + Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_HEIGHT, System.Drawing.Color.FromArgb(Transparency, BorderBoxColor)); d.DrawLine(x, y + Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_HEIGHT, x + Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_WIDTH, y + Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_HEIGHT, System.Drawing.Color.FromArgb(Transparency, BorderBoxColor)); d.DrawLine(x + Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_WIDTH, y, x + Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_WIDTH, y + Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_HEIGHT, System.Drawing.Color.FromArgb(Transparency, BorderBoxColor)); if (e.SelectedIndex != -1) { d.DrawText(string.Format("{0}", e.SelectedIndex + 1), x + 2, y + 2, Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_WIDTH, System.Drawing.Color.Black, true); } /* * if (Instance.ViewPanel.SharpPanel.GetZoom() >= 1 && boxText != "") * { * d.DrawTextSmall(boxText, x + 2, y + 1, Methods.Solution.SolutionConstants.ENTITY_NAME_BOX_WIDTH, System.Drawing.Color.FromArgb(Transparency, System.Drawing.Color.Black), true); * } */ } }
public override void Draw(Structures.EntityRenderProp properties) { DevicePanel d = properties.Graphics; Classes.Scene.EditorEntity entity = properties.EditorObject; int x = properties.DrawX; int y = properties.DrawY; int Transparency = properties.Transparency; string text = "UI/Text" + Methods.Solution.SolutionState.Main.CurrentManiaUILanguage + ".bin"; int topListID = (int)entity.attributesMap["topListID"].ValueEnum; int topFrameID = (int)entity.attributesMap["topFrameID"].ValueEnum; int botListID = (int)entity.attributesMap["botListID"].ValueEnum; int botFrameID = (int)entity.attributesMap["botFrameID"].ValueEnum; int panelSize = (int)entity.attributesMap["panelSize"].ValueEnum; bool botAlignRight = entity.attributesMap["botAlignRight"].ValueBool; bool botHidden = entity.attributesMap["botHidden"].ValueBool; panelSize /= 2; int top = x - 212; int left = y - panelSize; int bottom = x + 212; int right = y + panelSize; d.DrawRectangle(top, left, bottom, right, System.Drawing.Color.FromArgb(Transparency, 49, 162, 247)); d.DrawRectangle(top, left, x - 6, left + 24, System.Drawing.Color.FromArgb(Transparency, 0, 0, 0)); //e.DrawTriangle(d, x - 6, left + 12, 10, 24, 10, 10, 1, Transparency); if (!botHidden) { d.DrawRectangle(bottom, right, x - 6, right - 24, System.Drawing.Color.FromArgb(Transparency, 0, 0, 0)); //e.DrawTriangle(d, x - 6, right - 12, 24, 24, 10, 10, 0, Transparency); } bool fliph = false; bool flipv = false; var editorAnimTop = LoadAnimation(text, d, topListID, topFrameID); int topX = top + 68; int topY = left + 12; DrawTexturePivotNormal(d, editorAnimTop, editorAnimTop.RequestedAnimID, editorAnimTop.RequestedFrameID, topX, topY, Transparency, fliph, flipv); if (!botHidden) { var editorAnimBot = LoadAnimation(text, d, botListID, botFrameID); int botX = x + (botAlignRight ? editorAnimBot.RequestedFrame.Width - 6 : 0); int botY = right - 12; DrawTexturePivotNormal(d, editorAnimBot, editorAnimBot.RequestedAnimID, editorAnimBot.RequestedFrameID, botX, botY, Transparency, fliph, flipv); } }
public void Draw(DevicePanel d, bool EditDraw) { Rectangle screen = d.GetScreen(); int Transparency1 = (EditDraw ? 30 : BackgroundColor1.A); int Transparency2 = (EditDraw ? 30 : BackgroundColor2.A); Color Color1 = Color.FromArgb(Transparency1, BackgroundColor1.R, BackgroundColor1.G, BackgroundColor1.B); Color Color2 = Color.FromArgb(Transparency2, BackgroundColor2.R, BackgroundColor2.G, BackgroundColor2.B); int start_x; int end_x; int start_y; int end_y; if (!CameraUnlocked) { start_x = screen.X / (BOX_SIZE * TILE_SIZE); end_x = Math.Min(DivideRoundUp(screen.X + screen.Width, BOX_SIZE * TILE_SIZE), SceneWidth); start_y = screen.Y / (BOX_SIZE * TILE_SIZE); end_y = Math.Min(DivideRoundUp(screen.Y + screen.Height, BOX_SIZE * TILE_SIZE), SceneHeight); } else { start_x = 0; end_x = Math.Min(DivideRoundUp(SceneWidth, BOX_SIZE * TILE_SIZE), (int)(SceneWidth)); start_y = 0; end_y = Math.Min(DivideRoundUp(SceneHeight, BOX_SIZE * TILE_SIZE), (int)(SceneHeight)); } // Draw with first color everything d.DrawRectangle(screen.X, screen.Y, screen.X + screen.Width, screen.Y + screen.Height, Color1); if (Color2.A != 0) { for (int y = start_y; y < end_y; ++y) { for (int x = start_x; x < end_x; ++x) { if ((x + y) % 2 == 1) { d.DrawRectangle(x * BOX_SIZE * TILE_SIZE, y * BOX_SIZE * TILE_SIZE, (x + 1) * BOX_SIZE * TILE_SIZE, (y + 1) * BOX_SIZE * TILE_SIZE, Color2); } } } } }
public static void DrawBounds(DevicePanel d, int x, int y, int width, int height, int Transparency, System.Drawing.Color outline, System.Drawing.Color fill) { if (width != 0 && height != 0) { int x1 = x + width / -2; int x2 = x + width / 2 - 1; int y1 = y + height / -2; int y2 = y + height / 2 - 1; d.DrawRectangle(x1, y1, x2, y2, fill, outline, 1); var Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(d, "EditorAssets", 0, 1); // draw corners for (int i = 0; i < 4; i++) { bool right = (i & 1) > 0; bool bottom = (i & 2) > 0; int realX = (right ? x2 - 15 : x1); int realY = (bottom ? y2 - 15 : y1); DrawTexture(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, realX, realY, Transparency, right, bottom); } } }
public override void Draw(Structures.EntityRenderProp properties) { DevicePanel d = properties.Graphics; EditorEntity e = properties.EditorObject; int x = properties.DrawX; int y = properties.DrawY; int Transparency = properties.Transparency; bool fliph = false; bool flipv = false; string text = "UI/Text" + Methods.Solution.SolutionState.Main.CurrentManiaUILanguage + ".bin"; int characterID = (int)e.attributesMap["characterID"].ValueUInt8; int characterID_text = characterID; if (characterID >= 3) { characterID++; } d.DrawRectangle(x - 48, y - 48, x + 48, y + 48, System.Drawing.Color.FromArgb(128, 255, 255, 255)); var Animation = LoadAnimation("EditorUIRender", d, 1, 1); DrawTexturePivotNormal(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, x, y, Transparency, fliph, flipv); Animation = LoadAnimation(text, d, 8, characterID_text); DrawTexturePivotNormal(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, x, y + 32, Transparency, fliph, flipv); Animation = LoadAnimation("UI/SaveSelect.bin", d, 1, characterID); DrawTexturePivotNormal(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, x, y - 8, Transparency, fliph, flipv); }
private void DrawWaterBounds(DevicePanel d, ObjectDrawing.EditorAnimation editorAnim, int x, int y, int Transparency, int animID, int type, int widthPixels, int heightPixels, int heightX, int r, int g, int b, bool Selected) { //Draw Icon editorAnim = LoadAnimation("EditorIcons2", d, 0, 8); DrawTexturePivotNormal(d, editorAnim, editorAnim.RequestedAnimID, editorAnim.RequestedFrameID, x, y, Transparency); if (widthPixels != 0 && heightPixels != 0 && Selected) { int x1 = x + widthPixels / -2; int x2 = x + widthPixels / 2 - 1; int y1 = y + heightPixels / -2; int y2 = y + heightPixels / 2 - 1; if (Methods.Solution.SolutionState.Main.ShowWaterLevel) { if (!ManiacEditor.Properties.Settings.MyPerformance.UseSimplifedWaterRendering) { if (Methods.Solution.SolutionState.Main.AlwaysShowWaterLevel) { int startX = (Methods.Solution.SolutionState.Main.SizeWaterLevelwithBounds ? x1 : 0); int endX = (Methods.Solution.SolutionState.Main.SizeWaterLevelwithBounds ? x2 : Methods.Solution.CurrentSolution.SceneWidth); editorAnim = LoadAnimation("Global/Water.bin", d, 0, 0); d.DrawRectangle(startX, heightX, endX, Methods.Solution.CurrentSolution.SceneHeight, Methods.Solution.SolutionState.Main.waterColor); d.DrawLine(startX, heightX, endX, heightX, SystemColors.White); for (int i = startX; i < endX; i = i + 32) { DrawTexturePivotNormal(d, editorAnim, editorAnim.RequestedAnimID, editorAnim.RequestedFrameID, i, heightX, Transparency); } } } else { if (Methods.Solution.SolutionState.Main.AlwaysShowWaterLevel || Selected) { int startX = (Methods.Solution.SolutionState.Main.SizeWaterLevelwithBounds ? x1 : 0); int endX = (Methods.Solution.SolutionState.Main.SizeWaterLevelwithBounds ? x2 : Methods.Solution.CurrentSolution.SceneWidth); d.DrawRectangle(startX, heightX, endX, Methods.Solution.CurrentSolution.SceneHeight, Methods.Solution.SolutionState.Main.waterColor); d.DrawLine(startX, heightX, endX, heightX, SystemColors.White); } } } DrawBounds2(d, x2, y2, x1, y1, Transparency, SystemColors.Aqua, SystemColors.Transparent); } }
public override void Draw(Structures.EntityRenderProp properties) { DevicePanel d = properties.Graphics; EditorEntity entity = properties.EditorObject; int x = properties.DrawX; int y = properties.DrawY; int Transparency = properties.Transparency; bool fliph = false; bool flipv = false; string text = "UI/Text" + Methods.Solution.SolutionState.Main.CurrentManiaUILanguage + ".bin"; int playerID = (int)entity.attributesMap["playerID"].ValueUInt8; int player = 8; switch (playerID) { case 0: player = 8; break; case 1: player = 9; break; case 2: player = 10; break; case 3: player = 11; break; } d.DrawRectangle(x - 48, y - 48, x + 48, y + 48, System.Drawing.Color.FromArgb(Transparency, 255, 255, 255)); var editorAnimFrame = LoadAnimation("EditorUIRender", d, 1, 0); DrawTexturePivotNormal(d, editorAnimFrame, editorAnimFrame.RequestedAnimID, editorAnimFrame.RequestedFrameID, x, y, Transparency, fliph, flipv); var editorAnimBackground = LoadAnimation("UI/SaveSelect.bin", d, 14, 7); DrawTexturePivotNormal(d, editorAnimBackground, editorAnimBackground.RequestedAnimID, editorAnimBackground.RequestedFrameID, x, y - 8, Transparency, fliph, flipv); var editorAnimWaiting = LoadAnimation(text, d, 12, 7); DrawTexturePivotNormal(d, editorAnimWaiting, editorAnimWaiting.RequestedAnimID, editorAnimWaiting.RequestedFrameID, x, y - 8, Transparency, fliph, flipv); var editorAnimPlayerText = LoadAnimation(text, d, 12, player); DrawTexturePivotNormal(d, editorAnimPlayerText, editorAnimPlayerText.RequestedAnimID, editorAnimPlayerText.RequestedFrameID, x + 36, y - 38, Transparency, fliph, flipv); }
public static void DrawBounds2(DevicePanel d, int x1, int y1, int x2, int y2, int Transparency, System.Drawing.Color outline, System.Drawing.Color fill) { d.DrawRectangle(x1, y1, x2, y2, fill, outline, 1); var Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(d, "EditorAssets", 0, 1); // draw corners for (int i = 0; i < 4; i++) { bool right = (i & 1) > 0; bool bottom = (i & 2) > 0; int realX = (right ? x1 - 15 : x2); int realY = (bottom ? y1 - 15 : y2); DrawTexture(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, realX, realY, Transparency, right, bottom); } }
public static void DrawHitbox(DevicePanel Graphics, Methods.Drawing.ObjectDrawing.EditorAnimation Animation, string HitboxName, System.Drawing.Color color, int AnimID, int FrameID, int x, int y, int Transparency, bool FlipH = false, bool FlipV = false, int rotation = 0) { if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(AnimID, FrameID))) { var Frame = Animation.Animation.Animations[AnimID].Frames[FrameID]; if (Animation.Animation.CollisionBoxes.Contains(HitboxName)) { int hitboxIndex = Animation.Animation.CollisionBoxes.IndexOf(HitboxName); int x1 = x + (int)Frame.HitBoxes[hitboxIndex].Left; int y1 = y + (int)Frame.HitBoxes[hitboxIndex].Bottom; int x2 = x + (int)Frame.HitBoxes[hitboxIndex].Right; int y2 = y + (int)Frame.HitBoxes[hitboxIndex].Top; Graphics.DrawRectangle(x1, y1, x2, y2, color); } } }
public override void Draw(Structures.EntityRenderProp Properties) { DevicePanel d = Properties.Graphics; Classes.Scene.EditorEntity e = Properties.EditorObject; int x = Properties.DrawX; int y = Properties.DrawY; int Transparency = Properties.Transparency; bool fliph = false; bool flipv = false; int type = (int)e.attributesMap["type"].ValueEnum; System.Drawing.Color colour; switch (type) { case 0: colour = System.Drawing.Color.FromArgb(140, 0, 8, 192); break; case 1: colour = System.Drawing.Color.FromArgb(140, 8, 184, 0); break; case 2: colour = System.Drawing.Color.FromArgb(140, 56, 168, 240); break; default: colour = System.Drawing.Color.FromArgb(140, 56, 168, 240); break; } int animID = 0; //ProcessAnimation(frame.Entry.SpeedMultiplyer, frame.Entry.Frames.Count, frame.Frame.Delay); d.DrawRectangle(x - 14, y + 80, x + 14, y, colour); var Animation = LoadAnimation("CPZ/Syringe.bin", d, animID, 0); DrawTexturePivotNormal(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, x, y, Transparency, fliph, flipv); Animation = LoadAnimation("CPZ/Syringe.bin", d, animID, 1); DrawTexturePivotNormal(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, x, y, Transparency, fliph, flipv); }
public override void Draw(Structures.EntityRenderProp Properties) { DevicePanel d = Properties.Graphics; Classes.Scene.EditorEntity e = Properties.EditorObject; int type = (int)(e.attributesMap["type"].ValueUInt8); int width = (int)(e.attributesMap["width"].ValueEnum); int offset = (int)(e.attributesMap["offset"].ValueEnum); int x = Properties.DrawX; int y = Properties.DrawY; int Transparency = Properties.Transparency; int line_x1 = x - width / 2; int line_x2 = x + width / 2; int line_y1 = (y - 2); int line_y2 = (y + 1); d.DrawRectangle(line_x1, line_y1, line_x2, line_y2, System.Drawing.Color.FromArgb(Transparency, System.Drawing.Color.White), System.Drawing.Color.FromArgb(Transparency, System.Drawing.Color.Black), 1); var Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(Properties.Graphics, "EditorIcons", 0, 2); if (type == 0) { Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(Properties.Graphics, "EditorIcons2", 0, 23); } else if (type == 1) { Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(Properties.Graphics, "EditorIcons2", 0, 21); } else if (type == 2) { Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(Properties.Graphics, "EditorIcons2", 0, 22); } DrawTexturePivotNormal(Properties.Graphics, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, x, y, Transparency); }
public static void DrawBrushBox(DevicePanel GraphicPanel, bool Inactive = false) { int lastX = Methods.Solution.SolutionState.Main.LastX / Solution.SolutionConstants.TILE_SIZE * Solution.SolutionConstants.TILE_SIZE; int lastY = Methods.Solution.SolutionState.Main.LastY / Solution.SolutionConstants.TILE_SIZE * Solution.SolutionConstants.TILE_SIZE; int oddMod = (Methods.Solution.SolutionState.Main.DrawBrushSize % 2) * Methods.Solution.SolutionConstants.TILE_SIZE; int offset = (Methods.Solution.SolutionState.Main.DrawBrushSize / 2) * Methods.Solution.SolutionConstants.TILE_SIZE; int x1 = (int)(lastX) - offset; int x2 = (int)(lastX) + offset + oddMod; int y1 = (int)(lastY) - offset; int y2 = (int)(lastY) + offset + oddMod; int bound_x1 = (int)(x1); int bound_x2 = (int)(x2); int bound_y1 = (int)(y1); int bound_y2 = (int)(y2); if (bound_x1 != bound_x2 && bound_y1 != bound_y2) { if (bound_x1 > bound_x2) { bound_x1 = (int)(x2); bound_x2 = (int)(x1); } if (bound_y1 > bound_y2) { bound_y1 = (int)(y2); bound_y2 = (int)(y1); } } if (!Inactive) { GraphicPanel.DrawRectangle(bound_x1, bound_y1, bound_x2, bound_y2, System.Drawing.Color.FromArgb(100, System.Drawing.Color.Purple)); } GraphicPanel.DrawLine(bound_x1, bound_y1, bound_x2, bound_y1, System.Drawing.Color.Purple); GraphicPanel.DrawLine(bound_x1, bound_y1, bound_x1, bound_y2, System.Drawing.Color.Purple); GraphicPanel.DrawLine(bound_x2, bound_y2, bound_x2, bound_y1, System.Drawing.Color.Purple); GraphicPanel.DrawLine(bound_x2, bound_y2, bound_x1, bound_y2, System.Drawing.Color.Purple); }
public static void DrawSelectionBox(DevicePanel GraphicPanel, bool resetSelection = false) { if (!resetSelection) { int bound_x1 = (int)(Methods.Solution.SolutionState.Main.RegionX2); int bound_x2 = (int)(Methods.Solution.SolutionState.Main.LastX); int bound_y1 = (int)(Methods.Solution.SolutionState.Main.RegionY2); int bound_y2 = (int)(Methods.Solution.SolutionState.Main.LastY); if (bound_x1 != bound_x2 && bound_y1 != bound_y2) { if (bound_x1 > bound_x2) { bound_x1 = (int)(Methods.Solution.SolutionState.Main.LastX); bound_x2 = (int)(Methods.Solution.SolutionState.Main.RegionX2); } if (bound_y1 > bound_y2) { bound_y1 = (int)(Methods.Solution.SolutionState.Main.LastY); bound_y2 = (int)(Methods.Solution.SolutionState.Main.RegionY2); } if (ManiacEditor.Methods.Solution.SolutionState.Main.IsChunksEdit()) { bound_x1 = Classes.Scene.EditorLayer.GetChunkCoordinatesTopEdge(bound_x1, bound_y1).X; bound_y1 = Classes.Scene.EditorLayer.GetChunkCoordinatesTopEdge(bound_x1, bound_y1).Y; bound_x2 = Classes.Scene.EditorLayer.GetChunkCoordinatesBottomEdge(bound_x2, bound_y2).X; bound_y2 = Classes.Scene.EditorLayer.GetChunkCoordinatesBottomEdge(bound_x2, bound_y2).Y; } } GraphicPanel.DrawRectangle(bound_x1, bound_y1, bound_x2, bound_y2, System.Drawing.Color.FromArgb(100, System.Drawing.Color.Purple)); GraphicPanel.DrawLine(bound_x1, bound_y1, bound_x2, bound_y1, System.Drawing.Color.Purple); GraphicPanel.DrawLine(bound_x1, bound_y1, bound_x1, bound_y2, System.Drawing.Color.Purple); GraphicPanel.DrawLine(bound_x2, bound_y2, bound_x2, bound_y1, System.Drawing.Color.Purple); GraphicPanel.DrawLine(bound_x2, bound_y2, bound_x1, bound_y2, System.Drawing.Color.Purple); } else { Methods.Solution.SolutionState.Main.TempSelectX1 = 0; Methods.Solution.SolutionState.Main.TempSelectX2 = 0; Methods.Solution.SolutionState.Main.TempSelectY1 = 0; Methods.Solution.SolutionState.Main.TempSelectY2 = 0; } }
private void DrawGHZWater(DevicePanel d, ObjectDrawing.EditorAnimation editorAnim, int x, int y, int Transparency, int animID, int type, int widthPixels, int heightPixels, int heightX, int r, int g, int b, bool Selected) { //Draw Icon editorAnim = LoadAnimation("EditorIcons2", d, 0, 8); DrawTexturePivotNormal(d, editorAnim, editorAnim.RequestedAnimID, editorAnim.RequestedFrameID, x, y, Transparency); if (widthPixels != 0 && heightPixels != 0) { int x1 = x + widthPixels / -2; int x2 = x + widthPixels / 2 - 1; int y1 = y + heightPixels / -2; int y2 = y + heightPixels / 2 - 1; if (Selected) { //DrawWaterTileMap(d, x, y, x1, y1, widthPixels, heightPixels, GetWaterColors(255, r, g, b), Transparency); d.DrawRectangle(x1, y1, x2, y2, GetWaterColors(255, r, g, b)); if (TilesNeedUpdate) { TilesNeedUpdate = false; } } DrawBounds2(d, x2, y2, x1, y1, Transparency, SystemColors.Aqua, SystemColors.Transparent); } SystemColors GetWaterColors(int _a, int _r, int _g, int _b) { int red = _r; int green = _g; int blue = _b; if (red > 255) { red = 255; } if (blue > 255) { blue = 255; } if (green > 255) { green = 255; } if (red < 0) { red = 0; } if (blue < 0) { blue = 0; } if (green < 0) { green = 0; } return(SystemColors.FromArgb(_a, red, green, blue)); } }