Ejemplo n.º 1
0
        public ServerRequestState(MainClass game) : base(game)
        {
            Glfw.Enable(GlfwEnableCap.MouseCursor);

            Label ip = new Label("ENTER SERVER IP:", Game);

            ip.Position = new Vector2i(game.Screen.Width / 2 - TextureTools.MeasureString(ip.Text, 4, 5).X / 2, 10);
            Gui.Add(ip);

            Label username = new Label("ENTER USERNAME:"******"ENTER SERVER PORT:", Game);

            portLabel.Position = new Vector2i(game.Screen.Width / 2 - TextureTools.MeasureString(portLabel.Text, 4, 5).X / 2, 70);
            Gui.Add(portLabel);

            TextBox bSP = new TextBox(game);

            bSP.Position = new Vector2i(game.Screen.Width / 2 - bSP.Image.Width / 2, 20);
                        #if DEBUG
            bSP.Text = "127.0.0.1";
                        #endif
            Gui.Add(bSP);

            TextBox bUname = new TextBox(game);
            bUname.Position = new Vector2i(game.Screen.Width / 2 - bSP.Image.Width / 2, 50);
                        #if DEBUG
            bUname.Text = "ANTONIJN";
                        #endif
            Gui.Add(bUname);

            TextBox bPort = new TextBox(game);
            bPort.Position = new Vector2i(game.Screen.Width / 2 - bPort.Image.Width / 2, 80);
                        #if DEBUG
            bPort.Text = "25565";
                        #endif
            Gui.Add(bPort);

            Button bMP = new Button(game, "JOIN");
            bMP.Position      = new Vector2i(game.Screen.Width / 2 - bMP.Image.Width / 2, 100);
            bMP.MouseClicked += (sender, e) => Game.CurrentGameState = new MainGameState(Game, bSP.Text, bUname.Text, int.Parse(bPort.Text));
            Gui.Add(bMP);

            Button backButton = new Button(game, "BACK");
            backButton.Position      = new Vector2i(game.Screen.Width / 2 - backButton.Image.Width / 2, 120);
            backButton.MouseClicked += (sender, e) => Game.CurrentGameState = new MenuState(Game);
            Gui.Add(backButton);
        }
Ejemplo n.º 2
0
        public override Vector2i Draw(MainGameState game)
        {
            Vector2i v = base.Draw(game);

            toPerformWhileNoPP.Add(() => TextureTools.BlitString(TextureTools.Font, 4, 5, new Vector2i(v.X - TextureTools.MeasureString(Name, 4, 5).X / 2, v.Y - 6), Name, game.Game.Screen));
            return(v);
        }
Ejemplo n.º 3
0
        public AreYouSure(MainGameState maingame) : base(maingame.Game)
        {
            Glfw.Enable(GlfwEnableCap.MouseCursor);

            Label deadLabel = new Label("ARE YOU SURE YOU WANT TO QUIT?", Game);

            deadLabel.Position = new Vector2i(Game.Screen.Width, Game.Screen.Height) / 2 - TextureTools.MeasureString(deadLabel.Text, 4, 5) / 2;
            Gui.Add(deadLabel);

            Button yes = new Button(Game, "YES");

            yes.Position      = new Vector2i(Game.Screen.Width / 2 - yes.Image.Width - 15, Game.Screen.Height / 2 + 30);
            yes.MouseClicked += (sender, e) => { Game.CurrentGameState = new MenuState(Game); };
            Gui.Add(yes);

            Button no = new Button(Game, "NO");

            no.Position      = new Vector2i(Game.Screen.Width / 2 + 15, Game.Screen.Height / 2 + 30);
            no.MouseClicked += (sender, e) => { Game.CurrentGameState = maingame; Glfw.Disable(GlfwEnableCap.MouseCursor); };
            Gui.Add(no);

            mainGame = maingame;
        }
Ejemplo n.º 4
0
 public override void Draw()
 {
     base.Draw();
     TextureTools.BlitString(TextureTools.Font, 4, 5, Position + new Vector2i(Image.Width / 2, Image.Height / 2) - TextureTools.MeasureString(Text, 4, 5) / 2, Text, Game.Screen);
 }
Ejemplo n.º 5
0
        public DeathState(MainGameState game, bool respawn) : base(game.Game)
        {
            Glfw.Enable(GlfwEnableCap.MouseCursor);

            Label deadLabel = new Label("YOU DEADED", Game);

            deadLabel.Position = new Vector2i(Game.Screen.Width, Game.Screen.Height) / 2 - TextureTools.MeasureString(deadLabel.Text, 4, 5) / 2;
            Gui.Add(deadLabel);

            if (respawn)
            {
                Button bSP = new Button(Game, "RESPAWN");
                bSP.Position      = new Vector2i(Game.Screen.Width / 2 - bSP.Image.Width / 2, Game.Screen.Height / 2 + 30);
                bSP.MouseClicked += (sender, e) => {
                    CheckPoint.Restore(game);
                    Game.CurrentGameState = game;
                    Glfw.Disable(GlfwEnableCap.MouseCursor);
                };
                Gui.Add(bSP);
            }
            else
            {
                Button bSP = new Button(Game, "QUIT");
                bSP.Position      = new Vector2i(Game.Screen.Width / 2 - bSP.Image.Width / 2, Game.Screen.Height / 2 + 30);
                bSP.MouseClicked += (sender, e) => {
                    Game.CurrentGameState = new MenuState(Game);
                };
                Gui.Add(bSP);
            }
        }