Ejemplo n.º 1
0
        public void Update(InputHandler handler, int x, int y)
        {
            if (!neverEditAgain)
            {
                if (handler.CheckJustPressedKey(Keys.H))
                {
                    showMode = !showMode;
                }

                if (handler.CheckLeftMouseJustPressed())
                {
                    if (handler.CheckMouseIn(c.ScalePosition(start)))
                    {
                        dragPointC = true;
                        original = c.GetPoint();
                    }
                    else
                        if (handler.CheckMouseIn(b.ScalePosition(start)))
                        {
                            dragPointB = true;

                            original = b.GetPoint();
                        }
                        else
                            if (handler.CheckMouseIn(a.ScalePosition(start)))
                            {
                                dragPointA = true;

                                original = a.GetPoint();
                            }
                }
                else
                    if (handler.CheckLeftMouseJustReleased())
                    {
                        dragPointA = dragPointB = dragPointC = false;
                    }

                    if (dragPointA)
                    {
                        a.SetPoint(original + handler.LeftMouseDraggedBy());
                    }
                    else
                        if (dragPointB)
                        {

                            b.SetPoint(original + handler.LeftMouseDraggedBy());
                        }
                        else
                            if (dragPointC)
                            {

                                c.SetPoint(original + handler.LeftMouseDraggedBy());
                            }
            }
            start.X = x;
            start.Y = y;
        }
        public static void UpdateTextBox(DragDropTextbox textbox, InputHandler inputHandler)
        {
            #region If there is a textbox
                if (textbox != null)
                {
                    var keys = inputHandler.KeysJustPressed();
                    #region Detect Normal Keys
                    foreach (var key in keys)
                    {

                        char keyLetter = (char)key;
                        if ((keyLetter >= 'A' && keyLetter <= 'Z') || (keyLetter >= '0' && keyLetter <= '9'))
                        {
                            if (!inputHandler.CheckPressedKey(Microsoft.Xna.Framework.Input.Keys.LeftShift))
                            {
                                keyLetter = Char.ToLower(keyLetter);
                            }
                            else
                            {
                                switch (keyLetter)
                                {
                                    case '0':
                                        keyLetter = ')';
                                        break;
                                    case '1':
                                        keyLetter = '!';
                                        break;
                                    case '2':
                                        keyLetter = '@';
                                        break;
                                    case '3':
                                        keyLetter = '#';
                                        break;
                                    case '4':
                                        keyLetter = '$';
                                        break;
                                    case '5':
                                        keyLetter = '%';
                                        break;
                                    case '6':
                                        keyLetter = '^';
                                        break;
                                    case '7':
                                        keyLetter = '&';
                                        break;
                                    case '8':
                                        keyLetter = '*';
                                        break;
                                    case '9':
                                        keyLetter = '(';
                                        break;
                                }
                            }

                            (textbox).AddLetter(keyLetter);

                        }
                    }
                    #endregion
                    #region Other Keys
                    if (inputHandler.CheckJustPressedKey(Microsoft.Xna.Framework.Input.Keys.Back))
                    {
                        (textbox).RemoveLetter();
                    }

                    if (inputHandler.CheckJustPressedKey(Microsoft.Xna.Framework.Input.Keys.OemMinus))
                    {
                        if (inputHandler.CheckPressedKey(Microsoft.Xna.Framework.Input.Keys.LeftShift))
                            (textbox).AddLetter('_');
                        else
                            (textbox).AddLetter('-');
                    }

                    if (inputHandler.CheckJustPressedKey(Microsoft.Xna.Framework.Input.Keys.OemPlus))
                    {
                        if (inputHandler.CheckPressedKey(Microsoft.Xna.Framework.Input.Keys.LeftShift))
                            (textbox).AddLetter('+');
                        else
                            (textbox).AddLetter('=');
                    }

                    if (inputHandler.CheckJustPressedKey(Microsoft.Xna.Framework.Input.Keys.Left))
                    {
                        (textbox).PositionDecrease();
                        scrollTextbox = 1;
                    }

                    if (inputHandler.CheckJustPressedKey(Microsoft.Xna.Framework.Input.Keys.Enter))
                    {
                        (textbox).Enter();
                    }

                    if (inputHandler.CheckJustPressedKey(Microsoft.Xna.Framework.Input.Keys.Space))
                    {
                        (textbox).AddLetter(' ');
                    }

                    if (inputHandler.CheckJustPressedKey(Microsoft.Xna.Framework.Input.Keys.OemComma))
                    {
                        if (!inputHandler.CheckPressedKey(Microsoft.Xna.Framework.Input.Keys.LeftShift))
                            (textbox).AddLetter(',');
                        else
                            (textbox).AddLetter('<');

                    }

                    if (inputHandler.CheckJustPressedKey(Microsoft.Xna.Framework.Input.Keys.OemPipe))
                    {
                        if (!inputHandler.CheckPressedKey(Microsoft.Xna.Framework.Input.Keys.LeftShift))
                            (textbox).AddLetter('\\');
                        else
                            (textbox).AddLetter('|');

                    }

                    if(inputHandler.CheckJustPressedKey(Keys.OemTilde))
                    {
                         if (!inputHandler.CheckPressedKey(Keys.LeftShift))
                            (textbox).AddLetter('`');
                        else
                            (textbox).AddLetter('~');
                    }

                    if (inputHandler.CheckJustPressedKey(Microsoft.Xna.Framework.Input.Keys.OemPeriod))
                    {

                        if (!inputHandler.CheckPressedKey(Microsoft.Xna.Framework.Input.Keys.LeftShift))
                            (textbox).AddLetter('.');
                        else
                            (textbox).AddLetter('>');
                    }

                    if (inputHandler.CheckJustPressedKey(Microsoft.Xna.Framework.Input.Keys.OemQuestion))
                    {
                        if (inputHandler.CheckPressedKey(Microsoft.Xna.Framework.Input.Keys.LeftShift))
                            (textbox).AddLetter('?');
                        else
                            (textbox).AddLetter('/');
                    }

                    if (inputHandler.CheckJustPressedKey(Microsoft.Xna.Framework.Input.Keys.OemQuotes))
                    {
                        if (inputHandler.CheckPressedKey(Microsoft.Xna.Framework.Input.Keys.LeftShift))
                            (textbox).AddLetter('\"');
                        else
                            (textbox).AddLetter('\'');

                    }

                    if (inputHandler.CheckJustPressedKey(Microsoft.Xna.Framework.Input.Keys.Right))
                    {
                        (textbox).PositionIncrease();
                        scrollTextbox = 1;
                    }

                    #endregion
                    #region Arrow Keys
                    if (inputHandler.CheckPressedKey(Keys.Left))
                    {
                        scrollTextbox = (byte)((scrollTextbox < 5) ? (scrollTextbox + 1) : 0);

                        if (scrollTextbox == 0)
                        {
                            (textbox).PositionDecrease();
                        }
                    }
                    else
                        if (inputHandler.CheckPressedKey(Keys.Right))
                        {
                            scrollTextbox = (byte)(scrollTextbox < 5 ? (scrollTextbox + 1) : 0);
                            if (scrollTextbox == 0)
                            {
                                (textbox).PositionIncrease();
                            }
                        }
                        else if (inputHandler.CheckPressedKey(Keys.Back))
                        {
                            scrollTextbox = (byte)(scrollTextbox < 12 ? (scrollTextbox + 1) : 0);
                            if (scrollTextbox == 0)
                            {
                                (textbox).RemoveLetter();
                            }
                        }
                        else
                        {
                            scrollTextbox = 1;
                        }

                    #endregion

                #endregion
            }
        }
Ejemplo n.º 3
0
        public void Update(InputHandler handler)
        {
            try
            {
                if (textBox.GetSelected())
                {
                    DragDropInterface.UpdateTextBox(textBox, handler);

                    return;
                }

                if (fileMode != 0)
                {
                    if (fileMode == 1)
                    {

                        SaveFileSystem.SaveObjectToFile(new World(objects.ToArray()), "Levels" + Path.DirectorySeparatorChar + textBox.GetText() + ".taj");
                        textBox.SetText("");
                    }
                    else if (fileMode == 2)
                    {
                        World n = SaveFileSystem.LoadObjectFromFile<World>("Levels" + Path.DirectorySeparatorChar + textBox.GetText() + ".taj", new GameLoader());
                        objects.Clear();
                        objects.AddRange(n.GetObjects());
                    }
                    else if (fileMode == 3)
                    {

                        ((LevelPerson)couldDrag).SetBodyAnimation(textBox.GetText() + ".taj");
                        ((LevelPerson)couldDrag).SetLoop(true);
                        ((LevelPerson)couldDrag).SetPlaying(true);

                    }
                    else if (fileMode == 4)
                    {

                        ((LevelPerson)couldDrag).SetName(textBox.GetText());

                    }
                    else if (fileMode ==5)
                    {
                        SaveFileSystem.SaveObjectToFile(new World(objects.ToArray()), "Levels" + Path.DirectorySeparatorChar + textBox.GetText() + ".taj");

                        fileName = "Levels" + Path.DirectorySeparatorChar  + textBox.GetText() + ".taj";
                        safeFileName = textBox.GetText() + ".taj";
                        finished = true;
                    }

                    textBox.SetText("");
                    fileMode = 0;
                }

                if (animationMode)
                {

                    tool.Update(handler);

                    if (tool.GetDone()) animationMode = false;
                    return;
                }

                if (!modifyingOne)
                    foreach (LevelObject o in objects)
                    {
                        o.Update(handler);
                        o.SetEditing(!hideEditing);

                        if (o.Modifying())
                        {
                            modifying = o;
                            modifyingOne = true;
                            break;
                        }

                        if (!dragging && o.CheckInside(handler))
                        {

                            if (o is LightLevelCircle)
                            {
                                if (handler.CheckPressedKey(Keys.L))
                                {
                                    couldDrag = o;
                                }
                            }
                            else
                                couldDrag = o;
                        }

                    }
                else
                {
                    modifying.Update(handler);
                    if (!modifying.Modifying())
                    {
                        modifying = null;
                        modifyingOne = false;
                    }
                }

                if (handler.CheckJustPressedKey(Keys.H))
                {
                    hideEditing = !hideEditing;
                }

                if (handler.CheckJustPressedKey(Keys.K))
                {
                    cullMode = !cullMode;
                }

                if (handler.CheckJustPressedKey(Keys.F))
                {
                    bringToFront = !bringToFront;
                }

                if (handler.CheckJustPressedKey(Keys.Delete))
                {
                    textBox.TellSelected(true);
                    fileMode = 1;
                }

                if (handler.CheckJustPressedKey(Keys.Insert))
                {
                    textBox.TellSelected(true);
                    fileMode = 2;
                }

                if (handler.CheckJustPressedKey(Keys.Q))
                {
                    if (handler.CheckPressedKey(Keys.L))
                    {
                        LightLevelCircle c = new LightLevelCircle(400, 10, 110);
                        c.SetColor(Color.White);
                        c.SetBorderColor(Color.Black);
                        objects.Add(c);
                    }
                    else
                    {
                        LevelCircle c = new LevelCircle(300, 0, 10);
                        c.SetColor(Color.Red);
                        c.SetBorderColor(Color.Black);
                        objects.Add(c);
                    }
                }

                if (couldDrag != null && !couldDrag.CheckInside(handler))
                {
                    couldDrag = null;
                }

                if (colorize != null)
                {

                    if (handler.CheckJustPressedKey(Keys.C))
                    {
                        colorize = null;
                        r.SetX(-15);
                        r.SetY(-15);
                        g.SetX(-15);
                        g.SetY(-15);
                        b.SetX(-15);
                        b.SetY(-15);
                        originX = originY = -15;
                    }
                }
                else
                {

                    if (handler.CheckJustPressedKey(Keys.A))
                    {

                        if (couldDrag != null && couldDrag is LevelPerson)
                        {
                            tool.Use(couldDrag.GetX(), couldDrag.GetY(), couldDrag.GetWidth(), couldDrag.GetHeight());
                            animationMode = true;
                            return;
                        }

                    }

                    if (handler.CheckPressedKey(Keys.D3) && handler.CheckPressedKey(Keys.D4))
                    {
                        textBox.TellSelected(true);
                        fileMode = 5;
                    }

                    if (handler.CheckJustPressedKey(Keys.O))
                    {
                        if (couldDrag != null && couldDrag is LevelPerson)
                        {
                            ((LevelPerson)couldDrag).MoveTo(couldDrag.GetX() + 200, couldDrag.GetY(), 60);
                        }
                    }

                    if (handler.CheckJustPressedKey(Keys.N))
                    {
                        if (couldDrag != null && couldDrag is LevelPerson)
                        {
                            fileMode = 4;
                            textBox.TellSelected(true);
                        }
                    }
                    if (handler.CheckJustPressedKey(Keys.G))
                    {
                        //Load an animation onto a person.
                        //loop it to test.

                        if (couldDrag != null && couldDrag is LevelPerson)
                        {
                            fileMode = 3;
                            textBox.TellSelected(true);
                        }
                    }

                    if (handler.CheckJustPressedKey(Keys.C))
                        if (!modifyingOne && couldDrag != null && !dragging && colorize == null)
                        {
                            originX = handler.GetMouseX();
                            originY = handler.GetMouseY();

                            r.SetX(originX);
                            g.SetX(originX);
                            b.SetX(originX);

                            r.SetY(originY);
                            g.SetY(originY);
                            b.SetY(originY);
                            colorize = couldDrag;
                        }

                }

                if (handler.CheckLeftMouseJustPressed())
                {
                    if (handler.CheckMouseIn(r))
                    {
                        draggingColor = 1;
                        original = r.GetPoint();
                    }
                    else
                        if (handler.CheckMouseIn(g))
                        {
                            draggingColor = 2;

                            original = g.GetPoint();
                        }
                        else
                            if (handler.CheckMouseIn(b))
                            {
                                draggingColor = 3;

                                original = b.GetPoint();
                            }
                            else
                                if (!modifyingOne && couldDrag != null && !dragging && draggingColor == 0 && colorize == null)
                                {
                                    dragging = true;
                                    original = couldDrag.GetPoint();
                                    dragged = couldDrag;

                                    if (bringToFront)
                                    {
                                        objects.Remove(dragged);
                                        objects.Add(dragged);
                                    }
                                    dragged.SetEditing(!hideEditing);
                                }
                }

                if (handler.CheckRightMouseJustPressed())
                    if (!modifyingOne && couldDrag != null && !dragging)
                    {
                        objects.Remove(couldDrag);
                        couldDrag = null;
                    }

                if (handler.CheckLeftMouseJustReleased())
                {
                    draggingColor = 0;
                    if (dragged != null)
                    {
                        dragged.SetEditing(!hideEditing);
                        dragging = false;
                        dragged = null;
                        couldDrag = null;
                        original = Point.Zero;
                    }
                }

                if (draggingColor != 0 && colorize != null)
                {
                    Point n = handler.GetMouseXY();

                    original = new Point(originX, originY);

                    n -= original;
                    if (n.X >= 130)
                    {
                        n.X = 130;
                    }

                    if (n.Y >= 130)
                    {
                        n.Y = 130;
                    }

                    if (n.Y <= -130)
                    {
                        n.Y = -130;
                    }

                    if (n.X <= -130)
                    {
                        n.X = -130;
                    }

                    if (draggingColor == 1)
                    {
                        //r

                        r.SetPoint(original + n);

                    }
                    else
                        if (draggingColor == 2)
                        {
                            //g
                            g.SetPoint(original + n);
                        }
                        else
                        {
                            //b

                            b.SetPoint(original + n);
                        }

                    int rc = (int)Math.Sqrt((r.GetX() - originX) * (r.GetX() - originX) + (r.GetY() - originY) * (r.GetY() - originY));
                    int gc = (int)Math.Sqrt((g.GetX() - originX) * (g.GetX() - originX) + (g.GetY() - originY) * (g.GetY() - originY));
                    int bc = (int)Math.Sqrt((b.GetX() - originX) * (b.GetX() - originX) + (b.GetY() - originY) * (b.GetY() - originY));

                    colorize.SetColor(new Color(rc, gc, bc));
                }
                else
                    if (dragging)
                    {
                        dragged.SetPoint(original + handler.LeftMouseDraggedBy());
                    }

                if (handler.CheckJustPressedKey(Keys.R))
                {
                    LevelRectangle n = new LevelRectangle(300, 10, 100, 100);
                    n.SetBorderColor(Color.Black);
                    objects.Add(n);
                }

                if (handler.CheckJustPressedKey(Keys.P))
                {
                    LevelRectangle n = new LevelPerson(300, 10, 100, 100, "X");
                    n.SetBorderColor(Color.Black);
                    objects.Add(n);
                }

            } catch(Exception ex)
            {
                Logger.WriteLine(ex.ToString());
                fileMode = 0;
            }
        }
        public void Update(InputHandler inputHandler)
        {
            #region Update Parts
            UpdateMode(inputHandler);
            UpdateElements(inputHandler);
            UpdateScrolling(inputHandler);
            UpdateTextBox(inputHandler);
            UpdateSuggestions(inputHandler);
            #endregion

            if(inputHandler.CheckJustPressedKey(Keys.E) && inputHandler.CheckPressedKey(Keys.D9))
            {
               TajLevelLinker linker = new TajLevelLinker();
               foreach(LooseDragDropLink link in elements)
                {
                    if(link  != null)
                    {
                        if(link.GetElement() is CodeDragDropHolder)
                        {
                            CodeDragDropHolder holder = ((CodeDragDropHolder)link.GetElement());

                            // "Code", "If", "Else", "EndIf", "Start", "Cleared Row", "Cleared Red", "Cleared Blue", "Cleared Teal", "Cleared Purple", "Cleared Orange", "Cleared Yellow", "Cleared Green", "Cleared Any Color"
                            switch(holder.GetMode())
                            {
                            case 4:
                                linker.OnStart(holder.GetCode());
                                break;
                            case 5 :
                                linker.SetRowCleared(holder.GetCode());
                                break;
                            case 6:

                                linker.SetRedCleared(holder.GetCode());
                                break;
                            case 7:

                                linker.SetBlueCleared(holder.GetCode());
                                break;
                            case 8:

                                linker.SetTealCleared(holder.GetCode());
                                break;
                            case 9:
                                linker.SetPurpleCleared(holder.GetCode());
                                break;
                            case 10:

                                linker.SetOrangeCleared(holder.GetCode());
                                break;
                            case 11:

                                linker.SetYellowCleared(holder.GetCode());
                                break;
                            case 12:
                                linker.SetGreenCleared(holder.GetCode());
                                break;
                            case 13:
                                linker.SetAnyCleared(holder.GetCode());
                                break;
                            }

                        }
                    }
                }
               linker.CreateGame(fileName);
               linker.SetFullSave(true);
               SaveFileSystem.SaveObjectToFile(linker, "LevelPacks" + Path.DirectorySeparatorChar + safeFileName);
            }

            /*
            if(inputHandler.CheckJustPressedKey(Keys.Y))
            {

                TempList list = new TempList();
                list.elements = this.elements.ToArray();

                SaveFileSystem.SaveObjectToFile(list, "Haha.taj");
            }
            */
            //Temporary Code
            if(classManager == null && !test)
            {

                suggestions.Add(new LooseDragDropLink(new StringTextbox()));
                suggestions.Add(new LooseDragDropLink(new NumberTextbox()));
                suggestions.Add(new LooseDragDropLink(new BooleanDragDrop()));
                suggestions.Add(new LooseDragDropLink(new NotBooleanMethod()));
                suggestions.Add(new LooseDragDropLink(new BooleanMethod()));
                suggestions.Add(new LooseDragDropLink(new NumberMethodDragDrop()));
                suggestions.Add(new LooseDragDropLink(new NumberMethod()));
                suggestions.Add(new LooseDragDropLink(new StringMethod()));
                suggestions.Add(new LooseDragDropLink(new SetVariableDragDrop()));
                suggestions.Add(new LooseDragDropLink(new GameCommandDragDrop()));
                suggestions.Add(new LooseDragDropLink(new GetVariableDragDrop()));
                suggestions.Add(new LooseDragDropLink(new CodeTextbox()));
                suggestions.Add(new LooseDragDropLink(new CodeDragDropHolder()));

                test = true;
                //Show New Class Button
            }
        }
Ejemplo n.º 5
0
        public void Update(InputHandler handler)
        {
            try
            {
                if (done)
                {
                    done = false;
                    return;
                }

                if (modeB)
                {

                    if(frames == 0)
                    {
                        ff = 0;
                        modeB = false;
                        return;
                    }
                    ff++;
                    ff %= frames;
                    left.LoadFrame(ff);
                    right.LoadFrame(ff);
                    lright.LoadFrame(ff);
                    lleft.LoadFrame(ff);
                }

                DragDropInterface.UpdateTextBox(textBox, handler);
                if (textBox.GetSelected()) return;
                if (fileMode != 0)
                {
                    if (fileMode == 1)
                    {
                        SaveFileSystem.SaveObjectToFile(new BodyAnimation(left, right, lleft, lright, frames), "Animations" + Path.DirectorySeparatorChar + textBox.GetText() + ".taj");
                        textBox.SetText("");

                    }
                    else if (fileMode == 2)
                    {
                        BodyAnimation a = SaveFileSystem.LoadObjectFromFile<BodyAnimation>("Animations" + Path.DirectorySeparatorChar + textBox.GetText() + ".taj", new GameLoader());
                        this.left = a.GetLeft();
                        this.lleft = a.GetLegLeft();
                        this.lright = a.GetLegRight();
                        this.right = a.GetRight();

                        this.frames = a.GetFrames();

                        this.ff = 0;
                        textBox.SetText("");
                    }
                    fileMode = 0;
                }

                left.Update(handler, testingRectangle.GetX(), testingRectangle.GetY() + 20);
                right.Update(handler, testingRectangle.GetX() + testingRectangle.GetWidth(), testingRectangle.GetY() + 20);
                lleft.Update(handler, testingRectangle.GetX() + 20, testingRectangle.GetY() + testingRectangle.GetHeight());
                lright.Update(handler, testingRectangle.GetX() - 20 + testingRectangle.GetWidth(), testingRectangle.GetY() + testingRectangle.GetHeight());

                if (!dragging && handler.CheckJustPressedKey(Keys.M))
                {
                    mode = !mode;
                }

                if (handler.CheckJustPressedKey(Keys.Escape) || handler.CheckJustPressedKey(Keys.A))
                {
                    done = true;
                }

                if (handler.CheckJustPressedKey(Keys.OemSemicolon))
                {
                    if (frames == 0) return;
                    modeB = !modeB;
                }

                if (handler.CheckJustPressedKey(Keys.D1))
                {
                    textBox.TellSelected(true);
                    fileMode = 1;

                }

                if (handler.CheckJustPressedKey(Keys.D2))
                {

                    textBox.TellSelected(true);
                    fileMode = 2;

                }

                if (handler.CheckJustPressedKey(Keys.S))
                {
                    left.SaveArm();
                    right.SaveArm();
                    lright.SaveArm();
                    lleft.SaveArm();
                    frames++;
                    ff++;
                }

                if (handler.CheckJustPressedKey(Keys.D))
                {
                    left.Clear(ff);
                    right.Clear(ff);
                    lright.Clear(ff);
                    lleft.Clear(ff);
                    frames = ff;

                }

                if (handler.CheckJustPressedKey(Keys.C))
                {
                    if (frames == 0) return;
                    if (left.Using())
                    {
                        left.SaveAt(ff, true);
                    }

                    if (right.Using())
                    {
                        right.SaveAt(ff, true);
                    }
                    if (lleft.Using())
                    {
                        lleft.SaveAt(ff, true);
                    }
                    if (lright.Using())
                    {
                        lright.SaveAt(ff, true);
                    }

                    ff++;

                    ff %= frames;
                    left.LoadFrame(ff);
                    right.LoadFrame(ff);
                    lright.LoadFrame(ff);
                    lleft.LoadFrame(ff);
                }

                if (handler.CheckJustPressedKey(Keys.V))
                {
                    if (frames == 0) return;

                    if (left.Using())
                    {
                        left.SaveAt(ff, false);
                    }

                    if (right.Using())
                    {
                        right.SaveAt(ff, false);
                    }
                    if (lleft.Using())
                    {
                        lleft.SaveAt(ff, false);
                    }
                    if (lright.Using())
                    {
                        lright.SaveAt(ff, false);
                    }

                    ff++;

                    ff %= frames;
                    left.LoadFrame(ff);
                    right.LoadFrame(ff);
                    lright.LoadFrame(ff);
                    lleft.LoadFrame(ff);
                }

                if (handler.CheckJustPressedKey(Keys.B))
                {
                    dragBody = !dragBody;
                }

                if (handler.CheckJustPressedKey(Keys.Z))
                {
                    squareOrCircle = !squareOrCircle;
                }

                if (handler.CheckJustPressedKey(Keys.OemPlus))
                {
                    ff++;
                    ff %= frames;
                    left.LoadFrame(ff);
                    right.LoadFrame(ff);
                    lright.LoadFrame(ff);
                    lleft.LoadFrame(ff);

                }

                if (handler.CheckJustPressedKey(Keys.OemMinus))
                {
                    ff--;
                    if (ff < 0) ff = 0;
                    left.LoadFrame(ff);
                    right.LoadFrame(ff);
                    lright.LoadFrame(ff);
                    lleft.LoadFrame(ff);
                }

                if (handler.CheckPressedKey(Keys.LeftShift) || handler.CheckPressedKey(Keys.RightShift))
                {
                    if (handler.CheckPressedKey(Keys.Down))
                    {
                        testingRectangle.ModifyHeight(SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Up))
                    {
                        testingRectangle.ModifyHeight(-SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Left))
                    {
                        testingRectangle.ModifyWidth(-SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Right))
                    {
                        testingRectangle.ModifyWidth(SPEED);
                    }
                }
                else
                {
                    if (handler.CheckPressedKey(Keys.Down))
                    {
                        testingRectangle.ModifyY(SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Up))
                    {
                        testingRectangle.ModifyY(-SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Left))
                    {
                        testingRectangle.ModifyX(-SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Right))
                    {
                        testingRectangle.ModifyX(SPEED);
                    }
                }

                #region Check if the mouse is in the body.
                if (dragBody)
                    if (handler.CheckMouseIn(testingRectangle))
                    {

                        if (handler.CheckLeftMousePressed())
                        {
                            if (!dragging && handler.LeftMouseDraggedBy().X == 0 && handler.LeftMouseDraggedBy().Y == 0)
                            {
                                this.originalPoint = testingRectangle.GetPoint();
                                if (mode) this.originalPoint = testingRectangle.GetSize();
                                dragging = true;
                            }

                        }
                        else
                        {
                            color = Color.Red;
                            dragging = false;
                        }

                    }
                    else
                    {
                        color = Color.DarkGray;
                    }

                if (dragging)
                {
                    color = Color.DarkRed;
                    Point fix = originalPoint + handler.LeftMouseDraggedBy();
                    if (mode)
                    {
                        testingRectangle.SetSize(ref fix);

                    }
                    else
                    {

                        testingRectangle.SetPoint(ref fix);
                    }
                }

                #endregion

                blink++;
            } catch (Exception ex)
            {
                Logger.WriteLine(ex.ToString());
                fileMode = 0;
            }
        }