Esempio n. 1
0
 public override void Dispose()
 {
     ok.Dispose();
     text.Dispose();
     ok = null;
     text = null;
     base.Dispose();
 }
        public override void Initialize()
        {
            if (arrowDown == null)
            {
                LoadTextures();
            }

            WasInitialized = true;

            size = new Vector2(192, 145);

            title = new Label(0, 5, AssociatedComponent.Graphics.GetCSToolTip());
            title.font = TitleFont;
            title.UpdateSizeToTextSize();
            title.TextAlignment = Renderer.TextAlignment.Center;
            title.foreground = Color.White;
            controls.Add(title);

            Size = new Vector2(Math.Max(title.font.MeasureString(title.text).X + 80, Size.X), Size.Y);

            title.Size = new Vector2(Size.X - 20, title.Size.Y);

            removable = new CheckBox(5, 55, (int)size.X - 10, 20, "Removable: ", false);
            removable.foreground = Color.White;
            removable.onCheckedChanged += new CheckBox.CheckBoxCheckedHandler(removable_onCheckedChanged);
            controls.Add(removable);

            Label l = new Label(5, 80, "Ports:");
            l.foreground = Color.White;
            controls.Add(l);

            center = new MenuButton((int)(size.X - 20) / 2, 100, 20, 20, "");
            center.LeftTexture = ResourceManager.Load<Texture2D>("Components/Icons/AdvancedJoint");
            center.isEnabled = false;
            center.StretchLeftTextureToSize = true;
            center.disabledColor = Color.White;
            controls.Add(center);

            left = new MenuButton((int)center.Position.X - 20, 100, 20, 20, "");
            left.onClicked += new Button.ClickedEventHandler(left_onClicked);
            controls.Add(left);

            up = new MenuButton((int)center.Position.X, 80, 20, 20, "");
            up.onClicked += new Button.ClickedEventHandler(up_onClicked);
            controls.Add(up);

            right = new MenuButton((int)center.Position.X + 20, 100, 20, 20, "");
            right.onClicked += new Button.ClickedEventHandler(right_onClicked);
            controls.Add(right);

            down = new MenuButton((int)center.Position.X, 120, 20, 20, "");
            down.onClicked += new Button.ClickedEventHandler(down_onClicked);
            controls.Add(down);

            base.Initialize();
        }
Esempio n. 3
0
        public override void Initialize()
        {
            Layer = 550;
            ShouldBeScaled = false;

            close = new MenuButton((Main.WindowWidth - 602) / 2 + 555, (Main.WindowHeight - 317) / 2, 41, 17, "x");
            close.foreground = Color.White;
            close.background = Shortcuts.BG_COLOR;
            close.TextOffset = new Vector2(6, 3);
            close.MoveOnMouseOver = false;
            close.onClicked += new MicroWorld.Graphics.GUI.Elements.Button.ClickedEventHandler(close_onClicked);
            controls.Add(close);

            base.Initialize();
        }
Esempio n. 4
0
        public override void Initialize()
        {
            Layer          = 550;
            ShouldBeScaled = false;

            close                 = new MenuButton((Main.WindowWidth - 602) / 2 + 555, (Main.WindowHeight - 338) / 2, 41, 17, "x");
            close.foreground      = Color.White;
            close.background      = Shortcuts.BG_COLOR;
            close.TextOffset      = new Vector2(6, 3);
            close.MoveOnMouseOver = false;
            close.onClicked      += new Button.ClickedEventHandler(close_onClicked);
            controls.Add(close);

            base.Initialize();
        }
Esempio n. 5
0
        private OKMessageBox(String txt)
        {
            text = new Label(0, 0, txt);
            text.TextAlignment = Graphics.Renderer.TextAlignment.Center;
            text.foreground = Color.White;
            position = new Vector2((Main.graphics.PreferredBackBufferWidth - text.size.X) / 2 - 5,
                (Main.graphics.PreferredBackBufferHeight - size.Y) / 2 - 15);
            size = new Vector2(text.size.X + 10, text.size.Y + 30);
            text.position = position + new Vector2(5, 5);
            ok = new MenuButton((int)position.X, (int)(position.Y + size.Y) - 20, (int)(size.X), 20, "OK");
            ok.Font = MenuFrameScene.ButtonFont;
            ok.TextOffset = new Vector2(5, 2);
            ok.onClicked += new Button.ClickedEventHandler(okClick);

            controls.Add(ok);
            controls.Add(text);
        }
Esempio n. 6
0
        public override void Initialize()
        {
            Layer = 100100;

            bok = new MenuButton(Main.windowWidth / 2 - 200, Main.windowHeight * 2 / 3, 120, 30, "OK");
            bok.onClicked += new Button.ClickedEventHandler(bok_onClicked);
            controls.Add(bok);

            breset = new MenuButton(Main.windowWidth / 2 - 60, Main.windowHeight * 2 / 3, 120, 30, "Reset");
            breset.onClicked += new Button.ClickedEventHandler(breset_onClicked);
            controls.Add(breset);

            bcancel = new MenuButton(Main.windowWidth / 2 + 80, Main.windowHeight * 2 / 3, 120, 30, "Cancel");
            bcancel.onClicked += new Button.ClickedEventHandler(bcancel_onClicked);
            controls.Add(bcancel);

            base.Initialize();
        }
Esempio n. 7
0
        public HotkeyControl(int x, int y, int buttonOffset, String txt, IO.InputSequence key)
        {
            this.buttonOffset = buttonOffset;
            this.key = key;

            b_Key = new MenuButton(x + buttonOffset, y + 2, 240, 16, key.ToString());
            b_Key.Text = key.ToString(GUIEngine.font, (int)b_Key.size.X, false);
            b_Key.Font = GUIEngine.font;
            b_Key.TextOffset = new Vector2(0, 4);
            b_Key.DrawBottomLine = false;
            b_Key.onClicked += new Button.ClickedEventHandler(b_Key_onClicked);

            b_Text = new Label(x + 2, y - 1, txt);
            b_Text.foreground = Color.White;

            position = new Vector2(x, y);
            Size = new Vector2(buttonOffset + 240, 20);

            Key = key;
        }
Esempio n. 8
0
 private YesNoMessageBox(String txt)
 {
     text = new Label(0, 0, txt);
     text.TextAlignment = Graphics.Renderer.TextAlignment.Center;
     text.foreground = Color.White;
     position = new Vector2((Main.graphics.PreferredBackBufferWidth - text.size.X) / 2 - 5,
         (Main.graphics.PreferredBackBufferHeight - size.Y) / 2 - 15);
     size = new Vector2(text.size.X + 10, text.size.Y + 30);
     text.position = position + new Vector2(5, 5);
     no = new MenuButton((int)position.X, (int)(position.Y + size.Y) - 23, (int)(size.X / 2), 23, "No");
     yes = new MenuButton((int)(position.X + size.X / 2), (int)(position.Y + size.Y) - 23, (int)(size.X / 2), 23, "Yes");
     yes.onClicked += new Button.ClickedEventHandler(yesClick);
     no.onClicked += new Button.ClickedEventHandler(noClick);
     yes.Font = MenuFrameScene.ButtonFont;
     no.Font = MenuFrameScene.ButtonFont;
     yes.TextOffset = new Vector2(5, 2);
     no.TextOffset = yes.TextOffset;
     no.Initialize();
     yes.Initialize();
 }
Esempio n. 9
0
        public HotkeyControl(int x, int y, int buttonOffset, String txt, IO.InputSequence key)
        {
            this.buttonOffset = buttonOffset;
            this.key          = key;

            b_Key                = new MenuButton(x + buttonOffset, y + 2, 240, 16, key.ToString());
            b_Key.Text           = key.ToString(GUIEngine.font, (int)b_Key.size.X, false);
            b_Key.Font           = GUIEngine.font;
            b_Key.TextOffset     = new Vector2(0, 4);
            b_Key.DrawBottomLine = false;
            b_Key.onClicked     += new Button.ClickedEventHandler(b_Key_onClicked);

            b_Text            = new Label(x + 2, y - 1, txt);
            b_Text.foreground = Color.White;

            position = new Vector2(x, y);
            Size     = new Vector2(buttonOffset + 240, 20);

            Key = key;
        }
Esempio n. 10
0
        public override void Initialize()
        {
            if (t_leftUp == null)
            {
                LoadTextures();
            }

            WasInitialized = true;

            size = new Vector2(155, 172);

            title = new Label(0, 5, AssociatedComponent.Graphics.GetCSToolTip());
            title.font = TitleFont;
            title.UpdateSizeToTextSize();
            title.TextAlignment = Renderer.TextAlignment.Center;
            title.foreground = Color.White;
            controls.Add(title);

            Size = new Vector2(Math.Max(title.font.MeasureString(title.text).X + 80, Size.X), Size.Y);

            title.Size = new Vector2(Size.X - 20, title.Size.Y);

            removable = new CheckBox(5, 55, (int)size.X - 10, 20, "Removable: ", false);
            removable.foreground = Color.White;
            removable.onCheckedChanged += new CheckBox.CheckBoxCheckedHandler(removable_onCheckedChanged);
            controls.Add(removable);

            leftUp = new MenuButton(5, 80, 20, 20, "");
            leftUp.onClicked += new Button.ClickedEventHandler(leftUp_onClicked);
            leftUp.LeftTexture = t_leftUp;
            controls.Add(leftUp);

            leftRight = new MenuButton(30, 80, 20, 20, "");
            leftRight.onClicked += new Button.ClickedEventHandler(leftRight_onClicked);
            leftRight.LeftTexture = t_leftRight;
            controls.Add(leftRight);

            leftDown = new MenuButton(55, 80, 20, 20, "");
            leftDown.onClicked += new Button.ClickedEventHandler(leftDown_onClicked);
            leftDown.LeftTexture = t_leftDown;
            controls.Add(leftDown);

            upRight = new MenuButton(80, 80, 20, 20, "");
            upRight.onClicked += new Button.ClickedEventHandler(upRight_onClicked);
            upRight.LeftTexture = t_upRight;
            controls.Add(upRight);

            upDown = new MenuButton(105, 80, 20, 20, "");
            upDown.onClicked += new Button.ClickedEventHandler(upDown_onClicked);
            upDown.LeftTexture = t_upDown;
            controls.Add(upDown);

            rightDown = new MenuButton(130, 80, 20, 20, "");
            rightDown.onClicked += new Button.ClickedEventHandler(rightDown_onClicked);
            rightDown.LeftTexture = t_rightDown;
            controls.Add(rightDown);

            portLeft = new ToggleButton((int)size.X / 2 - 30, 125, 20, 20);
            portLeft.Add(arrowLeftRight, "IO");
            portLeft.Add(arrowLeft, "O");
            portLeft.Add(arrowRight, "I");
            portLeft.onSelectedChanged += new ToggleButton.SelectedChanged(portLeft_onSelectedChanged);
            controls.Add(portLeft);

            portRight = new ToggleButton((int)size.X / 2 + 10, 125, 20, 20);
            portRight.Add(arrowLeftRight, "IO");
            portRight.Add(arrowRight, "O");
            portRight.Add(arrowLeft, "I");
            portRight.onSelectedChanged += new ToggleButton.SelectedChanged(portRight_onSelectedChanged);
            controls.Add(portRight);

            portUp = new ToggleButton((int)size.X / 2 - 10, 105, 20, 20);
            portUp.Add(arrowUpDown, "IO");
            portUp.Add(arrowUp, "O");
            portUp.Add(arrowDown, "I");
            portUp.onSelectedChanged += new ToggleButton.SelectedChanged(portUp_onSelectedChanged);
            controls.Add(portUp);

            portDown = new ToggleButton((int)size.X / 2 - 10, 145, 20, 20);
            portDown.Add(arrowUpDown, "IO");
            portDown.Add(arrowDown, "O");
            portDown.Add(arrowUp, "I");
            portDown.onSelectedChanged += new ToggleButton.SelectedChanged(portDown_onSelectedChanged);
            controls.Add(portDown);

            base.Initialize();
        }
Esempio n. 11
0
 public override void Dispose()
 {
     no.Dispose();
     yes.Dispose();
     text.Dispose();
     no = null;
     yes = null;
     text = null;
     base.Dispose();
 }
Esempio n. 12
0
        public override void Initialize()
        {
            font = ResourceManager.Load<SpriteFont>("Fonts/LiberationSans_18");

            Layer = 5000;
            ShouldBeScaled = false;

            size = new Vector2(Main.WindowWidth / 4, Main.WindowHeight / 4);
            size = new Vector2(602, 338);
            position = new Vector2((Main.WindowWidth - size.X) / 2, (Main.WindowHeight - size.Y) / 2);

            menu = new MenuButton((int)position.X, (int)(position.Y + size.Y - size.Y / 3),
                (int)(size.X / 4), 30, "Menu");
            menu.Font = font;
            menu.TextOffset = new Vector2(0, 3);
            menu.onClicked += new Button.ClickedEventHandler(menu_onClicked);
            controls.Add(menu);

            replay = new MenuButton((int)(position.X + size.X / 4), (int)(position.Y + size.Y - size.Y / 3),
                (int)(size.X / 4), 30, "Replay");
            replay.Font = font;
            replay.TextOffset = menu.TextOffset;
            replay.onClicked += new Button.ClickedEventHandler(replay_onClicked);
            controls.Add(replay);

            stay = new MenuButton((int)(position.X + 2 * size.X / 4), (int)(position.Y + size.Y - size.Y / 3),
                (int)(size.X / 4), 30, "Stay");
            stay.Font = font;
            stay.TextOffset = menu.TextOffset;
            stay.onClicked += new Button.ClickedEventHandler(stay_onClicked);
            controls.Add(stay);

            next = new MenuButton((int)(position.X + 3 * size.X / 4), (int)(position.Y + size.Y - size.Y / 3),
                (int)(size.X / 4), 30, "Next");
            next.Font = font;
            next.TextOffset = menu.TextOffset;
            next.onClicked += new Button.ClickedEventHandler(next_onClicked);
            controls.Add(next);

            time = new Label((int)position.X + 5, (int)position.Y + 5,      "Time:                     ");
            time.foreground = Color.White;
            controls.Add(time);

            elements = new Label((int)position.X + 5, (int)position.Y + 35, "Components placed:        ");
            elements.foreground = Color.White;
            controls.Add(elements);

            base.Initialize();
        }
Esempio n. 13
0
        public override void Initialize()
        {
            if (this.GetType() == typeof(GeneralProperties))
            {
                Label title;
                CheckBox removable;

                WasInitialized = true;

                size = new Vector2(120, 80);

                title = new Label(0, 5, AssociatedComponent.Graphics.GetCSToolTip());
                title.font = TitleFont;
                title.UpdateSizeToTextSize();
                title.TextAlignment = Renderer.TextAlignment.Center;
                title.foreground = Color.White;
                controls.Add(title);

                size.X = Math.Max(title.font.MeasureString(title.text).X + 80, size.X);

                title.size.X = size.X - 20;

                removable = new CheckBox(5, 55, (int)size.X - 10, 20, "Removable: ", false);
                removable.foreground = Color.White;
                removable.onCheckedChanged += new CheckBox.CheckBoxCheckedHandler(removable_onCheckedChanged);
                controls.Add(removable);
            }

            Label l = new Label(5, 30, "ID:");
            l.foreground = Color.White;
            controls.Add(l);

            ID = new Label(5, 30, "0");
            ID.foreground = Color.White;
            ID.TextAlignment = Renderer.TextAlignment.Right;
            controls.Add(ID);

            remove = new MenuButton(5, 5, 20, 20, "");
            remove.LeftTexture = ResourceManager.Load<Texture2D>("GUI/HUD/Properties/Remove");
            remove.onClicked += new Button.ClickedEventHandler(remove_onClicked);
            controls.Add(remove);

            close = new MenuButton((int)size.X - 25, 5, 20, 20, "");
            close.LeftTexture = ResourceManager.Load<Texture2D>("GUI/HUD/Properties/Close");
            close.onClicked += new Button.ClickedEventHandler(close_onClicked);
            controls.Add(close);

            help = new MenuButton((int)size.X - 45, 5, 20, 20, "");
            help.LeftTexture = ResourceManager.Load<Texture2D>("GUI/HUD/Properties/Help");
            help.onClicked += new Button.ClickedEventHandler(help_onClicked);
            controls.Add(help);

            base.Initialize();

            ReCreateFBO();
        }