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); } }
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); }
public MenuState(MainClass game) : base(game) { Glfw.Enable(GlfwEnableCap.MouseCursor); Button bSP = new Button(game, "PLAY GAME"); bSP.Position = new Vector2i(game.Screen.Width / 2 - bSP.Image.Width / 2, 10); bSP.MouseClicked += (sender, e) => Game.CurrentGameState = new MainGameState(Game); Gui.Add(bSP); Button bMP = new Button(game, "MULTIPLAYER"); bMP.Position = new Vector2i(game.Screen.Width / 2 - bMP.Image.Width / 2, 30); bMP.MouseClicked += (sender, e) => Game.CurrentGameState = new ServerRequestState(Game); Gui.Add(bMP); Button credits = new Button(game, "CREDITS"); credits.Position = new Vector2i(game.Screen.Width / 2 - credits.Image.Width / 2, 50); credits.MouseClicked += (sender, e) => Game.CurrentGameState = new PlotScreen(Game, "PROGRAMMING: ANTONIJN\n" + "SOUND EFFECTS: ANTONIJN\n" + "GRAPHICS: ANTONIJN\n\n" + "LIVESTREAM PROVIDED BY TWITCH\n" + "HOSTING ON DROPBOX", (sender1, e1) => Game.CurrentGameState = this, (sender1, e1) => Game.CurrentGameState = this); Gui.Add(credits); Button howToPlay = new Button(game, "HOW TO PLAY"); howToPlay.Position = new Vector2i(game.Screen.Width / 2 - howToPlay.Image.Width / 2, 70); howToPlay.MouseClicked += (sender, e) => Game.CurrentGameState = new PlotScreen(Game, "MOVE AROUND WITH WASD.\n" + "USE MOUSE TO LOOK AROUND.\n" + "CHANGE INVENTORY ITEM WITH THE MOUSE WHEEL OR THE NUMBER KEYS.\n" + "DROP ITEMS WITH Q.\n" + "PICK UP HEALTH PACKS TO REGAIN HEALTH.\n" + "AMMO CRATES RESTORE THE AMMO OF EVERYTHING IN YOUR INVENTORY.\n" + "THE NUMBER IN BETWEEN THE HEALTH BAR AND AMMO INDICATES THE AMOUNT OF MAGAZINES LEFT. ONCE OUT OF AMMO, REALOAD YOUR GUN BY PRESSING THE LEFT MOUSE BUTTON.\n", (sender1, e1) => Game.CurrentGameState = this, (sender1, e1) => Game.CurrentGameState = this); Gui.Add(howToPlay); Button exit = new Button(game, "QUIT"); exit.Position = new Vector2i(game.Screen.Width / 2 - exit.Image.Width / 2, 90); exit.MouseClicked += (sender, e) => Glfw.CloseWindow(); Gui.Add(exit); }
public PlotScreen(MainClass game, string text, EventHandler skipHandler, EventHandler nextHandler) : base(game) { Glfw.Enable(GlfwEnableCap.MouseCursor); finalText = text.ToUpper(); Button skip = new Button(game, "SKIP"); skip.Position = new Vector2i(20, MainClass.ScreenHeight - 20 - skip.Image.Height); skip.MouseClicked += skipHandler; Gui.Add(skip); next = new Button(Game, "NEXT"); next.Position = new Vector2i(MainClass.ScreenWidth - 20 - next.Image.Width, MainClass.ScreenHeight - 20 - next.Image.Height); next.MouseClicked += nextHandler; }
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; }