Beispiel #1
0
        public override void DrawUI(SpriteBatch sb, LayoutUserInterface ui)
        {
            int sw = Screen.Width;
            int sh = Screen.Height;

            ui.FontSize = 128;
            var size = ui.MeasureString("Raze");

            ui.IMGUI.Label(new Point((sw - size.X) / 2, 40), "Raze", Color.Black, out Rectangle titleBounds);
            ui.FontSize = ui.DefaultFontSize;

            int w = 400;
            int h = 500;

            ui.PanelContext(new Rectangle((sw - w) / 2, Math.Max((sh - h) / 2, titleBounds.Bottom + 10), w, h));
            if (ui.Button("Play"))
            {
                OnHostClicked();
            }
            if (ui.Button("Join Multiplayer"))
            {
                OnConnectClicked();
            }

            var panel  = ui.GetContextInnerBounds();
            int height = ui.IMGUI.ApplyScale(50);

            if (ui.IMGUI.Button(new Rectangle(panel.X, panel.Bottom - height, panel.Width, height), "Quit"))
            {
                OnExitClicked();
            }
            ui.EndContext();
        }
Beispiel #2
0
        private void DrawInputUI(LayoutUserInterface ui)
        {
            int sw = ui.IMGUI.ScreenProvider.GetWidth();
            int sh = ui.IMGUI.ScreenProvider.GetHeight();
            int w  = 350;
            int h  = 350;

            var sb = new Rectangle((sw - w) / 2, (sh - h) / 2, w, h);

            ui.PanelContext(sb, PanelType.Default);
            var panel = ui.GetContextInnerBounds();

            ui.TextBox(ipInput, new Point(panel.Width, 40));
            ui.TextBox(portInput, new Point(panel.Width, 40));
            ui.TextBox(passwordInput, new Point(panel.Width, 40));
            ui.FlatSeparator();
            if (ui.Button("Connect"))
            {
                OnConnectClicked();
            }
            ui.ActiveTint = Color.Red;
            if (ui.IMGUI.Button(new Rectangle(panel.X, panel.Bottom - 32, panel.Width, 32), "Cancel"))
            {
                OnExitClicked();
            }
            ui.ActiveTint = Color.White;

            ui.EndContext();
        }