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(DevicePanel d, SceneEntity entity, EditorEntity e, int x, int y, int Transparency)
        {
            int  angle      = (int)(entity.attributesMap["angle"].ValueInt32);
            int  length     = (int)(entity.attributesMap["length"].ValueVar / 1.4);
            bool fliph      = false;
            bool flipv      = false;
            var  editorAnim = e.LoadAnimation2("ZipLine", d, 0, -1, fliph, flipv, false);

            if (editorAnim != null && editorAnim.Frames.Count != 0)
            {
                var frame  = editorAnim.Frames[e.index];
                var frame2 = editorAnim.Frames[1];


                d.DrawBitmap(frame.Texture,
                             x + frame.Frame.CenterX - (fliph ? (frame.Frame.Width - editorAnim.Frames[0].Frame.Width) : 0),
                             y + frame.Frame.CenterY + (flipv ? (frame.Frame.Height - editorAnim.Frames[0].Frame.Height) : 0),
                             frame.Frame.Width, frame.Frame.Height, false, Transparency);
                d.DrawBitmap(frame2.Texture,
                             x + frame2.Frame.CenterX - (fliph ? (frame2.Frame.Width - editorAnim.Frames[0].Frame.Width) : 0),
                             y + frame2.Frame.CenterY + (flipv ? (frame2.Frame.Height - editorAnim.Frames[0].Frame.Height) : 0),
                             frame2.Frame.Width, frame2.Frame.Height, false, Transparency);

                if (length != 0)
                {
                    int[] processPoints = RotatePoints(x + length, y + length, x, y, -angle + 32);
                    d.DrawLine(x, y, processPoints[0], processPoints[1], System.Drawing.Color.FromArgb(255, 49, 48, 115));
                    d.DrawLine(x, y - 1, processPoints[0], processPoints[1] - 1, System.Drawing.Color.FromArgb(255, 99, 97, 165));
                    d.DrawBitmap(frame2.Texture,
                                 processPoints[0] + frame2.Frame.CenterX - (fliph ? (frame2.Frame.Width - editorAnim.Frames[0].Frame.Width) : 0) - 2,
                                 processPoints[1] + frame2.Frame.CenterY + (flipv ? (frame2.Frame.Height - editorAnim.Frames[0].Frame.Height) : 0) - 1,
                                 frame2.Frame.Width, frame2.Frame.Height, false, Transparency);
                }
            }
        }
Ejemplo n.º 3
0
        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;

            int  angle  = (int)(e.attributesMap["angle"].ValueInt32);
            int  length = (int)(e.attributesMap["length"].ValueEnum / 1.4);
            bool fliph  = false;
            bool flipv  = false;

            var editorAnim = LoadAnimation("GHZ/ZipLine.bin", d, 0, 0);

            DrawTexturePivotNormal(d, editorAnim, editorAnim.RequestedAnimID, editorAnim.RequestedFrameID, x, y, Transparency);
            var editorAnim2 = LoadAnimation("GHZ/ZipLine.bin", d, 0, 1);

            if (AreValuesDiffrent(x + length, y + length, x, y, -angle + 32))
            {
                LastRotatePoints = RotatePoints(x + length, y + length, x, y, -angle + 32);
            }

            if (length != 0)
            {
                d.DrawLine(x, y, LastRotatePoints[0], LastRotatePoints[1], System.Drawing.Color.FromArgb(255, 49, 48, 115));
                d.DrawLine(x, y - 1, LastRotatePoints[0], LastRotatePoints[1] - 1, System.Drawing.Color.FromArgb(255, 99, 97, 165));
                DrawTexturePivotNormal(d, editorAnim2, editorAnim2.RequestedAnimID, editorAnim2.RequestedFrameID, LastRotatePoints[0], LastRotatePoints[1], Transparency);
            }
        }
        public override void Draw(DevicePanel d, SceneEntity entity, EditorEntity e, int x, int y, int Transparency)
        {
            var widthPixels  = (int)(entity.attributesMap["size"].ValuePosition.X.High) * 2;
            var heightPixels = (int)(entity.attributesMap["size"].ValuePosition.Y.High) * 2;
            var width        = (int)widthPixels / 16;
            var height       = (int)heightPixels / 16;

            //Draw Icon
            var editorAnim = e.LoadAnimation2("EditorIcons2", d, 0, 5, false, false, false);

            if (editorAnim != null && editorAnim.Frames.Count != 0)
            {
                var frame2 = editorAnim.Frames[e.index];

                d.DrawBitmap(frame2.Texture,
                             x + frame2.Frame.CenterX,
                             y + frame2.Frame.CenterY,
                             frame2.Frame.Width, frame2.Frame.Height, false, Transparency);

                editorAnim = e.LoadAnimation2("EditorAssets", d, 0, 0, false, false, false);

                if (width != 0 && height != 0)
                {
                    int x1 = x + widthPixels / -2;
                    int x2 = x + widthPixels / 2 - 1;
                    int y1 = y + heightPixels / -2;
                    int y2 = y + heightPixels / 2 - 1;


                    d.DrawLine(x1, y1, x1, y2, SystemColors.White);
                    d.DrawLine(x1, y1, x2, y1, SystemColors.White);
                    d.DrawLine(x2, y2, x1, y2, SystemColors.White);
                    d.DrawLine(x2, y2, x2, y1, SystemColors.White);

                    // draw corners
                    for (int i = 0; i < 4; i++)
                    {
                        bool right  = (i & 1) > 0;
                        bool bottom = (i & 2) > 0;

                        editorAnim = e.LoadAnimation2("EditorAssets", d, 0, 0, right, bottom, false);
                        if (editorAnim != null && editorAnim.Frames.Count != 0)
                        {
                            var frame = editorAnim.Frames[e.index];
                            e.ProcessAnimation(frame.Entry.FrameSpeed, frame.Entry.Frames.Count, frame.Frame.Duration);
                            d.DrawBitmap(frame.Texture,
                                         (x + widthPixels / (right ? 2 : -2)) - (right ? frame.Frame.Width : 0),
                                         (y + heightPixels / (bottom ? 2 : -2) - (bottom ? frame.Frame.Height : 0)),
                                         frame.Frame.Width, frame.Frame.Height, false, Transparency);
                        }
                    }
                }
            }
        }
        public override void Draw(DevicePanel d, SceneEntity entity, EditorEntity e, int x, int y, int Transparency)
        {
            bool fliph      = false;
            bool flipv      = false;
            var  editorAnim = e.LoadAnimation2("EditorIcons2", d, 0, 6, fliph, flipv, false);
            var  width      = (int)(entity.attributesMap["size"].ValuePosition.X.High * 2 - 1);
            var  height     = (int)(entity.attributesMap["size"].ValuePosition.Y.High * 2 - 1);

            if (editorAnim != null && editorAnim.Frames.Count != 0)
            {
                var frame = editorAnim.Frames[e.index];

                d.DrawBitmap(frame.Texture,
                             x + frame.Frame.CenterX - (fliph ? (frame.Frame.Width - editorAnim.Frames[0].Frame.Width) : 0),
                             y + frame.Frame.CenterY + (flipv ? (frame.Frame.Height - editorAnim.Frames[0].Frame.Height) : 0),
                             frame.Frame.Width, frame.Frame.Height, false, Transparency);
            }

            if (width != -1 && height != -1)
            {
                bool wEven = width % 2 == 0;
                bool hEven = height % 2 == 0;

                int x1 = (x + (wEven ? -8 : -16) + (-width / 2 + width) * 16) + 15;
                int x2 = (x + (wEven ? -8 : -16) + (-width / 2) * 16);
                int y1 = (y + (hEven ? -8 : -16) + (-height / 2 + height) * 16) + 15;
                int y2 = (y + (hEven ? -8 : -16) + (-height / 2) * 16);


                d.DrawLine(x1, y1, x1, y2, SystemColors.White);
                d.DrawLine(x1, y1, x2, y1, SystemColors.White);
                d.DrawLine(x2, y2, x1, y2, SystemColors.White);
                d.DrawLine(x2, y2, x2, y1, SystemColors.White);

                // draw corners
                for (int i = 0; i < 4; i++)
                {
                    bool right  = (i & 1) > 0;
                    bool bottom = (i & 2) > 0;

                    editorAnim = e.LoadAnimation2("EditorAssets", d, 0, 0, right, bottom, false);
                    if (editorAnim != null && editorAnim.Frames.Count != 0)
                    {
                        var frame = editorAnim.Frames[e.index];
                        d.DrawBitmap(frame.Texture,
                                     (x + (wEven ? frame.Frame.CenterX : -frame.Frame.Width) + (-width / 2 + (right ? width : 0)) * frame.Frame.Width),
                                     (y + (hEven ? frame.Frame.CenterY : -frame.Frame.Height) + (-height / 2 + (bottom ? height : 0)) * frame.Frame.Height),
                                     frame.Frame.Width, frame.Frame.Height, false, Transparency);
                    }
                }
            }
        }
        public static void DrawSceneBounds(DevicePanel GraphicPanel)
        {
            int x1 = 0;
            int x2 = Methods.Solution.CurrentSolution.SceneWidth;
            int y1 = 0;
            int y2 = Methods.Solution.CurrentSolution.SceneHeight;


            GraphicPanel.DrawLine(x1, y1, x1, y2, System.Drawing.Color.White);
            GraphicPanel.DrawLine(x1, y1, x2, y1, System.Drawing.Color.White);
            GraphicPanel.DrawLine(x2, y2, x1, y2, System.Drawing.Color.White);
            GraphicPanel.DrawLine(x2, y2, x2, y1, System.Drawing.Color.White);
        }
        private void DrawNormalTensionPlatform(DevicePanel d, int x, int y, int Transparency, int amplitudeX, int amplitudeY, int angle, bool hasTension, int AttributeFrameID, Func <DevicePanel, int, int, int, System.Drawing.Color, bool> DrawCall = null)
        {
            if ((amplitudeX != 0 || amplitudeY != 0))
            {
                double xd           = x;
                double yd           = y;
                double x2           = x + amplitudeX - amplitudeX / 3.7;
                double y2           = y + amplitudeY - amplitudeY / 3.7;
                double radius       = Math.Pow(x2 - xd, 2) + Math.Pow(y2 - yd, 2);
                int    radiusInt    = (int)Math.Sqrt(radius);
                int    newX         = (int)(radiusInt * Math.Cos(Math.PI * angle / 128));
                int    newY         = (int)(radiusInt * Math.Sin(Math.PI * angle / 128));
                int    tensionCount = radiusInt / 16;

                d.DrawLine(x, y, x + newX, y - newY, System.Drawing.Color.Yellow, 3);
                d.DrawEllipse(x, y, amplitudeX, amplitudeY, System.Drawing.Color.White, 1);

                if (hasTension)
                {
                    for (int i = 0; i < tensionCount; i++)
                    {
                        int[] linePoints = RotatePoints(x + (16) * i, y, x, y, angle);
                        int   currentX   = linePoints[0];
                        int   currentY   = linePoints[1];
                        if (i == 0)
                        {
                            //Tension Center
                            var AnimationCenter = LoadAnimation(GetSetupAnimation(), d, 1, 2);
                            DrawTexturePivotNormal(d, AnimationCenter, AnimationCenter.RequestedAnimID, AnimationCenter.RequestedFrameID, currentX, currentY, Transparency);
                        }
                        else
                        {
                            //Tension Bar Segment
                            var AnimationRow = LoadAnimation(GetSetupAnimation(), d, 1, 1);
                            DrawTexturePivotNormal(d, AnimationRow, AnimationRow.RequestedAnimID, AnimationRow.RequestedFrameID, currentX, currentY, Transparency);
                        }
                    }
                }

                if (DrawCall != null)
                {
                    DrawCall(d, x + newX, y - newY, Transparency, System.Drawing.Color.FromArgb(255, 255, 255, 255));
                }
                else
                {
                    if (AttributeFrameID <= -1)
                    {
                        return;
                    }
                    string AnimName  = GetSetupAnimation();
                    var    Animation = LoadAnimation(AnimName, d);
                    if (LastFrameIDAttribute != AttributeFrameID)
                    {
                        UpdateRealAttributeFrameID(Animation, AttributeFrameID);
                    }
                    DrawTexturePivotNormal(d, Animation, RealAnimID, RealFrameID, x + newX, y - newY, Transparency);
                    //DrawHitbox(d, Animation, GetSetupAnimation(), System.Drawing.Color.FromArgb(128, 0, 255, 0), RealAnimID, RealFrameID, x + newX, y - newY, Transparency, false, false, 0);
                }
            }
        }
        private void DrawMovingPlatformSeven(DevicePanel d, int x, int y, int Transparency, int amplitudeX, int amplitudeY, int angle, bool hasTension, int AttributeFrameID, Func <DevicePanel, int, int, int, System.Drawing.Color, bool> DrawCall = null)
        {
            string AnimName  = GetSetupAnimation();
            var    Animation = LoadAnimation(AnimName, d);

            if (LastFrameIDAttribute != AttributeFrameID)
            {
                UpdateRealAttributeFrameID(Animation, AttributeFrameID);
            }

            int x1 = x - (amplitudeX / 2);
            int x2 = x + (amplitudeX / 2);
            int y1 = y - (amplitudeY / 2);
            int y2 = y + (amplitudeY / 2);

            d.DrawLine(x1, y1, x2, y2, System.Drawing.Color.Yellow, 3);
            if (DrawCall != null)
            {
                DrawCall(d, x, y, Transparency, System.Drawing.Color.FromArgb(255, 255, 255, 555));
            }
            else
            {
                if (AttributeFrameID <= -1)
                {
                    return;
                }
                DrawTexturePivotNormal(d, Animation, RealAnimID, RealFrameID, x, y, Transparency);
                //DrawHitbox(d, Animation, "Solid", System.Drawing.Color.FromArgb(128, 0, 255, 0), RealAnimID, RealFrameID, x, y, Transparency, false, false, 0);
            }
        }
Ejemplo n.º 9
0
        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;

            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 length = (int)e.attributesMap["length"].ValueUInt32;
            int angle  = (int)e.attributesMap["slope"].ValueEnum;

            var Animation = LoadAnimation("LRZ2/LRZConveyor.bin", d, 0, 0);

            int[] newPos  = RotatePoints(x - (length / 2), y, x, y, -angle);
            int[] newPos2 = RotatePoints(x + (length / 2), y, x, y, -angle);

            int spaceA = 15;
            int spaceB = 16;


            if (length >= 1)
            {
                int[] newPosAngle   = RotatePoints(newPos[0] - spaceA, newPos[1], newPos[0], newPos[1], -angle + 64);
                int[] newPosAngle2  = RotatePoints(newPos[0] + spaceA, newPos[1], newPos[0], newPos[1], -angle + 64);
                int[] newPos2Angle  = RotatePoints(newPos2[0] - spaceA, newPos2[1], newPos2[0], newPos2[1], -angle + 64);
                int[] newPos2Angle2 = RotatePoints(newPos2[0] + spaceA, newPos2[1], newPos2[0], newPos2[1], -angle + 64);

                d.DrawLine(newPosAngle[0], newPosAngle[1], newPos2Angle[0], newPos2Angle[1], color1default, 2);
                d.DrawLine(newPosAngle2[0], newPosAngle2[1], newPos2Angle2[0], newPos2Angle2[1], color1default, 2);

                newPosAngle   = RotatePoints(newPos[0] - spaceB, newPos[1], newPos[0], newPos[1], -angle + 64);
                newPosAngle2  = RotatePoints(newPos[0] + spaceB, newPos[1], newPos[0], newPos[1], -angle + 64);
                newPos2Angle  = RotatePoints(newPos2[0] - spaceB, newPos2[1], newPos2[0], newPos2[1], -angle + 64);
                newPos2Angle2 = RotatePoints(newPos2[0] + spaceB, newPos2[1], newPos2[0], newPos2[1], -angle + 64);
                d.DrawLine(newPosAngle[0], newPosAngle[1], newPos2Angle[0], newPos2Angle[1], color2default, 2);
                d.DrawLine(newPosAngle2[0], newPosAngle2[1], newPos2Angle2[0], newPos2Angle2[1], color2default, 2);
                //d.DrawDashedLine(newPosAngle[0], newPosAngle[1], newPos2Angle[0], newPos2Angle[1], RollerColors[0], RollerColors[1], RollerColors[2], RollerColors[3], 2);
                //d.DrawDashedLine(newPosAngle2[0], newPosAngle2[1], newPos2Angle2[0], newPos2Angle2[1], RollerColors[0], RollerColors[1], RollerColors[2], RollerColors[3], 2);
            }

            DrawTexturePivotNormal(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, newPos[0], newPos[1], Transparency, fliph, flipv);
            DrawTexturePivotNormal(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, newPos2[0], newPos2[1], Transparency, fliph, flipv);
        }
Ejemplo n.º 11
0
        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;

            var widthPixels  = (int)(e.attributesMap["size"].ValueVector2.X.High);
            var heightPixels = (int)(e.attributesMap["size"].ValueVector2.Y.High);
            var width        = (int)widthPixels / 16;
            var height       = (int)heightPixels / 16;

            if (width != 0 && height != 0)
            {
                int x1 = x + widthPixels / -2;
                int x2 = x + widthPixels / 2 - 1;
                int y1 = y + heightPixels / -2;
                int y2 = y + heightPixels / 2 - 1;


                d.DrawLine(x1, y1, x1, y2, SystemColors.White);
                d.DrawLine(x1, y1, x2, y1, SystemColors.White);
                d.DrawLine(x2, y2, x1, y2, SystemColors.White);
                d.DrawLine(x2, y2, x2, y1, SystemColors.White);

                // draw corners
                for (int i = 0; i < 4; i++)
                {
                    bool right  = (i & 1) > 0;
                    bool bottom = (i & 2) > 0;

                    var Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(d, "EditorAssets", 0, 1);
                    DrawTexture(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID,
                                (x + widthPixels / (right ? 2 : -2)) - (right ? Animation.RequestedFrame.Width : 0),
                                (y + heightPixels / (bottom ? 2 : -2) - (bottom ? Animation.RequestedFrame.Height : 0)),
                                Transparency, right, bottom);
                }
            }
        }
        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;
            int  direction    = (int)entity.attributesMap["direction"].ValueUInt8;
            int  pullDir      = (int)entity.attributesMap["pullDir"].ValueUInt8;
            int  length       = (int)(entity.attributesMap["length"].ValueEnum);
            int  angle        = (int)(entity.attributesMap["angle"].ValueEnum);
            bool flipSides    = false;

            if (direction == 0)
            {
                flipSides = true;
            }



            x -= (flipSides ? -18 : 18);

            //y += 26;
            int[] processPoints = RotatePoints(x + length + 26, y, x, y, (int)(angle / -1.995));

            d.DrawLine(x + 2, y, processPoints[0] + 2, processPoints[1], System.Drawing.Color.FromArgb(255, 0, 32, 0));
            d.DrawLine(x + 1, y, processPoints[0] + 1, processPoints[1], System.Drawing.Color.FromArgb(255, 198, 32, 0));
            d.DrawLine(x, y, processPoints[0], processPoints[1], System.Drawing.Color.FromArgb(255, 231, 130, 0));
            d.DrawLine(x - 1, y, processPoints[0] - 1, processPoints[1], System.Drawing.Color.FromArgb(255, 198, 32, 0));
            d.DrawLine(x - 2, y, processPoints[0] - 2, processPoints[1], System.Drawing.Color.FromArgb(255, 0, 32, 0));

            var editorAnimHandle = LoadAnimation("SSZ1/SDashWheel.bin", d, 3, 0);

            DrawTexturePivotPlus(d, editorAnimHandle, editorAnimHandle.RequestedAnimID, editorAnimHandle.RequestedFrameID, processPoints[0], processPoints[1], -(flipSides ? -5 : 5), (flipSides ? 10 : -10), Transparency, false, false, angle);

            var editorAnim = LoadAnimation("SSZ1/SDashWheel.bin", d, 0, 0);

            DrawTexturePivotNormal(d, editorAnim, editorAnim.RequestedAnimID, editorAnim.RequestedFrameID, x, y, Transparency);
            var editorAnimKnob = LoadAnimation("SSZ1/SDashWheel.bin", d, 2, 0);

            DrawTexturePivotNormal(d, editorAnimKnob, editorAnimKnob.RequestedAnimID, editorAnimKnob.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;
            }
        }
Ejemplo n.º 15
0
        public void DrawGrid(DevicePanel d)
        {
            Rectangle screen = d.GetScreen();

            int start_x;
            int end_x;
            int start_y;
            int end_y;

            if (!CameraUnlocked)
            {
                start_x = screen.X / (TILE_BOX_SIZE * GridSize);
                end_x   = Math.Min(DivideRoundUp(screen.X + screen.Width, TILE_BOX_SIZE * GridSize), SceneWidth);
                start_y = screen.Y / (TILE_BOX_SIZE * GridSize);
                end_y   = Math.Min(DivideRoundUp(screen.Y + screen.Height, TILE_BOX_SIZE * GridSize), SceneHeight);
            }
            else
            {
                start_x = screen.X / (TILE_BOX_SIZE * GridSize);
                end_x   = Math.Min(DivideRoundUp(screen.X + screen.Width, TILE_BOX_SIZE * GridSize), screen.Width);
                start_y = screen.Y / (TILE_BOX_SIZE * GridSize);
                end_y   = Math.Min(DivideRoundUp(screen.Y + screen.Height, TILE_BOX_SIZE * GridSize), screen.Height);
            }

            for (int y = start_y; y < end_y; ++y)
            {
                for (int x = start_x; x < end_x; ++x)
                {
                    if (x >= 0 && y >= 0)
                    {
                        d.DrawLine(x * GridSize, y * GridSize, x * GridSize + GridSize, y * GridSize, GridColor);
                        d.DrawLine(x * GridSize, y * GridSize, x * GridSize, y * GridSize + GridSize, GridColor);
                        d.DrawLine(x * GridSize + GridSize, y * GridSize + GridSize, x * GridSize + GridSize, y * GridSize, GridColor);
                        d.DrawLine(x * GridSize + GridSize, y * GridSize + GridSize, x * GridSize, y * GridSize + GridSize, GridColor);
                    }
                }
            }
        }
        public override void Draw(DevicePanel d, SceneEntity entity, EditorEntity e, int x, int y, int Transparency)
        {
            int  length     = (int)entity.attributesMap["length"].ValueVar;
            int  angle      = (int)entity.attributesMap["angle"].ValueVar;
            bool fliph      = false;
            bool flipv      = false;
            var  editorAnim = e.LoadAnimation2("PaperRoller", d, 0, -1, fliph, flipv, false);

            if (editorAnim != null && editorAnim.Frames.Count != 0)
            {
                var   frame         = editorAnim.Frames[e.index];
                int[] newPos        = RotatePoints(x - (length / 2), y, x, y, -angle);
                int[] newPos2       = RotatePoints(x + (length / 2), y, x, y, -angle);
                int[] newPosAngle   = RotatePoints(newPos[0] - 23, newPos[1], newPos[0], newPos[1], -angle + 64);
                int[] newPosAngle2  = RotatePoints(newPos[0] + 24, newPos[1], newPos[0], newPos[1], -angle + 64);
                int[] newPos2Angle  = RotatePoints(newPos2[0] - 23, newPos2[1], newPos2[0], newPos2[1], -angle + 64);
                int[] newPos2Angle2 = RotatePoints(newPos2[0] + 24, newPos2[1], newPos2[0], newPos2[1], -angle + 64);

                e.ProcessAnimation(frame.Entry.FrameSpeed, frame.Entry.Frames.Count, frame.Frame.Duration);


                d.DrawBitmap(frame.Texture,
                             newPos[0] + frame.Frame.CenterX - (fliph ? (frame.Frame.Width - editorAnim.Frames[0].Frame.Width) : 0),
                             newPos[1] + frame.Frame.CenterY + (flipv ? (frame.Frame.Height - editorAnim.Frames[0].Frame.Height) : 0),
                             frame.Frame.Width, frame.Frame.Height, false, Transparency);

                d.DrawBitmap(frame.Texture,
                             newPos2[0] + frame.Frame.CenterX - (fliph ? (frame.Frame.Width - editorAnim.Frames[0].Frame.Width) : 0),
                             newPos2[1] + frame.Frame.CenterY + (flipv ? (frame.Frame.Height - editorAnim.Frames[0].Frame.Height) : 0),
                             frame.Frame.Width, frame.Frame.Height, false, Transparency);

                if (length >= 1)
                {
                    d.DrawLine(newPosAngle[0], newPosAngle[1], newPos2Angle[0], newPos2Angle[1], System.Drawing.Color.LightGray);
                    d.DrawLine(newPosAngle2[0], newPosAngle2[1], newPos2Angle2[0], newPos2Angle2[1], System.Drawing.Color.LightGray);
                }
            }
        }
        public void DrawSine(DevicePanel d, int x, int y, int amplitude, int period, int height, SystemColors colors)
        {
            int x1 = x, y2 = y;
            int max = height + y;

            while (y2 < max)
            {
                var y1      = y2++;
                var radians = (y2 - y) * 2 * Math.PI / period;
                var x2      = x + (int)Math.Round(amplitude * Math.Sin(radians));
                d.DrawLine(x1, y1, x2, y2, colors, 2);
                x1 = x2;
            }
        }
Ejemplo n.º 18
0
        public void DrawSineWave(DevicePanel d, Point[] points)
        {
            if (points == null || points.Length == 0)
            {
                return;
            }
            var lastPoint = points[0];

            for (int i = 1; i < points.Length; i++)
            {
                d.DrawLine(lastPoint.X, lastPoint.Y, points[i].X, points[i].Y, SystemColors.GreenYellow, 4);
                lastPoint = points[i];
            }
        }
Ejemplo n.º 19
0
        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 distance = e.attributesMap["distance"].ValueUInt16;

            d.DrawLine(x, y, x, y + distance, System.Drawing.Color.Black);
            var Animation = LoadAnimation(GetSetupAnimation(), d, 0, 0);

            DrawTexturePivotNormal(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, x, y + distance, Transparency, fliph, flipv);
        }
Ejemplo n.º 20
0
        public void DrawCenteredSpline(DevicePanel d, EditorEntity start, EditorEntity end, Int32 length1, Int32 angle1, Int32 length2, Int32 angle2)
        {
            if (SetFilter(end) == true)
            {
                return;
            }
            int startX = start.Position.X.High;
            int startY = start.Position.Y.High;
            int endX   = end.Position.X.High;
            int endY   = end.Position.Y.High;

            int dx = endX - startX;
            int dy = endY - startY;

            int offsetX            = 0;
            int offsetY            = 0;
            int offsetDestinationX = 0;
            int offsetDestinationY = 0;

            int x1 = startX + offsetX;
            int y1 = startY + offsetY;
            int x2 = end.Position.X.High + offsetDestinationX;
            int y2 = end.Position.Y.High + offsetDestinationY;

            int x3 = x1;
            int y3 = y2;
            int x4 = x2;
            int y4 = y1;

            //d.DrawBézierSplineCubic(x1, y1, x3, y3, x4, y4, x2, y2, Color.YellowGreen);

            // d.DrawLine(x1, y1, x1, y2, Color.YellowGreen);
            // d.DrawLine(x1, y1, x2, y1, Color.YellowGreen);
            // d.DrawLine(x2, y2, x2, y1, Color.YellowGreen);
            // d.DrawLine(x2, y2, x1, y2, Color.YellowGreen);

            d.DrawLine(x1, y1, x2, y2, Color.YellowGreen);
        }
Ejemplo n.º 21
0
        private void DrawCircleBumperNormal(DevicePanel d, Methods.Drawing.ObjectDrawing.EditorAnimation Animation, int x, int y, int Transparency, int amplitudeX, int amplitudeY, int angle)
        {
            if ((amplitudeX != 0 || amplitudeY != 0))
            {
                double xd        = x;
                double yd        = y;
                double x2        = x + amplitudeX - amplitudeX / 3.7;
                double y2        = y + amplitudeY - amplitudeY / 3.7;
                double radius    = Math.Pow(x2 - xd, 2) + Math.Pow(y2 - yd, 2);
                int    radiusInt = (int)Math.Sqrt(radius);
                int    newX      = (int)(radiusInt * Math.Cos(Math.PI * angle / 128));
                int    newY      = (int)(radiusInt * Math.Sin(Math.PI * angle / 128));

                d.DrawLine(x, y, x + newX, y - newY, System.Drawing.Color.Yellow, 3);
                d.DrawEllipse(x, y, amplitudeX, amplitudeY, System.Drawing.Color.White, 2);

                DrawTexturePivotNormal(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, (x + newX), (y - newY), Transparency);
            }
            else
            {
                DrawTexturePivotNormal(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, x, y, Transparency);
            }
        }
        public override void Draw(DevicePanel d, SceneEntity entity, EditorEntity e, int x, int y, int Transparency)
        {
            var type   = entity.attributesMap["type"].ValueUInt8;
            var width  = (int)(entity.attributesMap["size"].ValuePosition.X.High) - 1;
            var height = (int)(entity.attributesMap["size"].ValuePosition.Y.High) - 1;

            var editorAnim = e.LoadAnimation2("EditorAssets", d, 0, 0, false, false, false);

            if (width != -1 && height != -1)
            {
                bool wEven = width % 2 == 0;
                bool hEven = height % 2 == 0;

                int x1 = (x + (wEven ? -8 : -16) + (-width / 2 + width) * 16) + 15;
                int x2 = (x + (wEven ? -8 : -16) + (-width / 2) * 16);
                int y1 = (y + (hEven ? -8 : -16) + (-height / 2 + height) * 16) + 15;
                int y2 = (y + (hEven ? -8 : -16) + (-height / 2) * 16);


                d.DrawLine(x1, y1, x1, y2, SystemColors.White);
                d.DrawLine(x1, y1, x2, y1, SystemColors.White);
                d.DrawLine(x2, y2, x1, y2, SystemColors.White);
                d.DrawLine(x2, y2, x2, y1, SystemColors.White);

                // draw corners
                for (int i = 0; i < 4; i++)
                {
                    bool right  = (i & 1) > 0;
                    bool bottom = (i & 2) > 0;

                    editorAnim = e.LoadAnimation2("EditorAssets", d, 0, 0, right, bottom, false);
                    if (editorAnim != null && editorAnim.Frames.Count != 0)
                    {
                        var frame = editorAnim.Frames[e.index];
                        e.ProcessAnimation(frame.Entry.FrameSpeed, frame.Entry.Frames.Count, frame.Frame.Duration);
                        d.DrawBitmap(frame.Texture,
                                     (x + (wEven ? frame.Frame.CenterX : -frame.Frame.Width) + (-width / 2 + (right ? width : 0)) * frame.Frame.Width),
                                     (y + (hEven ? frame.Frame.CenterY : -frame.Frame.Height) + (-height / 2 + (bottom ? height : 0)) * frame.Frame.Height),
                                     frame.Frame.Width, frame.Frame.Height, false, Transparency);
                    }
                }
            }

            bool knux   = entity.attributesMap["onlyKnux"].ValueBool;
            bool mighty = entity.attributesMap.ContainsKey("onlyMighty") && entity.attributesMap["onlyMighty"].ValueBool;

            // draw Knuckles icon
            if (knux)
            {
                editorAnim = e.LoadAnimation2("HUD", d, 2, 2, false, false, false);
                if (editorAnim != null && editorAnim.Frames.Count != 0)
                {
                    var frame = editorAnim.Frames[e.index];
                    e.ProcessAnimation(frame.Entry.FrameSpeed, frame.Entry.Frames.Count, frame.Frame.Duration);
                    d.DrawBitmap(frame.Texture, x - frame.Frame.Width / (mighty ? 1 : 2), y - frame.Frame.Height / 2, frame.Frame.Width, frame.Frame.Height, false, Transparency);
                }
            }

            // draw Mighty icon
            if (mighty)
            {
                editorAnim = e.LoadAnimation2("HUD", d, 2, 3, false, false, false);
                if (editorAnim != null && editorAnim.Frames.Count != 0)
                {
                    var frame = editorAnim.Frames[e.index];
                    e.ProcessAnimation(frame.Entry.FrameSpeed, frame.Entry.Frames.Count, frame.Frame.Duration);
                    d.DrawBitmap(frame.Texture, x - (knux ? 0 : frame.Frame.Width / 2), y - frame.Frame.Height / 2, frame.Frame.Width, frame.Frame.Height, false, Transparency);
                }
            }
        }
Ejemplo n.º 23
0
        public override void Draw(DevicePanel d, SceneEntity entity, EditorEntity e, int x, int y, int Transparency)
        {
            int  type         = (int)entity.attributesMap["type"].ValueVar;
            var  widthPixels  = (int)(entity.attributesMap["size"].ValuePosition.X.High);
            var  heightPixels = (int)(entity.attributesMap["size"].ValuePosition.Y.High);
            var  width        = (int)widthPixels / 16;
            var  height       = (int)heightPixels / 16;
            bool fliph        = false;
            bool flipv        = false;
            int  animID;

            if (type == 2)
            {
                animID = 2;
            }
            else
            {
                animID = 0;
            }
            var editorAnim = e.LoadAnimation2("Water", d, animID, -1, fliph, flipv, false);

            if (editorAnim != null && editorAnim.Frames.Count != 0 && animID >= 0 && type != 1)
            {
                var frame = editorAnim.Frames[e.index];

                e.ProcessAnimation(frame.Entry.FrameSpeed, frame.Entry.Frames.Count, frame.Frame.Duration);

                d.DrawBitmap(frame.Texture,
                             x + frame.Frame.CenterX - (fliph ? (frame.Frame.Width - editorAnim.Frames[0].Frame.Width) : 0),
                             y + frame.Frame.CenterY + (flipv ? (frame.Frame.Height - editorAnim.Frames[0].Frame.Height) : 0),
                             frame.Frame.Width, frame.Frame.Height, false, Transparency);
            }
            else if (width != 0 && height != 0 && type != 2)
            {
                //Draw Icon
                editorAnim = e.LoadAnimation2("EditorIcons2", d, 0, 8, fliph, flipv, false);
                if (editorAnim != null && editorAnim.Frames.Count != 0)
                {
                    var frame = editorAnim.Frames[e.index];

                    d.DrawBitmap(frame.Texture,
                                 x + frame.Frame.CenterX - (fliph ? (frame.Frame.Width - editorAnim.Frames[0].Frame.Width) : 0),
                                 y + frame.Frame.CenterY + (flipv ? (frame.Frame.Height - editorAnim.Frames[0].Frame.Height) : 0),
                                 frame.Frame.Width, frame.Frame.Height, false, Transparency);
                }
                int x1 = x + widthPixels /  -2;
                int x2 = x + widthPixels / 2 - 1;
                int y1 = y + heightPixels / -2;
                int y2 = y + heightPixels / 2 - 1;


                d.DrawLine(x1, y1, x1, y2, SystemColors.Aqua);
                d.DrawLine(x1, y1, x2, y1, SystemColors.Aqua);
                d.DrawLine(x2, y2, x1, y2, SystemColors.Aqua);
                d.DrawLine(x2, y2, x2, y1, SystemColors.Aqua);


                // draw corners
                for (int i = 0; i < 4; i++)
                {
                    bool right  = (i & 1) > 0;
                    bool bottom = (i & 2) > 0;

                    editorAnim = e.LoadAnimation2("EditorAssets", d, 2, 0, right, bottom, false);
                    if (editorAnim != null && editorAnim.Frames.Count != 0)
                    {
                        var frame = editorAnim.Frames[e.index];
                        e.ProcessAnimation(frame.Entry.FrameSpeed, frame.Entry.Frames.Count, frame.Frame.Duration);
                        d.DrawBitmap(frame.Texture,
                                     (x + widthPixels / (right ? 2 : -2)) - (right ? frame.Frame.Width : 0),
                                     (y + heightPixels / (bottom ? 2 : -2) - (bottom ? frame.Frame.Height : 0)),
                                     frame.Frame.Width, frame.Frame.Height, false, Transparency);
                    }
                }
            }
        }