Пример #1
0
        public void CreateGUI()
        {
            if (gui != null)
            {
                gui.RemoveAllWidgets();
            }

            var listColors = new ListBox()
            {
                Position = new Vector2f(Utils.WIDTH * 41 / 50, Utils.HEIGHT * 1 / 7),
                Size     = new Vector2f(Utils.WIDTH * 8 / 50, Utils.HEIGHT * 1 / 4),
                TextSize = (uint)(0.25 * Utils.HEIGHT / 10)
            };

            foreach (KeyValuePair <string, string> color in Utils.COLORS)
            {
                listColors.AddItem(color.Key.ToString());
            }
            gui.Add(listColors);

            listColors.ItemSelected += (s, e) => SwitchColor(in listColors);

            var buttonNew = new Button("New")
            {
                Position = new Vector2f(Utils.WIDTH * 41 / 50, Utils.HEIGHT * 4 / 7),
                Size     = new Vector2f(Utils.WIDTH * 8 / 50, Utils.HEIGHT / 10),
                TextSize = (uint)(0.5 * Utils.HEIGHT / 10)
            };

            gui.Add(buttonNew);

            buttonNew.Pressed += (s, e) => NewPaint();

            var buttonOutput = new Button("Output")
            {
                Position = new Vector2f(Utils.WIDTH * 41 / 50, Utils.HEIGHT * 5 / 7),
                Size     = new Vector2f(Utils.WIDTH * 8 / 50, Utils.HEIGHT / 10),
                TextSize = (uint)(0.5 * Utils.HEIGHT / 10)
            };

            gui.Add(buttonOutput);

            buttonOutput.Pressed += (s, e) => OutputPaint();

            var buttonQuit = new Button("Exit")
            {
                Position = new Vector2f(Utils.WIDTH * 41 / 50, Utils.HEIGHT * 6 / 7),
                Size     = new Vector2f(Utils.WIDTH * 8 / 50, Utils.HEIGHT / 10),
                TextSize = (uint)(0.5 * Utils.HEIGHT / 10)
            };

            gui.Add(buttonQuit);

            buttonQuit.Pressed += (s, e) => CloseWindow();
        }
Пример #2
0
        public static Gui CreateMainMenuInterface(ref AnoleEngine.Engine_Base.Engine objEngineInstance, GalaxyViewState state)
        {
            float fltGameWindowWidth  = objEngineInstance.GameWindow.Size.X;
            float fltGameWindowHeight = objEngineInstance.GameWindow.Size.Y;

            Gui UI = new Gui(objEngineInstance.GameWindow);

            Panel objGalaxyMenuLayout = new Panel();

            objGalaxyMenuLayout.SetRenderer(UI_Renderers.UIGalaxyMenuLayoutRenderer.Data);
            objGalaxyMenuLayout.Size = new Vector2f(fltGameWindowWidth, fltGameWindowHeight / 7);
            objGalaxyMenuLayout.ShowWithEffect(ShowAnimationType.SlideFromBottom, Time.FromMilliseconds(800));
            objGalaxyMenuLayout.Position = new Vector2f((fltGameWindowWidth / 2) - (objGalaxyMenuLayout.Size.X / 2), fltGameWindowHeight - objGalaxyMenuLayout.Size.Y);


            Button closeButton = new Button("CLOSE");

            closeButton.Size     = new Vector2f(50f, 45);
            closeButton.Position = new Vector2f(objGalaxyMenuLayout.Size.X - 60, 5);
            closeButton.SetRenderer(UI_Renderers.UIGalaxyViewButtonRenderer.Data);
            closeButton.Clicked += new EventHandler <SignalArgsVector2f>(state.KillStateEvent);
            objGalaxyMenuLayout.Add(closeButton, "closeButton");

            UI.Add(objGalaxyMenuLayout, "GalaxyLayout");
            return(UI);
        }
Пример #3
0
        static void Main(string[] args)
        {
            SFML.Portable.Activate();

            var win = new RenderWindow(VideoMode.DesktopMode, "Test SFML");

            win.Size = new Vector2u(600, 400);
            Gui gui = new Gui(win);

            EditBox editBoxUsername = new EditBox();

            editBoxUsername.Position    = new Vector2f(600 / 6, 400 / 6);
            editBoxUsername.Size        = new Vector2f(600 * 2 / 3, 400 / 8);
            editBoxUsername.DefaultText = "Username";
            gui.Add(editBoxUsername);

            while (win.IsOpen)
            {
                win.DispatchEvents();
                win.Clear(Color.Blue);
                gui.Draw();
                win.Display();
            }

            win.Close();
            win.Dispose();

            Console.WriteLine("Hello World!");
        }
Пример #4
0
        public override void Setup(Gui gui)
        {
            var window = new Window("Model Meshes")
            {
                new Size(400, 400),
                new Button(() => Globals.Stopwatch.IsRunning ? "Pause" : "Unpause")
                {
                    _ => {
                        if (Globals.Stopwatch.IsRunning)
                        {
                            Globals.Stopwatch.Stop();
                        }
                        else
                        {
                            Globals.Stopwatch.Start();
                        }
                    }
                }
            };

            Controller.LastModelLoaded.Meshes.ForEach(mesh =>
                                                      window.Add(new Checkbox(mesh.Material.ToString(), true)
            {
                x => mesh.Enabled = x.Checked
            }));
            gui.Add(window);
        }
Пример #5
0
        static void Main(string[] args)
        {
            const uint width  = 400;
            const uint height = 300;

            var window = new RenderWindow(new VideoMode(width, height), "TGUI.Net example");
            var gui    = new Gui(window);

            window.Closed += (s, e) => window.Close();

            var picture = new Picture("background.jpg");

            picture.Size = new Vector2f(width, height);
            gui.Add(picture);

            var editBoxUsername = new EditBox();

            editBoxUsername.Position    = new Vector2f(width / 6, height / 6);
            editBoxUsername.Size        = new Vector2f(width * 2 / 3, height / 8);
            editBoxUsername.DefaultText = "Username";
            gui.Add(editBoxUsername);

            var editBoxPassword = new EditBox(editBoxUsername);

            editBoxPassword.Position          = new Vector2f(width / 6, height * 5 / 12);
            editBoxPassword.PasswordCharacter = '*';
            editBoxPassword.DefaultText       = "Password";
            gui.Add(editBoxPassword);

            var button = new Button("Login");

            button.Position = new Vector2f(width / 4, height * 7 / 10);
            button.Size     = new Vector2f(width / 2, height / 6);
            gui.Add(button);

            button.Pressed += (s, e) => Console.WriteLine("Username: "******"\n"
                                                          + "Password: " + editBoxPassword.Text);

            while (window.IsOpen)
            {
                window.DispatchEvents();

                window.Clear();
                gui.Draw();
                window.Display();
            }
        }
Пример #6
0
 public override void Setup(Gui gui)
 {
     gui.Add(new Window("Status")
     {
         new Size(500, 100),
         new Text(() => $"Position {Globals.Camera.Position}"),
         new Text(() => $"FPS {Controller.Engine.FPS}")
     });
 }
Пример #7
0
        public static Gui CreateMainMenuInterface(ref AnoleEngine.Engine_Base.Engine objEngineInstance, MainMenuState state)
        {
            float fltGameWindowWidth  = objEngineInstance.GameWindow.Size.X;
            float fltGameWindowHeight = objEngineInstance.GameWindow.Size.Y;

            Gui UI = new Gui(objEngineInstance.GameWindow);

            Button closeButton = new Button("CLOSE");

            closeButton.Size = new Vector2f(200, 50);
            float fltXPos = (fltGameWindowWidth / 2) - 100;
            float fltYPos = (fltGameWindowHeight / 2) - 25;

            closeButton.Position = new Vector2f(fltXPos, fltYPos);
            closeButton.SetRenderer(UI_Renderers.UIBackButtonRenderer.Data);
            UI.Add(closeButton, "closeButton");

            Button objSettingsButton = new Button("SETTINGS");

            objSettingsButton.Size = new Vector2f(200, 50);
            float fltSettingsXPos = ((fltGameWindowWidth / 2) - 100);
            float fltSettingsYPos = ((fltGameWindowHeight / 2) - 75) - UI_Constants.ControlSpacer;

            objSettingsButton.Position = new Vector2f(fltSettingsXPos, fltSettingsYPos);
            objSettingsButton.SetRenderer(UI_Renderers.UIButtonRenderer.Data);
            UI.Add(objSettingsButton, "Settings");

            Button newGameButton = new Button("NEW SOLO GAME");

            newGameButton.Size = new Vector2f(200, 50);
            float fltNewGameXPos = ((fltGameWindowWidth / 2) - 100);
            float fltNewGameYPos = ((fltGameWindowHeight / 2) - 125) - (UI_Constants.ControlDoubleSpacer);

            newGameButton.Position = new Vector2f(fltNewGameXPos, fltNewGameYPos);
            newGameButton.SetRenderer(UI_Renderers.UIButtonRenderer.Data);
            UI.Add(newGameButton, "NewGameButton");

            ((Button)UI.Get("NewGameButton")).Clicked += new EventHandler <SignalArgsVector2f>(state.CreateNewGameEvent);
            ((Button)UI.Get("Settings")).Clicked      += new EventHandler <SignalArgsVector2f>(state.SettingsEvent);
            ((Button)UI.Get("closeButton")).Clicked   += new EventHandler <SignalArgsVector2f>(state.ExitGameEvent);

            return(UI);
        }
Пример #8
0
        protected WndBase(T obj1, int larg, Vector2f p)
            : base("", larg)
        {
            if (!(obj1 is BaseObject obj))
            {
                throw new InvalidConstraintException(nameof(obj1));
            }

            Object = obj1;
            Title  = obj.Name ?? L[obj.GetType().Name] ?? "";
            PropertyWindows[obj].Add(this);
            Gui.Add(this);
            StartPosition = Position = p;
            Closed       += delegate { PropertyWindows[obj].Remove(this); };
        }
Пример #9
0
        public override void Load()
        {
            _ui = new Gui()
            {
                DebugMode = false
            };

            var container = new Container("container", _ui.Width, _ui.Height);

            var button = new Button("button", "BUTTON1\nSUBTEXT");

            var button2 = new Button("button2", "BUTTON2");

            container.Add(button);
            container.Add(button2);

            container.Layout(Orientation.Vertical, ContainerAlignment.Center, ContainerAlignment.Center, 10, 10);

            _ui.Add(container);
        }
Пример #10
0
        static void Main(string[] args)
        {
            ///窗体初始化
            var adps = GalEngine.Runtime.Graphics.GpuAdapter.EnumerateGraphicsAdapter();

            GameSystems.Initialize(new GameStartInfo()
            {
                Name   = "CAG",
                Window = new WindowInfo()
                {
                    Icon = "",
                    Name = "打牌吧!歌姬",
                    Size = new Size(totalWidth, totalHeight)
                },
                Adapter = adps[1]//使用GTX 1050跑
            });
            //-------------------------------------------------------

            //------------启动---------
            Gui.Add(AllSceneToTakeIn.ClientWindow);
            GameSystems.RunLoop();
        }
Пример #11
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Optional: Sets custom Mouse cursor. (Software)
            // Mouse.SetTextures(Content.Load<Texture2D>("NORMAL"), Content.Load<Texture2D>("PRESSED"));

            // Loads resources used by the GUI elements. Uses Program.Game.Content field.
            Gui.Load();

            // Adds elements to the GUI. This adds an element that showcases all IPressable events and another that deletes it.
            Gui.Add(
                new Pressable("test")
                .SetOnFocusListener((s, e) => { Console.WriteLine("Focus");        return(true); })
                .SetOnHoverListener((s, e) => { Console.WriteLine("Hover");        return(true); })
                .SetOnMoveListener((s, e) => { Console.WriteLine("Move");         return(true); })
                .SetOnPressListener((s, e) => { Console.WriteLine("Press");        return(true); })
                .SetOnRawPressListener((s, e) => { Console.WriteLine("RawPress");     return(true); })
                .SetOnRawReleaseListener((s, e) => { Console.WriteLine("RawRelease");   return(true); })
                .SetOnReleaseListener((s, e) => { Console.WriteLine("Release");      return(true); })
                .SetOnUnfocusListener((s, e) => { Console.WriteLine("Unfocus");      return(true); })
                .SetOnUnhoverListener((s, e) => { Console.WriteLine("Unhover");      return(true); })
                .SetBounds(0, 0, 100, 100),

                new Pressable("deleter")
                .SetOnPressListener((s, e) => {
                Gui.Get <IElement>("test").Delete();
                // Or: Gui.Remove("test", "test2", "test3", ...);
                // Or: Gui.RemoveAll(el => el.GetId() == "test");
                // Or: Gui.Clear(); to delete every element.
                return(true);
            })
                .SetBounds(0, 100, 100, 100)
                );

            // GUI is by default hidden. Use Gui.Show() and Gui.Hide() to manipulate it's visibility.
            // P.S: GUI's visibility does not affect elements' visibilities. Simply nothing is drawn when GUI is hidden.
            Gui.Show();
        }
Пример #12
0
        private static void LoadClientWindow()
        {
            //联网与大厅场景
            ClientWindow ClientWindow = new ClientWindow("ClientWindow");

            AllSceneToTakeIn.ClientWindow = ClientWindow;
            //----------------------------------

            var        steam      = MusicAndSounds.PreStar;
            var        steam1     = MusicAndSounds.Huolang;
            AudioQueue audioQueue = new AudioQueue();

            audioQueue.Add(steam, 0, steam.Length);
            AudioSource audioSource = new AudioSource(steam.WaveFormat);

            audioSource.SubmitAudioQueue(audioQueue);
            audioSource.Start();

            MyGuiButton ChangeButton = new MyGuiButton("切换场景", 30, new Size(200, 100));

            ChangeButton.Image = Image.Load(".\\pic\\rectbutton_null.png");
            //ChangeButton.Dragable = true;

            EasyTranform.Offset(ChangeButton.Transform, new Point2f(0, 0));
            ChangeButton.AddEvent_InsideMouseLeftUp(() =>
            {
                Gui.Remove(AllSceneToTakeIn.ClientWindow);
                Gui.Add(AllSceneToTakeIn.MainPlace);
                new EasyAudio(MusicAndSounds.ChangeButtonClick).Start();
                audioSource.Stop();
                audioQueue.Remove(0);
                audioQueue.Add(steam1, 0, steam1.Length);
                audioSource.SubmitAudioQueue(audioQueue);
                audioSource.Start();
            });
            ClientWindow.AddElement(ChangeButton);



            MyGuiButton button1 = new MyGuiButton(".", 15, new Size(200, 100))
            {
                Image = Image.Load(".\\pic\\rectbutton_null.png"),
            };

            EasyTranform.Offset(button1.Transform, new Point2f(400, 0));
            button1.AddEvent_InsideMouseLeftUp(() =>
            {
                new EasyAudio(MusicAndSounds.NormalButtonClick).Start();
            });

            ClientWindow.AddElement(button1);

            //button1.Dragable = true;
            //MyGuiButton button2 = new MyGuiButton(".",15, new Size(200, 100));
            //button2.Image = Image.Load(".\\pic\\rectbutton_null.png");
            //button2.Dragable = true;
            //MyGuiButton button3 = new MyGuiButton(".", 15, new Size(200, 100));
            //button3.Image = Image.Load(".\\pic\\rectbutton_null.png");
            //button3.Dragable = true;
            //MyGuiButton button4 = new MyGuiButton(".", 15, new Size(200, 100));
            //button4.Image = Image.Load(".\\pic\\rectbutton_null.png");
            //button4.Dragable = true;
            //MyGuiButton button5 = new MyGuiButton(".", 15, new Size(200, 100));
            //button5.Image = Image.Load(".\\pic\\rectbutton_null.png");
            //button5.Dragable = true;

            //ClientWindow.AddElement(button1);
            //ClientWindow.AddElement(button2);
            //ClientWindow.AddElement(button3);
            //ClientWindow.AddElement(button4);
            //ClientWindow.AddElement(button5);
        }
Пример #13
0
        private static void LoadMainPlace()
        {
            //决斗盘加载
            MainPlace mainPlace = new MainPlace("MainPlace");

            MainPlace = mainPlace;



            MainPlaceInfo mainPlaceInfo = new MainPlaceInfo(mainPlace);

            Player thisPlayer = mainPlaceInfo.Player1;
            Player OpPlayer   = mainPlaceInfo.Player2;

            thisPlayer.Name = "测试用户";
            OpPlayer.Name   = "测试对手";

            thisPlayer.CardGroup.GetCardGroup(CardGroup.TestCardGroup);



            List <GuiCard>   HandCard     = new List <GuiCard>();
            List <Container> monPlace1    = new List <Container>();
            List <Container> monPlace2    = new List <Container>();
            List <Container> mgcPitPlace1 = new List <Container>();
            List <Container> mgcPitPlace2 = new List <Container>();

            //建议先创建图层的整个列表,新添加的图层将显示在之前图层的前方。
            mainPlace.LayerController.AddNewLayer("Place");    //放置卡牌的场地
            mainPlace.LayerController.AddNewLayer("DuelTool"); //决斗盘的手臂部分
            mainPlace.LayerController.AddNewLayer("HandCard"); //手牌展示区
            mainPlace.LayerController.AddNewLayer("Select");   //被鼠标选中的卡牌会被移到比较上方的图层
            mainPlace.LayerController.AddNewLayer("UI");       //其他UI

            //我方场地怪兽区
            for (int i = 0; i < 5; i++)
            {
                Container container = new Container(new Size(Program.placeWidth * 2 / 16, Program.totalHeight * 4 / 18), mainPlace);
                EasyTranform.Offset(container.Transform,
                                    new Point2f((Program.totalWidth - Program.placeWidth) + Program.placeWidth * 3 / 16 + i * Program.placeWidth * 2 / 16, Program.totalHeight * 8 / 18));

                mainPlace.LayerController.AddElementToLayer(container, "Place");
                monPlace1.Add(container);
            }

            //对方场地怪兽区
            for (int i = 0; i < 5; i++)
            {
                Container container = new Container(new Size(Program.placeWidth * 2 / 16, Program.totalHeight * 4 / 18), mainPlace);
                EasyTranform.Offset(container.Transform,
                                    new Point2f((Program.totalWidth - Program.placeWidth) + Program.placeWidth * 3 / 16 + i * Program.placeWidth * 2 / 16, Program.totalHeight * 4 / 18));
                mainPlace.LayerController.AddElementToLayer(container, "Place");
                monPlace2.Add(container);
            }


            //我方场地魔法陷阱区
            for (int i = 0; i < 5; i++)
            {
                Container container = new Container(new Size(Program.placeWidth * 2 / 16, Program.totalHeight * 4 / 18), mainPlace);
                EasyTranform.Offset(container.Transform,
                                    new Point2f((Program.totalWidth - Program.placeWidth) + Program.placeWidth * 3 / 16 + i * Program.placeWidth * 2 / 16, Program.totalHeight * 12 / 18));
                mgcPitPlace1.Add(container);
                mainPlace.LayerController.AddElementToLayer(mgcPitPlace1[i], "Place");
            }

            //对方场地魔法陷阱区
            for (int i = 0; i < 5; i++)
            {
                Container container = new Container(new Size(Program.placeWidth * 2 / 16, Program.totalHeight * 4 / 18), mainPlace);
                EasyTranform.Offset(container.Transform,
                                    new Point2f((Program.totalWidth - Program.placeWidth) + Program.placeWidth * 3 / 16 + i * Program.placeWidth * 2 / 16, Program.totalHeight * 0 / 18));
                mgcPitPlace2.Add(container);
                mainPlace.LayerController.AddElementToLayer(mgcPitPlace2[i], "Place");
            }

            //我方场地魔法区
            Container placeMpc1 = new Container(new Size(Program.placeWidth * 2 / 16, Program.totalHeight * 4 / 18), mainPlace);

            EasyTranform.Offset(placeMpc1.Transform,
                                new Point2f((Program.totalWidth - Program.placeWidth) + Program.placeWidth * 13 / 16, Program.totalHeight * 10 / 18));
            mainPlace.LayerController.AddElementToLayer(placeMpc1, "Place");

            //对方场地魔法区
            Container placeMpc2 = new Container(new Size(Program.placeWidth * 2 / 16, Program.totalHeight * 4 / 18), mainPlace);

            EasyTranform.Offset(placeMpc2.Transform, new Point2f((Program.totalWidth - Program.placeWidth) + Program.placeWidth / 16, Program.totalHeight * 2 / 18));
            mainPlace.LayerController.AddElementToLayer(placeMpc2, "Place");



            //-----------------决斗盘手臂部分-------
            //卡组区

            mainPlace.LayerController.AddElementToLayer(thisPlayer.CardGroupContainer, "DuelTool");

            thisPlayer.CardGroup.GetCardGroup(CardGroup.TestCardGroup);
            for (int i = 0; i < 6; i++)
            {
                thisPlayer.CardGroup.Front_ShowAGuiCard(CardGroup.TestCardGroup[i]);
            }


            //手牌区


            mainPlace.LayerController.AddElementToLayer(thisPlayer.HandCardPlaceContainer, "HandCard");//加入元素



            //-----------测试(关于如何使用一个MyGuiButton)
            //设置文字,设置大小
            MyGuiButton button = new MyGuiButton("测试", 50, new Size(100, 100));

            //设置图片
            button.Image = Image.Load(".\\pic\\button.jpg");
            //利用EsayDoing中提供的方法进行简单的矩阵变换
            //平移
            EasyTranform.Offset(button.Transform, new Point2f(0, 800));
            //为button添加鼠标抬起时候触发的方法
            button.AddEvent_InsideMouseLeftUp(() =>
            {
                var temp = thisPlayer.CardGroup.cardList.Count;
                for (int i = 0; i < temp - 1; i++)
                {
                    thisPlayer.HandCardPlaceContainer.AddContainer_Auto(thisPlayer.CardGroup.Front_GiveAGuiCardOut());
                }
            });
            //把定义完的Button加入到图层
            mainPlace.LayerController.AddElementToLayer(button, "UI");


            MyGuiButton button1 = new MyGuiButton(".", 15, new Size(200, 100))
            {
                Image = Image.Load(".\\pic\\rectbutton_null.png"),
            };

            EasyTranform.Offset(button1.Transform, new Point2f(400, 0));
            button1.AddEvent_InsideMouseLeftUp(() =>
            {
                foreach (var item in MainPlace.Elements)
                {
                    if (item is GuiCard)
                    {
                        var temp = (GuiCard)item;
                        Console.WriteLine(temp.Card.Name);
                    }
                    else
                    {
                        Console.WriteLine(item);
                    }
                }

                Console.WriteLine();
            });

            mainPlace.LayerController.AddElementToLayer(button1, "UI");



            MyGuiButton ChangeButton = new MyGuiButton("切换场景", 30, new Size(200, 100));

            ChangeButton.Image = Image.Load(".\\pic\\rectbutton_null.png");
            //ChangeButton.Dragable = true;

            EasyTranform.Offset(ChangeButton.Transform, new Point2f(20, 0));
            ChangeButton.AddEvent_InsideMouseLeftUp(() =>
            {
                Gui.Remove(AllSceneToTakeIn.MainPlace);
                Gui.Add(AllSceneToTakeIn.ClientWindow);
            });
            //MainPlace.LayerController.AddElementToLayer(ChangeButton, "UI");
        }
Пример #14
0
        /// <summary>
        /// Слага всичките неща в Gui-то
        /// </summary>
        public void InitializeGui()
        {
            gui = new Gui(window);

            fileMenu = new UiVerticalMenu(true);
            fileMenu.AddItem("Зареди", menu_FileOpen);
            fileMenu.AddItem("Запази", menu_FileSave);

            fileMenu.X = 0;
            fileMenu.Y = 20;

            fileMenu.visible = false;

            gui.Add(fileMenu);

            arrangeMenu = new UiVerticalMenu(true);
            arrangeMenu.AddItem("В кръг", menu_Circle);
            arrangeMenu.AddItem("Центрирай", BtnCenterGraph);
            arrangeMenu.AddItem("Разбъракно", menu_Shuffle);

            arrangeMenu.X = 50;
            arrangeMenu.Y = 20;

            arrangeMenu.visible = false;

            gui.Add(arrangeMenu);

            menu = new UiHorizontalMenu(1024);

            menu.AddItem("Файл", menu_FileClicked);
            menu.AddItem("Подредба", menu_ArrangeClicked);
            edgeBtn = menu.AddItem("Добави ребра(включи)", BtnAddEdgeToggle);
            physBtn = menu.AddItem("Физика(включи)", BtnPhysToggle);
            menu.AddItem("Създай граф", menu_Generate);
            menu.AddItem("Изчисти", menu_Clear);
            directivityBtn = menu.AddItem("Насочен(не)", menu_Directivity);
            weightBtn = menu.AddItem("Претеглен(не)", menu_Weight);

            gui.Add(menu);

            #region Debug текстове

            dbgLabel1 = new UiLabel("Все още няма нужда от мен за дебъг!", GraphicScheme.font1);
            dbgLabel1.visible = false;
            dbgLabel1.Y = 25;
            dbgLabel1.X = 5;

            dbgLabel2 = new UiLabel("Все още няма нужда от мен за дебъг!", GraphicScheme.font1);
            dbgLabel2.visible = false;
            dbgLabel2.Y = 45;
            dbgLabel2.X = 5;

            dbgLabel3 = new UiLabel("Все още няма нужда от мен за дебъг!", GraphicScheme.font1);
            dbgLabel3.visible = false;
            dbgLabel3.Y = 65;
            dbgLabel3.X = 5;

            gui.Add(dbgLabel1);
            gui.Add(dbgLabel2);
            gui.Add(dbgLabel3);

            #endregion

            edgeInputLabel = new UiLabel("Въведете тегло на ребро(приключване с Enter или кликване)", GraphicScheme.font1);
            edgeInputLabel.X = 340;
            edgeInputLabel.Y = 50;
            edgeInputLabel.visible = false;
            gui.Add(edgeInputLabel);

            rmbMenu = new UiVerticalMenu();
            rmbMenu.visible = false;
            rmbMenu.AddItem("Добави връх", rmbMenu_AddVertex);
            rmbMenu.AddItem("Демаркирай", rmbMenu_Deselect);
            
            gui.Add(rmbMenu);
            //menu.movable = true;

            propertyPanel = new UiPropertyPanel();
            propertyPanel.X = 0;
            propertyPanel.Y = 500;

            gui.Add(propertyPanel);

            if (connector != null)
            { // менюто за контрол на алгоритъм се показва само когато има такъв
                algoControlMenu = new UiHorizontalMenu(200);

                algoControlMenu.X = 412;
                algoControlMenu.Y = 575;

                algoControlMenu.AddItem("Стъпка", BtnSingleStep);
                algoControlMenu.AddItem("Автоматично", MenuBtnPlay);
                algoControlMenu.AddItem("Пауза", MenuBtnPause);

                gui.Add(algoControlMenu);
            }

            
        }
Пример #15
0
        public void start()
        {
            if (gui != null)
            {
                gui.RemoveAllWidgets();
            }
            gui  = new Gui(SceneManager.instance().window);
            font = new Font("EightBitDragon-anqx.ttf");

            gui.Font = font;


            //Создание главной панели
            MainPanel = new Panel();
            Layout2d layout2D = new Layout2d("20%", "100%");

            MainPanel.SizeLayout = layout2D;
            MainPanel.Renderer.BackgroundColor = Color.Black;
            MainPanel.Renderer.BorderColor     = Color.White;
            MainPanel.Renderer.Borders         = new Outline(5);

            gui.Add(MainPanel);


            font = new Font("EightBitDragon-anqx.ttf");

            //Создание панели с кистями.
            BrushesPanel = new ScrollablePanel();
            BrushesPanel.ScrollbarWidth           = 8;
            BrushesPanel.Renderer.BackgroundColor = Color.Black;
            BrushesPanel.Renderer.BorderColor     = Color.White;
            BrushesPanel.PositionLayout           = new Layout2d("0%", "5%");
            BrushesPanel.SizeLayout = new Layout2d("100%", "25%");
            MainPanel.Add(BrushesPanel);

            //Кисти.
            RadioButtonGroup           brushes    = new RadioButtonGroup();
            Dictionary <string, Color> tempColors = BrushManager.instance().getColors(); //получаем список цветов от менеджера кистей
            int positionOffset = 0;                                                      //определяет смещение для кнопки

            foreach (var colorKey in tempColors.Keys)
            {
                positionOffset += 15;
                RadioButton colorBrush_Btn = new RadioButton(colorKey); //создаем кнопку с именем
                colorBrush_Btn.Renderer.TextColor      = Color.White;
                colorBrush_Btn.Renderer.TextColorHover = Color.Blue;
                colorBrush_Btn.PositionLayout          = new Layout2d("0%", positionOffset + "%"); //производим смещение
                colorBrush_Btn.Toggled += (e, a) => { if (colorBrush_Btn.Checked)
                                                      {
                                                          BrushManager.instance().changeCurrentColor(colorKey);
                                                      }
                };                                //привязываем к кнопке метод изменяющий текущий цвет у менеджера кистей
                BrushesPanel.Add(colorBrush_Btn); //добавляем кнопку на панель
            }

            BrushesPanel.Add(brushes);

            //список слоев
            ListBox LayerList = new ListBox();

            LayerList.Renderer.TextColor = Color.White;
            layers = new Dictionary <string, Image>();
            Layer[] tempLayerList = SceneManager.instance().currentScene.getLayers();
            foreach (var lay in tempLayerList)
            {
                //добавляем слои в словарь. При выборе значения в списке - значение будет передано словарю в качестве ключа и будет получение изображение, которое будет передано менеджеру кисти
                //таким образом рисование будет происходить на выбранном пользователем слое
                layers.Add(lay.name, lay.picture.image);
                LayerList.AddItem(lay.name, lay.name);
            }

            LayerList.ItemSelected += (e, a) => { BrushManager.instance().changeCurrentImage(layers[LayerList.GetSelectedItemId()]); };

            LayerList.Renderer.BackgroundColor = Color.Transparent;
            LayerPanel = new Panel();
            LayerPanel.Renderer.BackgroundColor = Color.Black;
            LayerPanel.Renderer.BorderColor     = Color.White;
            LayerPanel.PositionLayout           = new Layout2d("0%", "30%");
            LayerPanel.SizeLayout       = new Layout2d("100%", "30%");
            LayerPanel.Renderer.Borders = new Outline(0, 5, 0, 0);
            LayerPanel.Add(LayerList);
            MainPanel.Add(LayerPanel);

            //Данные производительности
            performancePanel = new Panel();
            performancePanel.Renderer.BackgroundColor = Color.Black;
            performancePanel.Renderer.BorderColor     = Color.White;
            performancePanel.Renderer.Borders         = new Outline(0, 5, 0, 5);
            performancePanel.PositionLayout           = new Layout2d("0%", "50%");
            performancePanel.SizeLayout = new Layout2d("100%", "10%");

            frameDelay = new TextBox();
            frameDelay.Renderer.BackgroundColor = Color.Transparent;
            frameDelay.Renderer.TextColor       = Color.White;
            performancePanel.Add(frameDelay);
            MainPanel.Add(performancePanel);


            //Контроль симуляций (включение/выключение)

            objectsControlPanel = new ScrollablePanel();
            objectsControlPanel.ScrollbarWidth = 8;
            GameObject[] Scene_objects = SceneManager.instance().GetGameObjects();
            positionOffset = 0;

            foreach (var obj in Scene_objects)
            {
                CheckBox gameObjectSwitcher = new CheckBox();
                gameObjectSwitcher.Checked                 = true;
                gameObjectSwitcher.Text                    = obj.name;
                gameObjectSwitcher.Toggled                += (e, a) => { obj.toggleActive(); };
                gameObjectSwitcher.PositionLayout          = new Layout2d("0%", positionOffset + "%");
                gameObjectSwitcher.Renderer.TextColor      = Color.White;
                gameObjectSwitcher.Renderer.TextColorHover = Color.Green;
                gameObjectSwitcher.Renderer.Font           = font;
                positionOffset += 13;
                objectsControlPanel.Add(gameObjectSwitcher);
            }



            objectsControlPanel.Renderer.BackgroundColor = Color.Black;
            objectsControlPanel.Renderer.BorderColor     = Color.White;
            objectsControlPanel.Renderer.Borders         = new Outline(0, 5, 0, 5);
            objectsControlPanel.PositionLayout           = new Layout2d("0%", "60%");
            objectsControlPanel.SizeLayout = new Layout2d("100%", "30%");

            MainPanel.Add(objectsControlPanel);
        }
Пример #16
0
        public static Gui InitializeCreateGameInterface(ref AnoleEngine.Engine objEngineInstance, CreateGameState state)
        {
            Gui   UI   = new Gui(objEngineInstance.GameWindow);
            float fltX = objEngineInstance.GameWindow.Size.X;
            float fltY = objEngineInstance.GameWindow.Size.Y;

            TextBox txbGameName = new TextBox();

            txbGameName.Size = new Vector2f(600, 25);
            float fltGameNameXPos = 200;
            float fltGameNameYPos = 250;

            txbGameName.Position = new Vector2f(fltGameNameXPos, fltGameNameYPos);

            txbGameName.SetRenderer(UI_Renderers.UITextBoxRenderer.Data);
            UI.Add(txbGameName, "txbGameName");


            ComboBox cmbRuleSet = new ComboBox();

            cmbRuleSet.Size = new Vector2f(300, 25);
            float fltRuleSetXPos = 200;
            float fltRuleSetYPos = 300;

            cmbRuleSet.Position = new Vector2f(fltRuleSetXPos, fltRuleSetYPos);

            cmbRuleSet.SetRenderer(UI_Renderers.UIComboBoxRenderer.Data);
            cmbRuleSet.Renderer.ListBox = UI_Renderers.UIListBoxRenderer.Data;
            cmbRuleSet.AddItem("Default 1", "Default1");
            cmbRuleSet.AddItem("Default 2", "Default2");
            UI.Add(cmbRuleSet, "RuleSetSelect");

            Label lblRuleSetLabel = new Label("Select Rule Set:");

            lblRuleSetLabel.Position = new Vector2f(200, 275);
            lblRuleSetLabel.Size     = new Vector2f(200, 25);
            lblRuleSetLabel.SetRenderer(UI_Renderers.UILabelRenderer.Data);
            UI.Add(lblRuleSetLabel, "lblRuleSetLabel");

            ComboBox cmbSelectMap = new ComboBox();

            cmbSelectMap.Size = new Vector2f(300, 25);
            float fltSelectMapXPos = 200;
            float fltSelectMapYPos = 375;

            cmbSelectMap.Position = new Vector2f(fltSelectMapXPos, fltSelectMapYPos);

            cmbSelectMap.SetRenderer(UI_Renderers.UIComboBoxRenderer.Data);
            cmbSelectMap.Renderer.ListBox = UI_Renderers.UIListBoxRenderer.Data;
            cmbSelectMap.AddItem("Desert Canyon", "Default1");
            cmbSelectMap.AddItem("Artcic", "Default2");
            UI.Add(cmbSelectMap, "MapSelect");

            Label lblSelectMapLabel = new Label("Select Map:");

            lblSelectMapLabel.Position = new Vector2f(200, 350);
            lblSelectMapLabel.Size     = new Vector2f(200, 25);
            lblSelectMapLabel.SetRenderer(UI_Renderers.UILabelRenderer.Data);
            UI.Add(lblSelectMapLabel, "lblSelectMapLabel");

            Button BackButton = new Button("BACK");

            BackButton.Size = new Vector2f(200, 50);
            float fltJBackButtonXPos = 100;
            float fltBackButtonYPos  = 50;

            BackButton.Position = new Vector2f(fltJBackButtonXPos, fltBackButtonYPos);
            BackButton.SetRenderer(UI_Renderers.UIBackButtonRenderer.Data);
            UI.Add(BackButton, "BackButton");

            Button CreateGameButton = new Button("CREATE GAME");

            CreateGameButton.Size = new Vector2f(200, 50);
            float fltJCreateGameButtonXPos = 1300;
            float fltCreateGameButtonYPos  = 900;

            CreateGameButton.Position = new Vector2f(fltJCreateGameButtonXPos, fltCreateGameButtonYPos);
            CreateGameButton.SetRenderer(UI_Renderers.UIButtonRenderer.Data);
            UI.Add(CreateGameButton, "CreateGameButton");

            //((Button)UI.Get("JoinGameButton")).Clicked += new EventHandler<SignalArgsVector2f>(state.JoinGameEvent);
            //((Button)UI.Get("RefreshListButton")).Clicked += new EventHandler<SignalArgsVector2f>(state.RefreshServerListEvent);
            //((Button)UI.Get("BackButton")).Clicked += new EventHandler<SignalArgsVector2f>(state.BackToMainMenuEvent);
            //((Button)UI.Get("CreateGameButton")).Clicked += new EventHandler<SignalArgsVector2f>(state.CreateGameEvent);

            return(UI);
        }
Пример #17
0
        static void InitSolveSection()
        {
            solveButton = new Button
            {
                Text     = "Solve",
                Size     = new Vector2f(interfaceColumnWidth, interfaceElementHeight * 1.5f),
                TextSize = 20
            };
            solveButton.Pressed += (s, e) =>
            {
                SolveMaze();
            };
            gui.Add(solveButton);
            PlaceWidgetBelow(mazeSizeSlider, solveButton, 80);

            var solvingTypeLabel = new Label
            {
                Text     = "Solving method",
                Size     = new Vector2f(interfaceColumnWidth, interfaceElementHeight / 2),
                TextSize = 14
            };

            gui.Add(solvingTypeLabel);
            PlaceWidgetBelow(solveButton, solvingTypeLabel);

            solvingCombobox = new ComboBox
            {
                Size     = new Vector2f(interfaceColumnWidth, interfaceElementHeight),
                TextSize = 14
            };
            solvingCombobox.AddItem("Wall Follower (left)", "0");
            solvingCombobox.AddItem("Wall Follower (right)", "1");
            solvingCombobox.AddItem("Recursive Backtracker", "2");
            solvingCombobox.AddItem("Random Mouse", "3");
            solvingCombobox.SetSelectedItemById("0");
            gui.Add(solvingCombobox);
            PlaceWidgetBelow(solvingTypeLabel, solvingCombobox, 5);

            var speedSliderLabel = new Label
            {
                Text     = "Drawing speed",
                Size     = new Vector2f(interfaceColumnWidth, interfaceElementHeight / 2),
                TextSize = 14
            };

            gui.Add(speedSliderLabel);
            PlaceWidgetBelow(solvingCombobox, speedSliderLabel);

            pathDrawingSpeedSlider = new Slider
            {
                Size              = new Vector2f(interfaceColumnWidth, interfaceElementHeight / 2),
                Minimum           = 1,
                Maximum           = 100,
                Step              = 1,
                InvertedDirection = true,
                Name              = "Draw speed",
                Value             = 50
            };
            pathDrawingSpeedSlider.ValueChanged += (s, e) =>
            {
                drawableMaze.PathDrawingSpeed = (int)e.Value;
            };
            gui.Add(pathDrawingSpeedSlider);
            PlaceWidgetBelow(speedSliderLabel, pathDrawingSpeedSlider, 5);
        }
        public Scene createScene()
        {
            bool sceneCreated = false;

            //GUI
            Gui SC_gui = new Gui(window);

            mainPanel.Renderer.BackgroundColor = Color.Black;
            mainPanel.Renderer.BorderColor     = Color.White;
            mainPanel.PositionLayout           = new Layout2d("2.5%", "5%");
            mainPanel.SizeLayout       = new Layout2d("95%", "90%");
            mainPanel.Renderer.Borders = new Outline(5, 5, 5, 5);

            Button createButton = new Button("CREATE");

            createButton.Clicked       += (e, a) => { sceneCreated = true; };
            createButton.PositionLayout = new Layout2d("80%", "90%");

            mainPanel.Add(createButton);
            SC_gui.Add(mainPanel);


            //SIMULATIONS GUI
            Panel simulationsPanel = new Panel();

            simulationsPanel.Renderer.BackgroundColor = Color.Black;
            simulationsPanel.Renderer.BorderColor     = Color.White;
            simulationsPanel.PositionLayout           = new Layout2d("3%", "5%");
            simulationsPanel.SizeLayout       = new Layout2d("25%", "80%");
            simulationsPanel.Renderer.Borders = new Outline(2, 2, 2, 2);

            Panel AddedSimuationsPanel = new Panel(simulationsPanel);

            AddedSimuationsPanel.PositionLayout = new Layout2d("73%", "5%");

            //origin widgets
            originPanel.Renderer.BackgroundColor = Color.Black;
            originPanel.Renderer.BorderColor     = Color.White;
            originPanel.PositionLayout           = new Layout2d("30.5%", "5%");
            originPanel.SizeLayout       = new Layout2d("40%", "80%");
            originPanel.Renderer.Borders = new Outline(2, 2, 2, 2);

            originLabel = new Label();
            originLabel.Renderer.TextColor = Color.White;

            Label SimulationsNote = new Label("Simulations: ");

            SimulationsNote.Renderer       = originLabel.Renderer;
            SimulationsNote.PositionLayout = new Layout2d("3%", "1%");
            Label AddedSimulationsNote = new Label("Added: ");

            AddedSimulationsNote.Renderer       = originLabel.Renderer;
            AddedSimulationsNote.PositionLayout = new Layout2d("73%", "1%");

            mainPanel.Add(SimulationsNote);
            mainPanel.Add(AddedSimulationsNote);
            mainPanel.Add(simulationsPanel);
            mainPanel.Add(AddedSimuationsPanel);


            /////LAYER CREATING/////////
            image = Pixy.drawBorder(image);

            RenderObject picture       = new RenderObject(image);
            RenderObject flame_picture = new RenderObject(flame_field);
            RenderObject fire_picture  = new RenderObject(fire_field);

            Layer main_layer  = new Layer(1, "main");
            Layer Fire_layer  = new Layer(2, "fire_layer");
            Layer flame_layer = new Layer(3, "flame_layer");


            scene = new Scene(window);
            main_layer.setLayerRenderObject(picture);
            Fire_layer.setLayerRenderObject(fire_picture);
            flame_layer.setLayerRenderObject(flame_picture);
            scene.AddLayer(main_layer);
            scene.AddLayer(Fire_layer);
            scene.AddLayer(flame_layer);



            //SIMULATION CREATING PANELS
            SandSimulationPanelInit();
            LiquidSimulationPanelInit();
            FireSimulationPanelInit();
            flameSimulationPanelInit();
            lightningSimulationPanelInit();
            rainSimulationPanelInit();

            AddedSimsList            = new ListBox();
            AddedSimsList.SizeLayout = new Layout2d("100%", "100%");
            AddedSimuationsPanel.Add(AddedSimsList);
            ListBox SimulationsList = new ListBox();

            SimulationsList.AddItem("Sand Simulation", "Sand Simulation");
            SimulationsList.AddItem("Liquid Simulation", "Liquid Simulation");
            SimulationsList.AddItem("Fire Simulation", "Fire Simulation");
            SimulationsList.AddItem("Flame Simulation", "Flame Simulation");
            SimulationsList.AddItem("Lightning Simulation", "Lightning Simulation");
            SimulationsList.AddItem("Rain Simulation", "Rain Simulation");
            SimulationsList.ItemSelected += (e, a) =>
            {
                switch (SimulationsList.GetSelectedItemId())
                {
                case ("Sand Simulation"):
                    currentToolPanel.Visible = false;
                    currentToolPanel         = sandSimulationPanel;
                    currentToolPanel.Visible = true;
                    break;

                case ("Liquid Simulation"):
                    currentToolPanel.Visible = false;
                    currentToolPanel         = liquidSimulationPanel;
                    currentToolPanel.Visible = true;
                    break;

                case ("Fire Simulation"):
                    currentToolPanel.Visible = false;
                    currentToolPanel         = fireSimulationPanel;
                    currentToolPanel.Visible = true;
                    break;

                case ("Flame Simulation"):
                    currentToolPanel.Visible = false;
                    currentToolPanel         = flameSimulationPanel;
                    currentToolPanel.Visible = true;
                    break;

                case ("Lightning Simulation"):
                    currentToolPanel.Visible = false;
                    currentToolPanel         = lightningSimulationPanel;
                    currentToolPanel.Visible = true;
                    break;

                case ("Rain Simulation"):
                    currentToolPanel.Visible = false;
                    currentToolPanel         = rainSimulationPanel;
                    currentToolPanel.Visible = true;
                    break;
                }
            };
            simulationsPanel.Add(SimulationsList);

            while (window.IsOpen && !sceneCreated)
            {
                window.DispatchEvents();
                window.Clear(SFML.Graphics.Color.Black);
                //Draw here
                SC_gui.Draw();
                window.Display();
            }

            //Scene created!
            foreach (var obj in simulations)
            {
                scene.AddObject(obj);
            }
            SC_gui.RemoveAllWidgets();
            return(scene);
        }
Пример #19
0
        public static Gui CreateJoinGameInterface(ref AnoleEngine.Engine objEngineInstance, JoinGameState state)
        {
            Gui UI = new Gui(objEngineInstance.GameWindow);

            float fltX = objEngineInstance.GameWindow.Size.X;
            float fltY = objEngineInstance.GameWindow.Size.Y;

            ListView objServerList = new ListView();

            objServerList.Size     = new Vector2f(1505f, 600f);
            objServerList.Position = new Vector2f(100, 150);
            objServerList.SetRenderer(UI_Renderers.UIListViewRenderer.Data);
            objServerList.AddColumn("NAME:", 800f, HorizontalAlignment.Left);
            objServerList.AddColumn("PLAYERS:", 100f, HorizontalAlignment.Left);
            objServerList.AddColumn("MAP:", 500f, HorizontalAlignment.Left);
            objServerList.AddColumn("IP:PORT", 100f, HorizontalAlignment.Left);

            objServerList.AddItem(new List <string>()
            {
                "Test server name", "2/8", "Super awesome map 5"
            });

            UI.Add(objServerList, "ServerList");

            Button JoinGameButton = new Button("JOIN GAME");

            JoinGameButton.Size = new Vector2f(200, 50);
            float fltJoinGameXPos = (1000);
            float fltJoinGameYPos = (50);

            JoinGameButton.Position = new Vector2f(fltJoinGameXPos, fltJoinGameYPos);
            JoinGameButton.SetRenderer(UI_Renderers.UIButtonRenderer.Data);

            UI.Add(JoinGameButton, "JoinGameButton");

            Button RefreshListButton = new Button("REFRESH");

            RefreshListButton.Size = new Vector2f(200, 50);
            float fltRefreshXPos = (1300);
            float fltRefreshYPos = (50);

            RefreshListButton.Position = new Vector2f(fltRefreshXPos, fltRefreshYPos);
            RefreshListButton.SetRenderer(UI_Renderers.UIButtonRenderer.Data);
            UI.Add(RefreshListButton, "RefreshListButton");

            Button BackButton = new Button("BACK");

            BackButton.Size = new Vector2f(200, 50);
            float fltJBackButtonXPos = (100);
            float fltBackButtonYPos  = (50);

            BackButton.Position = new Vector2f(fltJBackButtonXPos, fltBackButtonYPos);
            BackButton.SetRenderer(UI_Renderers.UIBackButtonRenderer.Data);
            UI.Add(BackButton, "BackButton");

            Button CreateGameButton = new Button("CreateGame");

            CreateGameButton.Size = new Vector2f(200, 50);
            float fltJCreateGameButtonXPos = (400);
            float fltCreateGameButtonYPos  = (50);

            CreateGameButton.Position = new Vector2f(fltJCreateGameButtonXPos, fltCreateGameButtonYPos);
            CreateGameButton.SetRenderer(UI_Renderers.UIButtonRenderer.Data);
            UI.Add(CreateGameButton, "CreateGameButton");

            ((ListView)UI.Get("ServerList")).ItemSelected += new EventHandler <SignalArgsInt>(state.ServiceListSelectEvent);
            ((Button)UI.Get("JoinGameButton")).Clicked    += new EventHandler <SignalArgsVector2f>(state.JoinGameEvent);
            ((Button)UI.Get("RefreshListButton")).Clicked += new EventHandler <SignalArgsVector2f>(state.RefreshServerListEvent);
            ((Button)UI.Get("BackButton")).Clicked        += new EventHandler <SignalArgsVector2f>(state.BackToMainMenuEvent);
            ((Button)UI.Get("CreateGameButton")).Clicked  += new EventHandler <SignalArgsVector2f>(state.CreateGameEvent);

            return(UI);
        }
Пример #20
0
        public static void ShowMessagebox(String title, String text)
        {
            var resx = Data.Settings.Graphics.ResolutionX;
            var resy = Data.Settings.Graphics.ResolutionY;

            var mbox = GUI.Add(new MessageBox(Theme), "mbox");

            mbox.Title = title;
            var label = mbox.Add(new Label(Theme));

            label.Text           = text;
            label.TextSize       = 16;
            label.TextColor      = Color.Black;
            mbox.Size            = new Vector2f(label.Size.X + 10, label.Size.Y + 50);
            label.Position       = new Vector2f(5, 5);
            mbox.Position        = new Vector2f((resx / 2) - (mbox.Size.X / 2), (resy / 2) - (mbox.Size.Y / 2));
            mbox.ClosedCallback += UIHandlers.Messagebox_OKClick;
            var button = mbox.Add(new Button(Theme));

            button.Text     = "OK";
            button.Position = new Vector2f((mbox.Size.X / 2) - (button.Size.X / 2), mbox.Size.Y - (button.Size.Y + 5));
            button.LeftMouseClickedCallback += UIHandlers.Messagebox_OKClick;
        }