private void SetupUsernameMenu() { UsernameLabel = new Gwen.Control.Label(BaseCanvas); UsernameLabel.SetText("Enter Desired Username" + "\n(This is how your score will be represented in the Highscores page.)" + "\n(Name must be between 1 and 16 characters, and be ASCII encodable.(0-9, a-Z))"); UsernameLabel.AutoSizeToContents = true; UsernameLabel.SetPosition(300, 150); UsernameBox = new Gwen.Control.TextBox(BaseCanvas); UsernameBox.SetSize(180, 35); UsernameBox.SetPosition(300, 200); UsernameContinue = new Gwen.Control.Button(BaseCanvas); UsernameContinue.SetText("Continue"); UsernameContinue.SetSize(150, 30); UsernameContinue.SetPosition(300, 260); UsernameContinue.Clicked += (B, Args) => { if (UsernameBox.Text != "" && UsernameBox.Text.Length <= 16) { ActiveScreen = Screen.Menu; } }; }
public void SetupHighscores() { NoDataFailure = new Gwen.Control.Label(BaseCanvas); NoDataFailure.SetText("No Highscore Data Retrieved"); NoDataFailure.AutoSizeToContents = true; NoDataFailure.SetPosition(100, 150); TopScoresLabel = new Gwen.Control.Label(BaseCanvas); TopScoresLabel.SetText("Highscores"); TopScoresLabel.SetSize(100, 50); TopScoresLabel.SetPosition(250, 50); TopScoresList = new Gwen.Control.ListBox(BaseCanvas); TopScoresList.SetSize(220, 210); TopScoresList.SetPosition(180, 70); TopScoresBackButton = new Gwen.Control.Button(BaseCanvas); TopScoresBackButton.SetText("Back"); TopScoresBackButton.AutoSizeToContents = true; TopScoresBackButton.SetPosition(50, 350); TopScoresBackButton.Clicked += (B, Args) => { ActiveScreen = Screen.Menu; }; }
public void SetupNetworkedSessionMenu() { ServerSelectorLabel = new Gwen.Control.Label(BaseCanvas); ServerSelectorLabel.SetText("Server"); ServerSelectorLabel.AutoSizeToContents = true; ServerSelectorLabel.SetPosition(50, 0); ServerSelector = new Gwen.Control.ComboBox(BaseCanvas); ServerSelector.AddItem("Server A"); ServerSelector.AddItem("Server B"); ServerSelector.AddItem("Server C"); ServerSelector.AddItem("Server D"); ServerSelector.AddItem("Server E"); ServerSelector.AddItem("Server F"); ServerSelector.AddItem("Server G"); ServerSelector.AddItem("Server H"); ServerSelector.AddItem("Server I"); ServerSelector.AddItem("Server J"); ServerSelector.AddItem("Custom Server..."); ServerSelector.SetSize(200, 50); ServerSelector.SetPosition(50, 20); ServerSelector.TextColor = Color.Black; ServerSelector.UpdateColors(); CustomServerLabel = new Gwen.Control.Label(BaseCanvas); CustomServerLabel.SetText("Address Port"); CustomServerLabel.AutoSizeToContents = true; CustomServerLabel.SetPosition(50, 180); CustomServerAddress = new Gwen.Control.TextBox(BaseCanvas); CustomServerAddress.SetSize(200, 30); CustomServerAddress.SetPosition(50, 200); CustomServerPort = new Gwen.Control.TextBox(BaseCanvas); CustomServerPort.SetSize(70, 30); CustomServerPort.SetPosition(254, 200); SessionConnect = new Gwen.Control.Button(BaseCanvas); SessionConnect.SetText("Connect"); SessionConnect.SetSize(200, 50); SessionConnect.SetPosition(260, 380); SessionConnect.Clicked += (B, Args) => { ActiveScreen = Screen.Connecting; }; BackButton = new Gwen.Control.Button(BaseCanvas); BackButton.SetText("Back"); BackButton.AutoSizeToContents = true; BackButton.SetPosition(50, 450); BackButton.Clicked += (B, Args) => { ActiveScreen = Screen.Menu; }; }
public void Init(Gwen.Renderer.Base renderer, string textureName) { this.renderer = renderer; skin = new Gwen.Skin.TexturedBase(renderer, textureName); skin = new Gwen.Skin.Simple(renderer); skin.DefaultFont = new Font(renderer, "Courier", 10); canvas = new Gwen.Control.Canvas(skin); ToolBar = new ToolBar(canvas); DocumentTab = new DocumentTab(canvas); var label = new Gwen.Control.Label(canvas); canvas.AddChild(label); label.SetText("YOLO!"); if (Initiated != null) Initiated.Invoke(); }
public void OnLoad(EventArgs e) { Renderer = new Gwen.Renderer.OpenTK(); _skin = new Gwen.Skin.TexturedBase(Renderer, "Content/DefaultSkin.png"); Canvas = new Gwen.Control.Canvas(_skin); _input = new Gwen.Input.OpenTK(Program.Game); _input.Initialize(Canvas); Canvas.SetSize((int)Program.Game.windowSize.X, (int)Program.Game.windowSize.Y); Canvas.ShouldDrawBackground = false; Canvas.BackgroundColor = Color.FromArgb(255, 150, 170, 170); SetupInputEvents(); _sideMenuBox = new Gwen.Control.GroupBox(_canvas); _sideMenuBox.SetSize(80, 128); _sideMenuBox.Position(Gwen.Pos.Center); _sideMenuBox.Position(Gwen.Pos.Right, 5); LoadElementCatagories(); // Current element text _currentElementLabel = new Gwen.Control.Label(_canvas); _currentElementLabel.SetPosition(10, 10); _currentElementLabel.SetSize(100, 40); _currentElementLabel.SetText(""); // Bottom menu _bottomMenuBox = new Gwen.Control.GroupBox(_canvas); _bottomMenuBox.SetSize(800, 36); _bottomMenuBox.Position(Gwen.Pos.Center); _bottomMenuBox.Position(Gwen.Pos.Bottom); _bottomMenuBox.ShouldDrawBackground = true; }
public void InitGUI(Gwen.Control.Base rootGUI) { var label = new Gwen.Control.Label(rootGUI); label.SetText("YEAH"); label.Height = 100; }
public void showItemModal(TriggerGiveItem sender) { Gwen.Control.WindowControl w = new Gwen.Control.WindowControl(_canvas, "Items", true); w.Width = 200; w.Height = 120; //w.DeleteOnClose = true; Gwen.Control.ImagePanel img = new Gwen.Control.ImagePanel(w); img.ImageName = "./assets/" + sender.item.iconName; img.SetPosition(5, 10); img.SetSize(32, 32); Gwen.Control.CheckBox check = new Gwen.Control.CheckBox(w); check.SetPosition(w.Width - 29, 32 / 2 + 3); check.IsChecked = true; Gwen.Control.Label itemName = new Gwen.Control.Label(w); itemName.Text = sender.item.name; itemName.SetPosition(48, 14); Gwen.Control.Label itemDescription = new Gwen.Control.Label(w); Gwen.Font descFont = defaultFont; descFont.Size = 9; itemDescription.Width = 200; itemDescription.Text = sender.item.description; itemDescription.Font = descFont; itemDescription.SetPosition(48, 25); Gwen.Control.Button takeAll = new Gwen.Control.Button(w); takeAll.SetText("Take All"); takeAll.TextColor = System.Drawing.Color.White; takeAll.TextColorOverride = System.Drawing.Color.FromArgb(236, 236, 255); takeAll.Width = 60; takeAll.X = 5; takeAll.Y = w.Height - takeAll.Height - 40; takeAll.Clicked += delegate { if (sender._amount > 0) { while(sender._amount > 0) { Engine.player.inventory.Add(sender.item); if (Engine.player.activeWeapon.name == null && sender.item.GetType().IsSubclassOf(typeof(Weapon))) { Engine.player.activeWeapon = (Panjin.Weapon)Engine.player.inventory[Engine.player.inventory.Count -1]; } sender._amount--; } w.SetPosition(-99, -99); w.Hide(); w.Close(); } else { w.SetPosition(-99, -99); w.Hide(); w.Close(); } }; Gwen.Control.Button takeSelected = new Gwen.Control.Button(w); takeSelected.SetText("Take Selected"); takeSelected.Width = 80; takeSelected.TextColor = System.Drawing.Color.White; takeSelected.TextColorOverride = System.Drawing.Color.FromArgb(236, 236, 255); takeSelected.X = w.Width - takeSelected.Width - 17; takeSelected.Y = w.Height - takeSelected.Height - 40; }
public void showRespawnModal(Vector2i spawn) { Gwen.Control.WindowControl w = new Gwen.Control.WindowControl(_canvas, "Respawn", true); w.Width = 150; w.Height = 100; w.IsClosable = false; Align.Center(w); Gwen.Control.Label text = new Gwen.Control.Label(w); text.Text = "You Died!"; text.SetPosition(5, 10); Gwen.Control.Button respawn = new Gwen.Control.Button(w); respawn.SetText("Respawn"); respawn.TextColor = System.Drawing.Color.White; respawn.TextColorOverride = System.Drawing.Color.FromArgb(236, 236, 255); respawn.Width = 60; respawn.X = w.Width / 2 - (respawn.Width/2); respawn.Y = w.Height - respawn.Height - 40; respawn.Clicked += delegate { //Engine.map.entities.Add(new Player(spawn)); Log.WriteError("Not currently implemented in this refactoring!"); Engine.view.Center = new Vector2f(spawn.X*16, spawn.Y*16); w.Close(); }; }
public static void Init() { Gwen.Control.TabButton button = tabControl.AddPage("Player"); tabControl.Padding = new Padding(2, 2, 2, 2); page = button.Page; inventoryGroup = new Gwen.Control.GroupBox(page); inventoryGroup.SetPosition(250, 0); inventoryGroup.Width = tabControl.Width - 270; inventoryGroup.Height = tabControl.Height - 43; inventoryGroup.Text = "Inventory"; foreach (Item i in Engine.player.inventory) { Gwen.Control.ImagePanel img = new Gwen.Control.ImagePanel(inventoryGroup); img.ImageName = "./assets/" + i.iconName; img.SetPosition(10, 10); img.SetSize(32, 32); } playerinfoGroup = new Gwen.Control.GroupBox(page); playerinfoGroup.Text = Engine.player.name; playerinfoGroup.SetPosition(5, 0); playerinfoGroup.SetSize(235, tabControl.Height - 43); healthText = new Gwen.Control.Label(playerinfoGroup); healthText.SetPosition(5, 0); healthText.Text = "Health: " + Engine.player.health + "/100"; positionText = new Gwen.Control.Label(playerinfoGroup); positionText.SetPosition(5, 13); positionText.Text = "Position: " + Engine.player.position.X + ", " + Engine.player.position.Y; mouseAngleText = new Gwen.Control.Label(playerinfoGroup); mouseAngleText.SetPosition(5, 26); mouseAngleText.Text = "Mouse Angle: " + Engine.player.mouseAngle; activeWeaponText = new Gwen.Control.Label(playerinfoGroup); activeWeaponText.SetPosition(5, 39); activeWeaponText.Text = "Active Weapon: " + Engine.player.activeWeapon.name; }