/// <summary> /// Initializes a new instance of the <see cref="TreeNode"/> class. /// </summary> /// <param name="parent">Parent control.</param> public TreeNode(Base parent) : base(parent) { m_ToggleButton = new TreeToggleButton(this); m_ToggleButton.SetBounds(0, 0, 15, 15); m_ToggleButton.Toggled += OnToggleButtonPress; m_Title = new TreeNodeLabel(this); m_Title.Dock = Pos.Top; m_Title.Margin = new Margin(16, 0, 0, 0); m_Title.DoubleClicked += OnDoubleClickName; m_Title.Clicked += OnClickName; m_InnerPanel = new Base(this); m_InnerPanel.Dock = Pos.Top; m_InnerPanel.Height = 100; m_InnerPanel.Margin = new Margin(TreeIndentation, 1, 0, 0); m_InnerPanel.Hide(); IsRoot = parent is TreeControl; m_Selected = false; IsSelectable = true; Dock = Pos.Top; }
public ScreenPlanet(Base parent) : base(parent) { SetSize(parent.Width, parent.Height); Gwen.Control.Label label = new Gwen.Control.Label(this); label.Text = "Planet"; label.SetPosition(30, 30); label.TextColor = Color.FromArgb(200, 80, 0, 250); label.Font = Program.fontLogo; int width; int height; Gwen.Control.WindowControl settingsWindow = new Gwen.Control.WindowControl(this); settingsWindow.Width = parent.Width / 2; settingsWindow.Height = parent.Height / 2; settingsWindow.SetPosition(width = parent.Width / 2 - settingsWindow.Width / 2, height = parent.Height / 2 - settingsWindow.Height / 2); Gwen.Control.Button buttonBack = new Gwen.Control.Button(settingsWindow); buttonBack.Text = "Back"; buttonBack.Font = Program.fontButtonLabels; buttonBack.SetBounds(width / 100 * 8, height / 100 * 8, width / 3, height / 3); buttonBack.Clicked += onButtonBackClick; }
public Screen_TechTree(Base parent) : base(parent) { Gwen.Control.Button buttonOK = new Gwen.Control.Button(this); buttonOK.Text = "Back"; buttonOK.Font = Program.fontButtonLabels; buttonOK.SetBounds(500, 500, 50, 50); buttonOK.Clicked += onButtonOKClick; Tech.Inint(); SetSize(parent.Width, parent.Height); label = new Gwen.Control.Label(this); label.Text = "Tech_Tree Probe"; label.SetPosition(Program.percentW(85), Program.percentH(85)); label.TextColor = Color.FromArgb(200, 80, 0, 250); label.Font = Program.fontLogo; img = new Gwen.Control.ImagePanel(this); updateDrawing(); img.SetPosition(Program.percentW(0), Program.percentH(0)); img.SetSize(Program.percentW(80), Program.percentH(80)); //img.Clicked += new GwenEventHandler<ClickedEventArgs>(img_Clicked); img.MouseMoved += new GwenEventHandler <MovedEventArgs>(img_MouseMoved); img.MouseDown += new GwenEventHandler <ClickedEventArgs>(img_MouseDown); img.MouseUp += new GwenEventHandler <ClickedEventArgs>(img_MouseUp); }
public OpenTextureWindow(TextureCallback callback) : base(DevelopmentMenu.Instance) { this.Title = "Select Texture"; this.Resized += OnResize; this.SetPosition((int)MouseManager.GetMousePositionWindows().X, (int)MouseManager.GetMousePositionWindows().Y); Callback = callback; PackageView = new PackageTree(this); PackageView.SetPosition(10, 10); PackageView.Filter = ResourceType.Texture; PackageView.TextureOpened += ItemSelected; PackageView.RefreshPackageView(); Cancel = new Button(this); Cancel.Text = "Cancel"; Cancel.Clicked += delegate(Base item, ClickedEventArgs args) { FSTexture none = new FSTexture(); none.ID = Guid.Empty; this.ItemSelected(none); this.Close(); }; this.SetSize(340, 450); }
public ScreenSolarSystem(Base parent) : base(parent) { SetSize(parent.Width, parent.Height); Gwen.Control.Label label = new Gwen.Control.Label(this); label.Text = "Solar System"; label.SetPosition(30, 30); label.TextColor = Color.FromArgb(200, 80, 0, 250); label.Font = Program.fontLogo; Gwen.Control.Button buttonOK = new Gwen.Control.Button(this); buttonOK.Text = "OK"; buttonOK.Font = Program.fontButtonLabels; buttonOK.SetBounds(300, 500, 200, 50); buttonOK.Clicked += onButtonOKClick; Gwen.Control.Button buttonPlanet = new Gwen.Control.Button(this); buttonPlanet.Text = "Planet"; buttonPlanet.Font = Program.fontButtonLabels; buttonPlanet.SetBounds(550, 500, 200, 50); buttonPlanet.Clicked += onButtonPlanetClick; }
public override void InitUi(Canvas canvas) { var window = new WindowControl(canvas, "Menu principal"); window.DisableResizing(); window.IsClosable = false; window.SetSize(200, 125); window.SetPosition(Game.GetWindowSize().X / 2 - window.Width / 2, Game.GetWindowSize().Y / 2 - window.Height / 2); var playButton = new Button(window); playButton.SetText("Jouer !"); playButton.Clicked += (sender, arguments) => ShowSelectLevelUi(canvas); var settingsButton = new Button(window); settingsButton.SetText("Options"); Align.PlaceDownLeft(settingsButton, playButton, 10); var exitButton = new Button(window); exitButton.SetText("Quitter"); exitButton.Clicked += (sender, arguments) => { Game.Close(); }; Align.PlaceDownLeft(exitButton, settingsButton, 10); Align.CenterHorizontally(playButton); Align.CenterHorizontally(settingsButton); Align.CenterHorizontally(exitButton); }
public CodeEditor(CodeFile resource) : base(DevelopmentMenu.Instance) { this.Title = "Code Editor"; this.Resource = resource; this.SetSize(600, 400); this.SetPosition((int)MouseManager.GetMousePositionWindows().X, (int)MouseManager.GetMousePositionWindows().Y); CodeArea = new MultilineTextBox(this); CodeArea.AcceptTabs = true; CodeArea.SetSize(400, 400); CodeArea.Text = Resource.Source; CodeArea.Font = new Gwen.Font(MainCanvas.Renderer, "Consolas"); CodeArea.Dock = Gwen.Pos.Fill; CodeArea.TextChanged +=new GwenEventHandler<EventArgs>(CodeArea_TextChanged); TopBar = new Base(this); TopBar.Dock = Gwen.Pos.Top; TopBar.SetSize(0, 25); { Run = new Button(TopBar); Run.Text = "Run"; Run.Clicked += new GwenEventHandler<ClickedEventArgs>(Run_Clicked); } ErrorList = new ListBox(this); ErrorList.Dock = Gwen.Pos.Bottom; ErrorList.Height = 50; }
public void Initialize() { TextBox IP = new TextBox(MainCanvas.Instance); IP.Text = "127.0.0.1"; IP.SetPosition(10, 10); NumericUpDown Port = new NumericUpDown(MainCanvas.Instance); Port.Max = ushort.MaxValue; Port.Min = 0; Port.Value = 54987; Port.SetPosition(10, 40); Button Connect = new Button(MainCanvas.Instance); Connect.Text = "Connect"; Connect.SetPosition(10, 70); Connect.Clicked += delegate(Base sender, ClickedEventArgs args) { NetPeerConfiguration config = new NetPeerConfiguration("Xanatos"); Program.Connection = new NetClient(config); Program.Connection.Start(); Program.Connection.Connect(IP.Text, (int)Port.Value); while (((NetClient)Program.Connection).ConnectionStatus != NetConnectionStatus.Connected) { Thread.Sleep(500); Program.Connection.ReadMessages(new List<NetIncomingMessage>()); } Message.RegisterClient(Program.Connection); new PlayerJoining().Send(); }; }
public void AddTool(string name /* Image image */, Action onSelect) { var pButton = new Gwen.Control.Button(pTileLayout); pButton.SetSize(20, 20); pButton.SetToolTipText(name); pButton.ShouldDrawBackground = true; pButton.Clicked += new Gwen.Control.Base.GwenEventHandler( b => onSelect.Invoke()); }
public Screen_GameScreen(Base parent) : base(parent) { SetSize(parent.Width, parent.Height); label = new Gwen.Control.Label(this); label.Text = "GAME!!!"; label.SetPosition(Program.percentW(5), Program.percentH(5)); label.TextColor = Color.FromArgb(200, 80, 0, 250); label.Font = Program.fontLogo; img = new Gwen.Control.ImagePanel(this); galaxyImage = new Bitmap(Program.percentW(100), Program.percentH(80), PixelFormat.Format32bppArgb); DrawControl = new DrawController(galaxyImage); updateDrawing(); img.SetPosition(Program.percentW(0), Program.percentH(20)); img.SetSize(Program.percentW(100), Program.percentH(80)); //img.Clicked += new GwenEventHandler<ClickedEventArgs>(img_Clicked); img.MouseMoved += new GwenEventHandler <MovedEventArgs>(img_MouseMoved); img.MouseDown += new GwenEventHandler <ClickedEventArgs>(img_MouseDown); img.MouseUp += new GwenEventHandler <ClickedEventArgs>(img_MouseUp); Gwen.Control.Button buttonTech = new Gwen.Control.Button(this); buttonTech.Text = "Tech Tree"; buttonTech.Font = Program.fontButtonLabels; buttonTech.SetBounds(Program.percentW(80), Program.percentH(84), Program.percentW(20), Program.percentH(8)); buttonTech.Clicked += onButtonTechClick; Gwen.Control.Button buttonMenu = new Gwen.Control.Button(this); buttonMenu.Text = "Menu"; buttonMenu.Font = Program.fontButtonLabels; buttonMenu.SetBounds(Program.percentW(0), Program.percentH(0), Program.percentW(13), Program.percentH(8)); buttonMenu.Clicked += onButtonMenuClick; Gwen.Control.Button buttonSolarSystem = new Gwen.Control.Button(this); buttonSolarSystem.Text = "Solar System"; buttonSolarSystem.Font = Program.fontButtonLabels; buttonSolarSystem.SetBounds(Program.percentW(0), Program.percentH(92), Program.percentW(19), Program.percentH(8)); buttonSolarSystem.Clicked += onSolarSystemClick; Gwen.Control.Button buttonStep = new Gwen.Control.Button(this); buttonStep.Text = "Step"; buttonStep.Font = Program.fontButtonLabels; buttonStep.SetBounds(Program.percentW(90), Program.percentH(92), Program.percentW(10), Program.percentH(8)); buttonStep.Clicked += onSolarSystemClick; buttonCombat = new Gwen.Control.Button(this); buttonCombat.Text = "Combat"; buttonCombat.Font = Program.fontButtonLabels; buttonCombat.SetBounds(Program.percentW(19), Program.percentH(92), Program.percentW(18), Program.percentH(8)); buttonCombat.Clicked += onCombatClick; }
/// <summary> /// Initializes a new instance of the <see cref="CollapsibleCategory"/> class. /// </summary> /// <param name="parent">Parent control.</param> public CollapsibleCategory(CollapsibleList parent) : base(parent) { m_HeaderButton = new CategoryHeaderButton(this); m_HeaderButton.Text = "Category Title"; // [omeg] todo: i18n m_HeaderButton.Dock = Pos.Top; m_HeaderButton.Height = 20; m_HeaderButton.Toggled += OnHeaderToggle; m_List = parent; Padding = new Padding(1, 0, 1, 5); SetSize(512, 512); }
public Screen_Combat(Base parent) : base(parent) { SetSize(parent.Width, parent.Height); imgCombatMap = new Gwen.Control.ImagePanel(this); tacticState.New(ref seed); ShipsCounter.ShipsCount(ref seed); pictureMap.Width = Program.percentW(100); pictureMap.Height = Program.percentH(82); tacticDraw.New(pictureMap, seed, tacticState); UpdateDrawing(); imgCombatMap.SetPosition(Program.percentW(0), Program.percentH(0)); imgCombatMap.SetSize(pictureMap.Width, pictureMap.Height); imgCombatMap.MouseDown += new GwenEventHandler <ClickedEventArgs>(imgCombatMap_MouseDown); buttonStep = new Gwen.Control.Button(this); buttonStep.Text = "Step"; buttonStep.Font = Program.fontButtonLabels; buttonStep.SetBounds(Program.percentW(82), Program.percentH(82), Program.percentW(18), Program.percentH(6)); buttonStep.Clicked += onStepClick; buttonConcede = new Gwen.Control.Button(this); buttonConcede.Text = "Concede"; buttonConcede.Font = Program.fontButtonLabels; buttonConcede.SetBounds(Program.percentW(82), Program.percentH(88), Program.percentW(18), Program.percentH(6)); buttonConcede.Clicked += onConcedeClick; buttonAutoBattle = new Gwen.Control.Button(this); buttonAutoBattle.Text = "Auto Battle"; buttonAutoBattle.Font = Program.fontButtonLabels; buttonAutoBattle.SetBounds(Program.percentW(82), Program.percentH(94), Program.percentW(18), Program.percentH(6)); buttonAutoBattle.Clicked += onAutoBattleClick; labelStep = new Gwen.Control.Label(this); labelStep.Text = "Ходит 1-й игрок"; labelStep.Font = Program.fontText; labelStep.TextColor = Color.GreenYellow; labelStep.SetBounds(Program.percentW(65), Program.percentH(90), Program.percentW(20), Program.percentH(8)); labelDescription = new Gwen.Control.Label(this); labelDescription.Text = ""; labelDescription.Font = Program.fontText; labelDescription.TextColor = Color.GreenYellow; labelDescription.SetBounds(Program.percentW(0), Program.percentH(82), Program.percentW(50), Program.percentH(18)); }
public PauseMenu (Application app, CompositorColorCorrectionNode colorCorrectionNode, Base parent, Action onContinue, Action onPause) { this.onContinue = onContinue; this.onPause = onPause; this.colorCorrectionNode = colorCorrectionNode; this.application = app; this.parent = parent; settings = new SettingsMenu (app, parent, colorCorrectionNode); window = new WindowControl (parent, Localizer.Instance.GetValueForName("pause")); window.DisableResizing(); window.IsMoveable = false; window.OnClose += (sender, arguments) => Hide(); window.Width = BUTTON_WIDTH + 20; window.Hide(); continueButton = new Button (window); continueButton.Text = Localizer.Instance.GetValueForName("back_to_game"); continueButton.Width = BUTTON_WIDTH; continueButton.X = 10; continueButton.Y = 10; continueButton.Clicked += (sender, arguments) => Hide(); settingsButton = new Button (window); settingsButton.Text = Localizer.Instance.GetValueForName("settings"); settingsButton.Width = BUTTON_WIDTH; settingsButton.X = 10; settingsButton.Y = 10 + continueButton.Y + continueButton.Height; settingsButton.Clicked += (sender, arguments) => settings.Show(); exitButton = new Button (window); exitButton.Text = Localizer.Instance.GetValueForName("quit_game"); exitButton.Width = BUTTON_WIDTH; exitButton.X = 10; exitButton.Y = 10 + settingsButton.Y + settingsButton.Height; exitButton.Clicked += (sender, arguments) => application.Window.Close (); window.Height += exitButton.Y + exitButton.Height + 10; window.X = (parent.Width - window.Width) / 2; window.Y = (parent.Height - window.Height) / 2; ValidMessages = new int[] { (int) MessageId.WindowResize, (int) MessageId.UpdateLocale, (int) MessageId.Input }; app.MessageManager += this; }
Base ConstructFindGame() { Base FindGame = new Base(MainCanvas.GetCanvas()); FindGame.SetSize(300, 300); Label EnterIP = new Label(FindGame); EnterIP.AutoSizeToContents = true; EnterIP.SetText("Enter an IP:"); EnterIP.SetPosition(10, 10); TextBox IPAddress = new TextBox(FindGame); IPAddress.SetText("127.0.0.1"); IPAddress.SetPosition(10, 40); IPAddress.SetSize(260, 20); TextBox Port = new TextBox(FindGame); Port.SetText("54987"); Port.SetPosition(10, 70); Port.SetSize(260, 20); Button Connect = new Button(FindGame); Connect.SetText("Connect"); Connect.SetPosition(10, 200); Connect.SetSize(200, 20); Connect.Clicked += delegate(Base sender, ClickedEventArgs args) { Program.Connect(IPAddress.Text, Int32.Parse(Port.Text)); MainMenu.Hide(); FindGame.Hide(); Connecting.Show(); }; Button Back = new Button(FindGame); Back.SetText("Back"); Back.SetPosition(10, 225); Back.SetSize(200, 20); Back.Clicked += delegate(Base sender, ClickedEventArgs args) { Mode = MenuMode.MainMenu; MainMenu.Show(); FindGame.Hide(); }; return FindGame; }
private Base CreateAddRemoveButton(Base parent, string labelText, int labelMaxWidth, int valueLabelMaxWidth, int minValue, int maxValue, Action onAdd, Action onRemove) { Base b = new Base(parent); b.Dock = Pos.Top; b.Padding = new Padding(0, 0, 0, 4); //Base r = new Base(b); //r.Dock = Pos.Right; //r.Padding = new Padding(0, 0, 0, 0); //Base l = new Base(b); //l.Dock = Pos.Left; //l.Padding = new Padding(0, 0, 0, 0); Label label = new Label(b); label.Text = labelText; label.Dock = Pos.Left; label.Padding = new Padding(0, 0, Math.Max(0, labelMaxWidth - label.Width), 0); Label valueLabel = new Label(b); valueLabel.Dock = Pos.Left; valueLabel.Text = "0"; valueLabel.Padding = new Padding(Math.Max(0, valueLabelMaxWidth - valueLabel.Width), 0, 0, 0); Button addButton = new Button(b); addButton.Text = "+"; addButton.Height = 20; addButton.Width = 20; addButton.Dock = Pos.Right; addButton.Released += (s, e) => onAdd(); addButton.Released += (s, e) => valueLabel.Text = Math.Min(maxValue, int.Parse(valueLabel.Text) + 1).ToString(); Button removeButton = new Button(b); removeButton.Text = "-"; removeButton.Height = 20; removeButton.Width = 20; removeButton.Dock = Pos.Right; removeButton.Released += (s, e) => onRemove(); removeButton.Released += (s, e) => valueLabel.Text = Math.Max(minValue, int.Parse(valueLabel.Text) - 1).ToString(); b.SizeToChildren(); return b; }
/// <summary> /// Initializes a new instance of the <see cref="MessageBox"/> class. /// </summary> /// <param name="parent">Parent control.</param> /// <param name="text">Message to display.</param> /// <param name="caption">Window caption.</param> public MessageBox(Base parent, string text, string caption = "") : base(parent, caption, true) { DeleteOnClose = true; m_Label = new Label(m_InnerPanel); m_Label.Text = text; m_Label.Margin = Margin.Five; m_Label.Dock = Pos.Top; m_Label.Alignment = Pos.Center; m_Button = new Button(m_InnerPanel); m_Button.Text = "OK"; // todo: parametrize buttons m_Button.Clicked += CloseButtonPressed; m_Button.Clicked += DismissedHandler; m_Button.Margin = Margin.Five; m_Button.SetSize(50, 20); Align.Center(this); }
private void EndCombat(int win) { Gwen.Control.WindowControl windowEnd = new Gwen.Control.WindowControl(this); windowEnd.Width = this.Width / 2; windowEnd.Height = this.Height / 2; windowEnd.SetPosition(this.Width / 2 - windowEnd.Width / 2, this.Height / 2 - windowEnd.Height / 2); Gwen.Control.Label labelWin = new Gwen.Control.Label(windowEnd); labelWin.Text = "Win Player " + win.ToString(); labelWin.Font = Program.fontLogo; labelWin.SetBounds(windowEnd.Width / 2 - labelWin.Width / 2, windowEnd.Height / 2 - labelWin.Height, windowEnd.Width, windowEnd.Height * 15 / 100); Gwen.Control.Button buttonOK = new Gwen.Control.Button(windowEnd); buttonOK.Text = "OK"; buttonOK.Font = Program.fontButtonLabels; buttonOK.SetBounds(windowEnd.Width / 2 - buttonOK.Width / 2, windowEnd.Height * 70 / 100, windowEnd.Width * 25 / 100, windowEnd.Height * 15 / 100); buttonOK.Clicked += onOKClick; windowEnd.IsClosable = false; }
public void Initialize() { Status = new Label(MainCanvas.Instance); Status.SetPosition(10, 10); Status.SetText("Waiting for opponent..."); Status.MakeColorBright(); Button cancel = new Button(MainCanvas.Instance); cancel.SetText("Cancel"); cancel.SetPosition(10, 40); cancel.Clicked += delegate(Base sender, ClickedEventArgs args) { Program.SwitchState(new MainMenu()); }; NetPeerConfiguration Configuration = new NetPeerConfiguration("Xanatos"); Configuration.Port = 54987; Configuration.MaximumConnections = 1; Program.Connection = new NetServer(Configuration); Program.Connection.Start(); Message.RegisterServer(Program.Connection); }
public Screen_MainMenu(Base parent) : base(parent) { SetSize(parent.Width, parent.Height); Gwen.Control.Label label = new Gwen.Control.Label(this); label.Text = "GalaxyConquest"; label.SetPosition(70, 30); label.TextColor = Color.FromArgb(200, 80, 0, 250); label.Font = Program.fontLogo; Gwen.Control.Button buttonNewGame = new Gwen.Control.Button(this); buttonNewGame.Text = "New game"; buttonNewGame.Font = Program.fontButtonLabels; buttonNewGame.SetBounds(300, 200, 200, 50); buttonNewGame.Pressed += onButtonNewGameClick; Gwen.Control.Button buttonLoadGame = new Gwen.Control.Button(this); buttonLoadGame.Text = "Load game"; buttonLoadGame.Disable(); buttonLoadGame.Font = Program.fontButtonLabels; buttonLoadGame.SetBounds(300, 260, 200, 50); Gwen.Control.Button buttonSettings = new Gwen.Control.Button(this); buttonSettings.Text = "Settings"; buttonSettings.Font = Program.fontButtonLabels; buttonSettings.SetBounds(300, 320, 200, 50); buttonSettings.Pressed += onButtonSettingsClick; Gwen.Control.Button buttonCredits = new Gwen.Control.Button(this); buttonCredits.Text = "Credits"; buttonCredits.Font = Program.fontButtonLabels; buttonCredits.SetBounds(300, 380, 200, 50); Gwen.Control.Button buttonQuit = new Gwen.Control.Button(this); buttonQuit.Text = "Quit"; buttonQuit.Font = Program.fontButtonLabels; buttonQuit.SetBounds(300, 440, 200, 50); buttonQuit.Pressed += onButtonQuitClick; }
private void CreateEscapeWindow() { EscapeWindow = new WindowControl(MainCanvas.GetCanvas()); EscapeWindow.SetPosition(10, 10); EscapeWindow.SetSize(200, 200); Button Close = new Button(EscapeWindow); Close.SetPosition(10, 10); Close.SetText("Continue"); Close.Clicked += delegate(Base sender, ClickedEventArgs args) { EscapeWindow.Hide(); Game.LockMouse = true; }; Button Quit = new Button(EscapeWindow); Quit.SetPosition(10, 40); Quit.SetText("Quit"); Quit.Clicked += delegate(Base sender, ClickedEventArgs args) { MainCanvas.Dispose(); Environment.Exit(0); }; }
public Screen_NewGame(Base parent) : base(parent) { SetSize(parent.Width, parent.Height); label = new Gwen.Control.Label(this); label.Text = "New game"; label.SetPosition(Program.percentW(5), Program.percentH(5)); label.TextColor = Color.FromArgb(200, 80, 0, 250); label.Font = Program.fontLogo; Gwen.Control.Button buttonBack = new Gwen.Control.Button(this); buttonBack.Text = "Back"; buttonBack.Font = Program.fontButtonLabels; buttonBack.SetBounds(Program.percentW(5), Program.percentH(87), Program.percentW(18), Program.percentH(8)); buttonBack.Clicked += onButtonBackClick; Gwen.Control.Button buttonNewGame = new Gwen.Control.Button(this); buttonNewGame.Text = "New game"; buttonNewGame.Font = Program.fontButtonLabels; buttonNewGame.SetBounds(Program.percentW(77), Program.percentH(87), Program.percentW(18), Program.percentH(8)); buttonNewGame.Clicked += onButtonNewGameClick; imageGalaxyType = new Gwen.Control.ImagePanel(this); imageGalaxyType.Image = Properties.Resources.icon_newgame_spiral; imageGalaxyType.SetBounds(Program.percentW(20), Program.percentH(20), Program.percentW(25), Program.percentH(25)); Gwen.Control.Button buttonGalaxyTypeLeft = new Gwen.Control.Button(this); buttonGalaxyTypeLeft.Text = "<"; buttonGalaxyTypeLeft.SetBounds(Program.percentW(20), Program.percentH(40), Program.percentW(5), Program.percentH(5)); buttonGalaxyTypeLeft.Clicked += onButtonGalaxyTypeLeftClick; Gwen.Control.Button buttonGalaxyTypeRight = new Gwen.Control.Button(this); buttonGalaxyTypeRight.Text = ">"; buttonGalaxyTypeRight.SetBounds(Program.percentW(40), Program.percentH(40), Program.percentW(5), Program.percentH(5)); buttonGalaxyTypeRight.Clicked += onButtonGalaxyTypeRightClick; }
public override void PostLoad() { { Gwen.Control.Button btn = new Gwen.Control.Button (canvas); btn.Height = 50; btn.Dock = Gwen.Pos.Top; btn.Text = "BUTTON 1"; btn.Clicked += (s, e) => { Console.WriteLine ("BUTTON 1 clicked"); }; } { Gwen.Control.Button btn = new Gwen.Control.Button (canvas); btn.Height = 50; btn.Dock = Gwen.Pos.Top; btn.Text = "BUTTON 2"; btn.Clicked += (s, e) => { Console.WriteLine ("BUTTON 2 clicked"); }; } }
private void onButtonMenuClick(Base control, EventArgs args) { if (!menuOpenned) { menuOpenned = true; Gwen.Control.WindowControl menuWindow = new Gwen.Control.WindowControl(this); menuWindow.Width = Program.percentW(50); menuWindow.Height = Program.percentH(50); menuWindow.SetPosition(Program.percentW(25), Program.percentH(20)); Gwen.Control.Button buttonNewGame = new Gwen.Control.Button(menuWindow); buttonNewGame.Text = "New game"; buttonNewGame.Font = Program.fontButtonLabels; buttonNewGame.SetBounds(Program.percentW(12), Program.percentH(0), 200, 50); buttonNewGame.Pressed += onButtonNewGameClick; Gwen.Control.Button buttonLoadGame = new Gwen.Control.Button(menuWindow); buttonLoadGame.Text = "Load game"; buttonLoadGame.Disable(); buttonLoadGame.Font = Program.fontButtonLabels; buttonLoadGame.SetBounds(Program.percentW(12), Program.percentH(10), 200, 50); Gwen.Control.Button buttonSaveGame = new Gwen.Control.Button(menuWindow); buttonSaveGame.Text = "Save Game"; buttonSaveGame.Disable(); buttonSaveGame.Font = Program.fontButtonLabels; buttonSaveGame.SetBounds(Program.percentW(12), Program.percentH(20), 200, 50); Gwen.Control.Button buttonQuit = new Gwen.Control.Button(menuWindow); buttonQuit.Text = "Quit"; buttonQuit.Font = Program.fontButtonLabels; buttonQuit.SetBounds(Program.percentW(12), Program.percentH(30), 200, 50); buttonQuit.Pressed += onButtonQuitClick; } }
public PackageExplorer() : base(DevelopmentMenu.Instance) { this.Title = "Package Explorer"; this.SetPosition((int)MouseManager.GetMousePositionWindows().X, (int)MouseManager.GetMousePositionWindows().Y); /* Tree View */ PackageView = new PackageTree(this); PackageView.SetPosition(10, 10); PackageView.TextureOpened += delegate(FSTexture tex) { TextureEditor window = new TextureEditor(tex); window.Show(); }; PackageView.BlockTypeOpened += delegate(BlockType bt) { BlockTypeEditor window = new BlockTypeEditor(bt); window.Show(); }; PackageView.CodeOpened += delegate(CodeFile cf) { CodeEditor window = new CodeEditor(cf); window.Show(); }; PackageView.Dock = Gwen.Pos.Fill; /* Top Bar */ TopBar = new Base(this); TopBar.Height = 25; TopBar.Dock = Gwen.Pos.Top; { Button AddPackage = new Button(TopBar); AddPackage.Text = "Add Package"; AddPackage.Clicked += new GwenEventHandler<ClickedEventArgs>(AddPackage_Clicked); } this.SetSize(340, 450); }
public void Initialize() { Base MainPage = new Base(MainCanvas.Instance); MainPage.Dock = Gwen.Pos.Fill; Label Title = new Label(MainPage); Title.Font = new Gwen.Font(MainCanvas.Renderer, "Consolas", 144); Title.Text = "Xanatos"; Title.MakeColorBright(); Button StartServer = new Button(MainPage); StartServer.SetPosition(10, 300); StartServer.Text = "Start Server"; StartServer.Clicked += delegate(Base sender, ClickedEventArgs args) { Program.SwitchState(new GameState.Hosting()); }; Button Connect = new Button(MainPage); Connect.SetPosition(10, 330); Connect.Text = "Connect"; Connect.Clicked += delegate(Base sender, ClickedEventArgs args) { Program.SwitchState(new GameState.Connect()); }; }
private void setupUi() { renderer = new Gwen.Renderer.OpenTK(); Gwen.Skin.Base skin = new Gwen.Skin.TexturedBase(renderer, "DefaultSkin.png"); canvas = new Canvas(skin); canvas.SetSize(Width, Height); gwenInput = new Gwen.Input.OpenTK(this); gwenInput.Initialize(canvas); Mouse.ButtonDown += Mouse_ButtonDown; Mouse.ButtonUp += Mouse_ButtonUp; Mouse.Move += Mouse_Move; Mouse.WheelChanged += Mouse_Wheel; canvas.ShouldDrawBackground = true; canvas.BackgroundColor = System.Drawing.Color.FromArgb(122, 150, 170, 170); // controls radioCamera = new RadioButtonGroup(canvas); radioCamera.AutoSizeToContents = true; radioCamera.SetText("Тип камеры"); radioCamera.AddOption("Свободная", "free"); radioCamera.AddOption("Привязанная", "bound"); radioCamera.SetSelection(0); radioCamera.SelectionChanged += radioCamera_SelectionChanged; // coord GroupBox posGroup = new GroupBox(canvas); posGroup.SetText("Позиция камеры"); posGroup.SizeToChildren(); posGroup.SetSize(150, 120); Gwen.Align.PlaceDownLeft(posGroup, radioCamera, 45); labelPosX = new Label(posGroup); labelPosY = new Label(posGroup); labelPosZ = new Label(posGroup); labelPosX.SetText("X: 0.0"); labelPosY.SetText("Y: 1.0"); labelPosZ.SetText("Z: 2.0"); Gwen.Align.PlaceDownLeft(labelPosY, labelPosX, 5); Gwen.Align.PlaceDownLeft(labelPosZ, labelPosY, 5); // reset button Button resetCameraButton = new Gwen.Control.Button(posGroup); resetCameraButton.SetText("Сбросить позицию\nкамеры"); resetCameraButton.Clicked += cameraReset_Clicked; resetCameraButton.SizeToContents(); Gwen.Align.PlaceDownLeft(resetCameraButton, labelPosZ, 5); labelSpeed = new Label(canvas); Gwen.Align.PlaceDownLeft(labelSpeed, posGroup, 5); labelTips = new Label(canvas); labelTips.SetText(freeCameraTip + "\n\n" + nodeTransformTip); labelTips.SizeToContents(); Gwen.Align.PlaceDownLeft(labelTips, labelSpeed, 15); statusBar = new Gwen.Control.StatusBar(canvas); statusBar.Dock = Gwen.Pos.Bottom; }
private void InitializeUI() { settings = NavMeshGenerationSettings.Default; areaSettings = new AreaIdGenerationSettings(); DockBase dock = new DockBase(gwenCanvas); dock.Dock = Pos.Fill; dock.SetSize(Width, Height); dock.RightDock.Width = 280; dock.BottomDock.Height = 150; statusBar = new StatusBar(gwenCanvas); Label genTime = new Label(statusBar); genTime.Name = "GenTime"; genTime.Text = "Generation Time: 0ms"; genTime.Dock = Pos.Left; LabeledCheckBox catchCheckBox = new LabeledCheckBox(statusBar); catchCheckBox.Text = "Intercept and log exceptions"; catchCheckBox.Dock = Pos.Right; catchCheckBox.CheckChanged += (s, e) => interceptExceptions = catchCheckBox.IsChecked; catchCheckBox.IsChecked = true; Base genBase = new Base(dock); dock.RightDock.TabControl.AddPage("NavMesh Generation", genBase); Button generateButton = new Button(genBase); generateButton.Text = "Generate!"; generateButton.Height = 30; generateButton.Dock = Pos.Top; generateButton.Released += (s, e) => GenerateNavMesh(); GroupBox displaySettings = new GroupBox(genBase); displaySettings.Text = "Display"; displaySettings.Dock = Pos.Top; displaySettings.Height = 60; Base levelCheckBase = new Base(displaySettings); levelCheckBase.Dock = Pos.Top; Label levelCheckLabel = new Label(levelCheckBase); levelCheckLabel.Text = "Level"; levelCheckLabel.Dock = Pos.Left; CheckBox levelCheckBox = new CheckBox(levelCheckBase); levelCheckBox.Dock = Pos.Right; levelCheckBox.Checked += (s, e) => displayLevel = true; levelCheckBox.UnChecked += (s, e) => displayLevel = false; levelCheckBox.IsChecked = true; levelCheckBase.SizeToChildren(); Base displayModeBase = new Base(displaySettings); displayModeBase.Dock = Pos.Top; displayModeBase.Padding = new Padding(0, 4, 0, 0); Label displayModeLabel = new Label(displayModeBase); displayModeLabel.Text = "Generation Step"; displayModeLabel.Dock = Pos.Left; displayModeLabel.Padding = new Padding(0, 0, 4, 0); ComboBox displayModes = new ComboBox(displayModeBase); displayModes.Dock = Pos.Top; displayModes.AddItem("None", "", DisplayMode.None); displayModes.AddItem("Heightfield", "", DisplayMode.Heightfield); displayModes.AddItem("Compact Heightfield", "", DisplayMode.CompactHeightfield); displayModes.AddItem("Distance Field", "", DisplayMode.DistanceField); displayModes.AddItem("Regions", "", DisplayMode.Regions); displayModes.AddItem("Contours", "", DisplayMode.Contours); displayModes.AddItem("Polygon Mesh", "", DisplayMode.PolyMesh); displayModes.AddItem("Polygon Mesh Detail", "", DisplayMode.PolyMeshDetail); displayModes.AddItem("NavMesh", "", DisplayMode.NavMesh); displayModes.AddItem("Pathfinding", "", DisplayMode.Pathfinding); displayModes.ItemSelected += (s, e) => displayMode = (DisplayMode)e.SelectedItem.UserData; displayModes.SelectByUserData(DisplayMode.PolyMeshDetail); displayModeBase.SizeToChildren(); displayModeBase.Height += 4; //accounts for the padding, GWEN.NET should do this const int leftMax = 125; const int rightMax = 20; GroupBox areaSetting = new GroupBox(genBase); areaSetting.Text = "Area"; areaSetting.Dock = Pos.Top; areaSetting.Height = 90; var levelTris = level.GetTriangles(); BBox3 bounds = TriangleEnumerable.FromTriangle(levelTris, 0, levelTris.Length).GetBoundingBox(); Base maxTriSlope = CreateSliderOption(areaSetting, "Max Tri Slope:", 0.0001f, 3.14f, 3.14f, "N2", leftMax, rightMax, v => areaSettings.MaxTriSlope = v); Base minLevelHeight = CreateSliderOption(areaSetting, "Min Height:", bounds.Min.Y, bounds.Max.Y, bounds.Min.Y, "N0", leftMax, rightMax, v => areaSettings.MinLevelHeight = v); Base maxLevelHeight = CreateSliderOption(areaSetting, "Max Height:", bounds.Min.Y, bounds.Max.Y, bounds.Max.Y, "N0", leftMax, rightMax, v => areaSettings.MaxLevelHeight = v); GroupBox rsSettings = new GroupBox(genBase); rsSettings.Text = "Rasterization"; rsSettings.Dock = Pos.Top; rsSettings.Height = 90; Base cellSizeSetting = CreateSliderOption(rsSettings, "Cell Size:", 0.1f, 2.0f, 0.3f, "N2", leftMax, rightMax, v => settings.CellSize = v); Base cellHeightSetting = CreateSliderOption(rsSettings, "Cell Height:", 0.1f, 2f, 0.2f, "N2", leftMax, rightMax, v => settings.CellHeight = v); GroupBox agentSettings = new GroupBox(genBase); agentSettings.Text = "Agent"; agentSettings.Dock = Pos.Top; agentSettings.Height = 115; Base maxSlopeSetting = CreateSliderOption(agentSettings, "Max Climb:", 0.1f, 5.0f, 0.9f, "N0", leftMax, rightMax, v => settings.MaxClimb = v); Base maxHeightSetting = CreateSliderOption(agentSettings, "Height:", 0.1f, 5.0f, 2.0f, "N0", leftMax, rightMax, v => settings.AgentHeight = v); Base erodeRadius = CreateSliderOption(agentSettings, "Radius:", 0.0f, 5.0f, 0.6f, "N1", leftMax, rightMax, v => { settings.AgentRadius = v; agentCylinder.Radius = v; }); Base addRemoveAgent = CreateAddRemoveButton(agentSettings, "Count", leftMax, rightMax, 0, MAX_AGENTS, () => { numActiveAgents++; GenerateCrowd(); }, () => { numActiveAgents--; GenerateCrowd(); }); GroupBox regionSettings = new GroupBox(genBase); regionSettings.Text = "Region"; regionSettings.Dock = Pos.Top; regionSettings.Height = 65; Base minRegionSize = CreateSliderOption(regionSettings, "Min Region Size:", 0f, 150f, 8f, "N0", leftMax, rightMax, v => settings.MinRegionSize = (int)Math.Round(v)); Base mrgRegionSize = CreateSliderOption(regionSettings, "Merged Region Size:", 0f, 150f, 20f, "N0", leftMax, rightMax, v => settings.MergedRegionSize = (int)Math.Round(v)); GroupBox navMeshSettings = new GroupBox(genBase); navMeshSettings.Text = "NavMesh"; navMeshSettings.Dock = Pos.Top; navMeshSettings.Height = 90; Base maxEdgeLength = CreateSliderOption(navMeshSettings, "Max Edge Length:", 0f, 50f, 12f, "N0", leftMax, rightMax, v => settings.MaxEdgeLength = (int)Math.Round(v)); Base maxEdgeErr = CreateSliderOption(navMeshSettings, "Max Edge Error:", 0f, 3f, 1.8f, "N1", leftMax, rightMax, v => settings.MaxEdgeError = v); Base vertsPerPoly = CreateSliderOption(navMeshSettings, "Verts Per Poly:", 3f, 12f, 6f, "N0", leftMax, rightMax, v => settings.VertsPerPoly = (int)Math.Round(v)); GroupBox navMeshDetailSettings = new GroupBox(genBase); navMeshDetailSettings.Text = "NavMeshDetail"; navMeshDetailSettings.Dock = Pos.Top; navMeshDetailSettings.Height = 65; Base sampleDistance = CreateSliderOption(navMeshDetailSettings, "Sample Distance:", 0f, 16f, 6f, "N0", leftMax, rightMax, v => settings.SampleDistance = (int)Math.Round(v)); Base maxSampleError = CreateSliderOption(navMeshDetailSettings, "Max Sample Error:", 0f, 16f, 1f, "N0", leftMax, rightMax, v => settings.MaxSampleError = (int)Math.Round(v)); Base logBase = new Base(dock); dock.BottomDock.TabControl.AddPage("Log", logBase); ListBox logBox = new ListBox(logBase); logBox.Dock = Pos.Fill; logBox.AllowMultiSelect = false; logBox.EnableScroll(true, true); Console.SetOut(new GwenTextWriter(logBox)); }
public MainMenu (Application application, Action onPlayGame, CompositorColorCorrectionNode colorCorrectionNode) { this.application = application; this.onPlayGame = onPlayGame; ValidMessages = new[] { (int) MessageId.WindowResize, (int) MessageId.UpdateLocale }; application.MessageManager += this; canvas = application.RendererContext.Canvas; var input = new FreezingArcherInput(application, application.MessageManager); input.Initialize (canvas); canvas.SetSize(application.Window.Size.X, application.Window.Size.Y); canvas.ShouldDrawBackground = false; settings = new SettingsMenu (application, canvas, colorCorrectionNode); tutorial = new TutorialMenu (application, canvas); background = new ImagePanel (canvas); background.ImageName = "Content/MainMenu.jpg"; updateBackground(); exitButton = new Button (canvas); exitButton.Text = Localizer.Instance.GetValueForName("quit_game"); exitButton.Width = BUTTON_WIDTH; exitButton.X = 40; exitButton.Y = canvas.Height - exitButton.Height - 60; exitButton.Clicked += (sender, arguments) => application.Window.Close (); settingsButton = new Button (canvas); settingsButton.Text = Localizer.Instance.GetValueForName("settings"); settingsButton.Width = BUTTON_WIDTH; settingsButton.X = 40; settingsButton.Y = exitButton.Y - settingsButton.Height - 40; settingsButton.Clicked += (sender, arguments) => settings.Show(); tutorialButton = new Button (canvas); tutorialButton.Text = Localizer.Instance.GetValueForName("tutorial"); tutorialButton.Width = BUTTON_WIDTH; tutorialButton.X = 40; tutorialButton.Y = settingsButton.Y - tutorialButton.Height - 40; tutorialButton.Clicked += (sender, arguments) => tutorial.Show(); startButton = new Button (canvas); startButton.Text = Localizer.Instance.GetValueForName("start_game"); startButton.Width = BUTTON_WIDTH; startButton.X = 40; startButton.Y = tutorialButton.Y - startButton.Height - 40; startButton.Clicked += (sender, arguments) => { application.MessageManager.UnregisterMessageConsumer(this); application.MessageManager.UnregisterMessageConsumer(settings); settings.Destroy(); canvas.Dispose(); onPlayGame(); }; acagamicsFoo = new ImagePanel (canvas); acagamicsFoo.ImageName = "Content/figure_color.png"; acagamicsFoo.Width = 64; acagamicsFoo.Height = 106; acagamicsFoo.X = canvas.Width - acagamicsFoo.Width - 10; acagamicsFoo.Y = canvas.Height - acagamicsFoo.Height - 10; }
/// <summary> /// Initializes a new instance of the <see cref="TreeNode"/> class. /// </summary> /// <param name="parent">Parent control.</param> public TreeNode(ZGE.Components.ZComponent parent) : base(parent) { m_ToggleButton = new TreeToggleButton(this); m_ToggleButton.SetBounds(0, 0, 15, 15); m_ToggleButton.Toggled += OnToggleButtonPress; m_Title = new TreeNodeLabel(this); m_Title.Dock = Pos.Top; m_Title.Margin = new Margin(16, 0, 0, 0); m_Title.DoubleClickedLeft += OnDoubleClickName; m_Title.Clicked += OnClickName; m_InnerPanel = new GUIControl(this); m_InnerPanel.Dock = Pos.Top; m_InnerPanel.Height = 100; m_InnerPanel.Margin = new Margin(TreeIndentation, 1, 0, 0); m_InnerPanel.Hide(); m_Root = false; m_Selected = false; m_Selectable = true; }
public override void InitUi(Canvas canvas) { _canvas = canvas; Game.BackgroundColor = Color.Black; var windowAction = new WindowControl(canvas, "Options", false); windowAction.DisableResizing(); windowAction.IsClosable = false; windowAction.SetSize(200, 150); windowAction.SetPosition(0, 0); var addScriptButton = new Button(windowAction); addScriptButton.SetText("Ajouter un script"); addScriptButton.Clicked += (sender, arguments) => ShowAddScriptWindow(canvas); Align.CenterHorizontally(addScriptButton); // Fenêtre sur les informations du script sélectionné _windowInfoScript = new WindowControl(canvas, "Paramètres du script"); _windowInfoScript.DisableResizing(); _windowInfoScript.IsClosable = false; _windowInfoScript.SetSize(200, 300); _windowInfoScript.SetPosition(Game.GetWindowSize().X - _windowInfoScript.Width, 0); var labelX = new Label(_windowInfoScript); labelX.SetPosition(0, 10); labelX.SetText("X :"); _uiInfoTextBoxPosX = new TextBoxNumeric(_windowInfoScript); _uiInfoTextBoxPosX.SetSize(100, _uiInfoTextBoxPosX.Height); _uiInfoTextBoxPosX.TextChanged += (sender, arguments) => { if (_selectScript != null) { _selectScript.RectShape.Position = new Vector2f((int) _uiInfoTextBoxPosX.Value, _selectScript.RectShape.Position.Y); } }; Align.PlaceRightBottom(_uiInfoTextBoxPosX, labelX, 10); var labelY = new Label(_windowInfoScript); labelY.SetText("Y :"); Align.PlaceDownLeft(labelY, labelX, 10); _uiInfoTextBoxPosY = new TextBoxNumeric(_windowInfoScript); _uiInfoTextBoxPosY.SetSize(100, _uiInfoTextBoxPosY.Height); _uiInfoTextBoxPosY.TextChanged += (sender, arguments) => { if (_selectScript != null) { _selectScript.RectShape.Position = new Vector2f(_selectScript.RectShape.Position.X, (int) _uiInfoTextBoxPosY.Value); } }; Align.PlaceRightBottom(_uiInfoTextBoxPosY, labelY, 10); var labelSizeX = new Label(_windowInfoScript); labelSizeX.SetText("Largeur :"); Align.PlaceDownLeft(labelSizeX, labelY, 10); _uiInfoTextBoxSizeX = new TextBoxNumeric(_windowInfoScript); _uiInfoTextBoxSizeX.SetSize(100, _uiInfoTextBoxPosY.Height); _uiInfoTextBoxSizeX.TextChanged += (sender, arguments) => { if (_selectScript != null) { _selectScript.RectShape.Size = new Vector2f((int)_uiInfoTextBoxSizeX.Value, _selectScript.RectShape.Size.Y); _selectScript.RectShape.Origin = new Vector2f(_selectScript.RectShape.Size.X / 2, _selectScript.RectShape.Size.Y / 2); } }; Align.PlaceRightBottom(_uiInfoTextBoxSizeX, labelSizeX, 10); var labelSizeY = new Label(_windowInfoScript); labelSizeY.SetText("Hauteur :"); Align.PlaceDownLeft(labelSizeY, labelSizeX, 10); _uiInfoTextBoxSizeY = new TextBoxNumeric(_windowInfoScript); _uiInfoTextBoxSizeY.SetSize(100, _uiInfoTextBoxSizeY.Height); _uiInfoTextBoxSizeY.TextChanged += (sender, arguments) => { if (_selectScript != null) { _selectScript.RectShape.Size = new Vector2f(_selectScript.RectShape.Size.X, (int)_uiInfoTextBoxSizeY.Value); _selectScript.RectShape.Origin = new Vector2f(_selectScript.RectShape.Size.X / 2, _selectScript.RectShape.Size.Y / 2); } }; Align.PlaceRightBottom(_uiInfoTextBoxSizeY, labelSizeY, 10); _uiInfoScriptImage = new ImagePanel(_windowInfoScript); _uiInfoScriptImage.SetSize(75, 75); _uiInfoScriptImage.Hide(); Align.PlaceDownLeft(_uiInfoScriptImage, _uiInfoTextBoxSizeY, 10); Align.CenterHorizontally(_uiInfoScriptImage); UnSelect_SelectScript(); }
public Screen_Settings(Base parent) : base(parent) { SetSize(parent.Width, parent.Height); Gwen.Control.Label label = new Gwen.Control.Label(this); label.Text = "Settings"; label.SetPosition(30, 30); label.TextColor = Color.FromArgb(200, 80, 0, 250); label.Font = Program.fontLogo; Gwen.Control.WindowControl settingsWindow = new Gwen.Control.WindowControl(this); settingsWindow.Width = parent.Width / 2; settingsWindow.Height = parent.Height / 2; settingsWindow.SetPosition(parent.Width / 2 - settingsWindow.Width / 2, parent.Height / 2 - settingsWindow.Height / 2); Gwen.Control.Label musicLabel = new Gwen.Control.Label(settingsWindow); musicLabel.Text = "Music:"; musicLabel.SetPosition(parent.Width / 10, parent.Height / 10); musicLabel.TextColor = Color.FromArgb(255, 0, 0, 0); musicLabel.Font = Program.fontText; Gwen.Control.HorizontalSlider musicSlider = new Gwen.Control.HorizontalSlider(settingsWindow); musicSlider.SetPosition(parent.Width / 5, parent.Height / 10); musicSlider.SetSize(parent.Width / 10, musicLabel.Height); Gwen.Control.Label sfxLabel = new Gwen.Control.Label(settingsWindow); sfxLabel.Text = "SFX:"; sfxLabel.SetPosition(parent.Width / 10, musicLabel.Y + musicLabel.Height); sfxLabel.TextColor = Color.FromArgb(255, 0, 0, 0); sfxLabel.Font = Program.fontText; Gwen.Control.CheckBox sfxCheckBox = new Gwen.Control.CheckBox(settingsWindow); sfxCheckBox.SetPosition(parent.Width / 5, musicLabel.Y + musicLabel.Height); Gwen.Control.Label fpsLabel = new Gwen.Control.Label(settingsWindow); fpsLabel.Text = "FPS Limit:"; fpsLabel.SetPosition(parent.Width / 10, sfxLabel.Y + sfxLabel.Height); fpsLabel.TextColor = Color.FromArgb(255, 0, 0, 0); fpsLabel.Font = Program.fontText; Gwen.Control.HorizontalSlider fpsSlider = new Gwen.Control.HorizontalSlider(settingsWindow); fpsSlider.SetPosition(parent.Width / 5, sfxLabel.Y + sfxLabel.Height); fpsSlider.SetSize(parent.Width / 10, sfxLabel.Height); Gwen.Control.Label resolutionLabel = new Gwen.Control.Label(settingsWindow); resolutionLabel.Text = "Resolution:"; resolutionLabel.SetPosition(parent.Width / 10, fpsLabel.Y + fpsLabel.Height); resolutionLabel.TextColor = Color.FromArgb(255, 0, 0, 0); resolutionLabel.Font = Program.fontText; Gwen.Control.ComboBox resolution = new ComboBox(settingsWindow); resolution.AddItem("800x600"); resolution.AddItem("1024x768"); resolution.SetPosition(parent.Width / 5, fpsLabel.Y + fpsLabel.Height); resolution.SetSize(parent.Width / 10, resolutionLabel.Height); Gwen.Control.Label fullScreenLabel = new Gwen.Control.Label(settingsWindow); fullScreenLabel.Text = "Full screen:"; fullScreenLabel.SetPosition(parent.Width / 10, resolutionLabel.Y + resolutionLabel.Height); fullScreenLabel.TextColor = Color.FromArgb(255, 0, 0, 0); fullScreenLabel.Font = Program.fontText; Gwen.Control.CheckBox fullScreenCheckBox = new Gwen.Control.CheckBox(settingsWindow); fullScreenCheckBox.SetPosition(parent.Width / 5, resolutionLabel.Y + resolutionLabel.Height); if (fullScreen == true) { fullScreenCheckBox.Toggle(); } fullScreenCheckBox.Checked += fullScreenEnable; fullScreenCheckBox.UnChecked += fullScreenDisable; Gwen.Control.Button buttonOK = new Gwen.Control.Button(this); buttonOK.Text = "OK"; buttonOK.Font = Program.fontButtonLabels; buttonOK.SetBounds(550, 500, 200, 50); buttonOK.Clicked += onButtonOKClick; }
public SettingsMenu (Application app, Base parent, CompositorColorCorrectionNode colorCorrectionNode) { this.application = app; this.parent = parent; this.colorCorrectionNode = colorCorrectionNode; window = new WindowControl (parent); window.DisableResizing(); window.Title = Localizer.Instance.GetValueForName("settings"); window.Hide(); float gamma = (float) ConfigManager.Instance["freezing_archer"].GetDouble("general", "gamma"); colorCorrectionNode.Gamma = gamma; string language = ConfigManager.Instance["freezing_archer"].GetString("general", "language"); Localizer.Instance.CurrentLocale = (LocaleEnum) Enum.Parse(typeof (LocaleEnum), language); languageLabel = new Label (window); languageLabel.AutoSizeToContents = true; languageLabel.Y = 10; languageLabel.Text = Localizer.Instance.GetValueForName("language"); languageDropdown = new ComboBox (window); languageDropdown.Width = CONTROL_WIDTH; languageDropdown.Y = 10; foreach (var lang in Localizer.Instance.Locales) { var item = languageDropdown.AddItem(Localizer.Instance.GetValueForName(lang.Key.ToString()), lang.Key.ToString()); item.AutoSizeToContents = false; item.Width = CONTROL_WIDTH; } languageDropdown.SelectByText(Localizer.Instance.GetValueForName(Localizer.Instance.CurrentLocale.ToString())); languageDropdown.ItemSelected += handleSelect; gammaSlider = new HorizontalSlider (window); gammaSlider.SnapToNotches = false; gammaSlider.Min = 0; gammaSlider.Max = 3; gammaSlider.Value = gamma; gammaSlider.ValueChanged += (sender, arguments) => { var slider = sender as HorizontalSlider; ConfigManager.Instance["freezing_archer"].SetDouble("general", "gamma", slider.Value); if (slider != null) this.colorCorrectionNode.Gamma = slider.Value; }; gammaSlider.Width = CONTROL_WIDTH; gammaSlider.Height = 20; gammaSlider.Y = 10 + languageDropdown.Y + languageDropdown.Height; gammaLabel = new Label (window); gammaLabel.AutoSizeToContents = true; gammaLabel.Y = 10 + languageLabel.Y + languageLabel.Height; gammaLabel.Text = Localizer.Instance.GetValueForName("gamma"); int max_width = languageLabel.Width > gammaLabel.Width ? languageLabel.Width : gammaLabel.Width; languageLabel.X = 10 + max_width - languageLabel.Width; gammaLabel.X = 10 + max_width - gammaLabel.Width; languageDropdown.X = 10 + max_width + 5; gammaSlider.X = 10 + max_width + 5; window.Width = 40 + max_width + CONTROL_WIDTH; resetButton = new Button (window); resetButton.Text = Localizer.Instance.GetValueForName("reset"); resetButton.Width = (window.Width / 2) - 20; resetButton.X = 10; resetButton.Y = gammaSlider.Y + gammaSlider.Height + 10; resetButton.Clicked += (sender, arguments) => { var general = ConfigManager.DefaultConfig.B.FirstOrDefault (a => a.Key == "general"); var gamma_pair = general.Value.FirstOrDefault(a => a.Key == "gamma"); float _gamma = (float) gamma_pair.Value.Double; gammaSlider.Value = _gamma; colorCorrectionNode.Gamma = _gamma; var language_pair = general.Value.FirstOrDefault(a => a.Key == "language"); string lang = language_pair.Value.String; Localizer.Instance.CurrentLocale = (LocaleEnum) Enum.Parse(typeof (LocaleEnum), lang); }; saveButton = new Button (window); saveButton.Text = Localizer.Instance.GetValueForName("save"); saveButton.Width = (window.Width / 2) - 20; saveButton.X = resetButton.X + resetButton.Width + 10; saveButton.Y = gammaSlider.Y + gammaSlider.Height + 10; saveButton.Clicked += (sender, arguments) => ConfigManager.Instance.SaveAll(); window.Height += languageDropdown.Height + gammaSlider.Height + 50; window.X = (parent.Width - window.Width) / 2; window.Y = (parent.Height - window.Height) / 2; ValidMessages = new[] { (int) MessageId.UpdateLocale }; application.MessageManager += this; }
public void ConsumeMessage (IMessage msg) { if (msg.MessageId == (int) MessageId.GameEnded || msg.MessageId == (int)MessageId.GameEndedDied) { Application.Window.ReleaseMouse (); Canvas = Renderer.Canvas; Canvas.DeleteAllChildren(); minuteCount = (float) (DateTime.Now - MazeTest.StartTime).TotalMinutes; exitButton = new Button (Canvas); exitButton.Text = Localizer.Instance.GetValueForName("quit_game"); exitButton.Width = 300; exitButton.X = (Canvas.Width - exitButton.Width) / 2; exitButton.Y = Canvas.Height - exitButton.Height - 20; exitButton.Clicked += (sender, arguments) => Application.Window.Close (); surviveTimeLabel = new Label (Canvas); surviveTimeLabel.AutoSizeToContents = true; surviveTimeLabel.Text = string.Format("{0} {1:0.##} {2}", Localizer.Instance.GetValueForName("you_survived"), minuteCount, Localizer.Instance.GetValueForName("minutes")); surviveTimeLabel.X = (Canvas.Width - surviveTimeLabel.Width) / 2; surviveTimeLabel.Y = exitButton.Y - surviveTimeLabel.Height - 40; labelWin = new ImagePanel (Canvas); labelWin.Width = 1211; labelWin.Height = 170; labelWin.X = (Canvas.Width - labelWin.Width) / 2; labelWin.Y = 100; labelWin.ImageName = "Content/YouEscapedTheMaze.png"; labelWin.Hide(); labelWin_de = new ImagePanel (Canvas); labelWin_de.Width = 1211; labelWin_de.Height = 170; labelWin_de.X = (Canvas.Width - labelWin_de.Width) / 2; labelWin_de.Y = 100; labelWin_de.ImageName = "Content/YouEscapedTheMaze_de.png"; labelWin_de.Hide(); labelLoose = new ImagePanel (Canvas); labelLoose.Width = 845; labelLoose.Height = 168; labelLoose.X = (Canvas.Width - labelLoose.Width) / 2; labelLoose.Y = 100; labelLoose.ImageName = "Content/YouAreDead.png"; labelLoose.Hide(); labelLoose_de = new ImagePanel (Canvas); labelLoose_de.Width = 845; labelLoose_de.Height = 168; labelLoose_de.X = (Canvas.Width - labelLoose_de.Width) / 2; labelLoose_de.Y = 100; labelLoose_de.ImageName = "Content/YouAreDead_de.png"; labelLoose_de.Hide(); if (msg.MessageId == (int) MessageId.GameEndedDied) { if (Localizer.Instance.CurrentLocale == LocaleEnum.de_DE) { labelLoose_de.Show(); } else { labelLoose.Show(); } win = false; } else { if (Localizer.Instance.CurrentLocale == LocaleEnum.de_DE) { labelWin_de.Show(); } else { labelWin.Show(); } win = true; } } if (msg.MessageId == (int) MessageId.WindowResize) { if (exitButton != null) { exitButton.X = (Canvas.Width - exitButton.Width) / 2; exitButton.Y = Canvas.Height - exitButton.Height - 20; } if (surviveTimeLabel != null) { surviveTimeLabel.X = (Canvas.Width - surviveTimeLabel.Width) / 2; surviveTimeLabel.Y = exitButton.Y - surviveTimeLabel.Height - 40; } if (labelWin != null) labelWin.X = (Canvas.Width - labelWin.Width) / 2; if (labelWin_de != null) labelWin_de.X = (Canvas.Width - labelWin_de.Width) / 2; if (labelLoose != null) labelLoose.X = (Canvas.Width - labelLoose.Width) / 2; if (labelLoose_de != null) labelLoose_de.X = (Canvas.Width - labelLoose_de.Width) / 2; } if (msg.MessageId == (int) MessageId.UpdateLocale) { surviveTimeLabel.Text = string.Format("{0} {1:#.##} {2}", Localizer.Instance.GetValueForName("you_survived"), minuteCount, Localizer.Instance.GetValueForName("minutes")); exitButton.Text = Localizer.Instance.GetValueForName("quit_game"); if (Localizer.Instance.CurrentLocale == LocaleEnum.de_DE) { if (win && labelWin != null && labelWin_de != null) { labelWin.Hide(); labelWin_de.Show(); } else if (labelLoose != null && labelLoose_de != null) { labelLoose.Hide(); labelLoose_de.Show(); } } else { if (win && labelWin != null && labelWin_de != null) { labelWin_de.Hide(); labelWin.Show(); } else if (labelLoose != null && labelLoose_de != null) { labelLoose_de.Hide(); labelLoose.Show(); } } } }
private void ShowSelectLevelUi(Canvas canvas) { var window = new WindowControl(canvas, "Choisir un niveau", true); window.DisableResizing(); window.SetSize(300, 400); window.SetPosition(Game.GetWindowSize().X /2 - window.Width / 2, Game.GetWindowSize().Y / 2 - window.Height / 2); var listLevel = new ListBox(window); listLevel.SetSize(window.Width / 2, window.Height - 40); if (Directory.Exists(_levelsPath)) { foreach (var file in Directory.EnumerateFiles(_levelsPath)) { var fileInfo = new FileInfo(file); if (fileInfo.Extension.Equals(".mtrlvl")) { listLevel.AddRow(fileInfo.Name.Remove(fileInfo.Name.LastIndexOf('.')), fileInfo.Name, file); } } } var widthButton = window.Width - listLevel.Width - 30; var playButton = new Button(window); playButton.SetText("Jouer"); playButton.SetPosition(listLevel.Width + 10, 0); playButton.SetSize(widthButton, playButton.Height); playButton.Clicked += (sender, arguments) => { LoadLevel(listLevel, canvas, false); }; var deleteLevelButton = new Button(window); deleteLevelButton.SetText("Supprimer"); deleteLevelButton.SetSize(widthButton, deleteLevelButton.Height); deleteLevelButton.Clicked += (sender, arguments) => { if (listLevel.SelectedRowIndex == -1) new MessageBox(canvas, "Aucun niveau n'a été sélectionné !", "Erreur !").Show(); else { var path = listLevel.SelectedRow.UserData.ToString(); try { File.Delete(path); listLevel.RemoveRow(listLevel.SelectedRowIndex); listLevel.SelectedRow = null; Log.WriteInfo("Le niveau : " + path + " a été supprimé !"); } catch (IOException e) { new MessageBox(canvas, "Impossible de supprimer le niveau sélectionné ! Erreur : " + e.Message, "Erreur !").Show(); } } }; Align.PlaceDownLeft(deleteLevelButton, playButton, 10); var editLevelButton = new Button(window); editLevelButton.SetText("Editer le niveau"); editLevelButton.SetSize(widthButton, editLevelButton.Height); editLevelButton.Clicked += (sender, arguments) => { LoadLevel(listLevel, canvas, true); }; Align.PlaceDownLeft(editLevelButton, deleteLevelButton, 10); var newLevelButton = new Button(window); newLevelButton.SetText("Nouveau niveau"); newLevelButton.SetSize(widthButton, newLevelButton.Height); Align.PlaceDownLeft(newLevelButton, editLevelButton, 10); }
public void Init(Base parent, Inventory inventory) { this.inventory = inventory; Item_Text = new Gwen.ControlInternal.Text (parent); Item_Text.Font = new Gwen.Font (application.RendererContext.GwenRenderer); Item_Text.Y = 5; Item_Text.Font.Size = 15; spaces = new InventorySpace[inventory.Size.X, inventory.Size.Y]; barItems = new List<InventoryBarButton>(); canvasFrame = new InventoryBackground(parent, inventory, this); canvasFrame.Width = parent.Width; canvasFrame.Height = parent.Height; window = new WindowControl (canvasFrame, Localizer.Instance.GetValueForName("inventory")); window.DisableResizing (); window.IsMoveable = false; window.OnClose += (sender, arguments) => application.Window.CaptureMouse (); itemGridFrame = new Base (window); itemGridFrame.SetSize ((BoxSize + 1) * inventory.Size.X, (BoxSize + 1) * inventory.Size.Y); bla_unfug_crosshair = new ImagePanel (canvasFrame); bla_unfug_crosshair.SetSize (16, 16); bla_unfug_crosshair.ImageName = "Content/crosshair.png"; bla_unfug_crosshair.SetPosition ((canvasFrame.Width / 2.0f) - (bla_unfug_crosshair.Width / 2.0f), (canvasFrame.Height / 2.0f) - (bla_unfug_crosshair.Width / 2.0f)); bla_unfug_crosshair.BringToFront (); itemInfoFrame = new Base (window); itemInfoFrame.SetSize (infoFrameSize, itemGridFrame.Height); itemGridFrame.X += itemInfoFrame.Width + 4; toolbarFrame = new Base(window); toolbarFrame.Width = itemGridFrame.Width + itemInfoFrame.Width; toolbarFrame.Height = toolbarFrameSize; toolbarFrame.Y = itemGridFrame.Height - 4; dropBtn = new Button(toolbarFrame); dropBtn.AutoSizeToContents = true; dropBtn.Padding = btnPadding; dropBtn.Text = Localizer.Instance.GetValueForName("drop"); dropBtn.X = toolbarFrame.Width - dropBtn.Width; dropBtn.Y = (toolbarFrameSize - dropBtn.Height) / 2; dropBtn.IsDisabled = true; dropBtn.Clicked += (sender, arguments) => { if (dropBtn.IsDisabled) return; if (toggledBtn != null) { dropItem(toggledBtn, toggledBtn.Item, inventory); } }; useBtn = new Button(toolbarFrame); useBtn.AutoSizeToContents = true; useBtn.Padding = btnPadding; useBtn.Text = Localizer.Instance.GetValueForName("use"); useBtn.X = dropBtn.X - useBtn.Width - 8; useBtn.Y = (toolbarFrameSize - useBtn.Height) / 2; useBtn.IsDisabled = true; useBtn.Clicked += (sender, arguments) => { if (useBtn.IsDisabled) return; if (toggledBtn != null) { if (MessageCreated != null) MessageCreated(new ItemUseMessage(player, GameState.Scene, toggledBtn.Item, ItemUsage.Eatable)); } }; rotateBtn = new Button(toolbarFrame); rotateBtn.AutoSizeToContents = true; rotateBtn.Padding = btnPadding; rotateBtn.Text = Localizer.Instance.GetValueForName("rotate"); rotateBtn.X = useBtn.X - rotateBtn.Width - 8; rotateBtn.Y = (toolbarFrameSize - rotateBtn.Height) / 2; rotateBtn.IsDisabled = true; rotateBtn.Clicked += (sender, argument) => { if (rotateBtn.IsDisabled) return; var pos = inventory.GetPositionOfItem(toggledBtn.Item); var item = inventory.TakeOut(pos); var prev_orientation = item.Orientation; item.Orientation = item.Orientation == Orientation.Horizontal ? Orientation.Vertical : Orientation.Horizontal; if (!inventory.Insert(item, pos)) { item.Orientation = prev_orientation; if (!inventory.Insert(item, pos)) { Logger.Log.AddLogEntry(LogLevel.Error, "InventoryGUI", "Lost an inventory item while rotating!"); toggledBtn.DelayedDelete(); toggledBtn = null; return; } } toggledBtn.UpdateSize(); }; inventoryBar = new TextBox(canvasFrame); inventoryBar.Disable(); inventoryBar.KeyboardInputEnabled = false; inventoryBar.Height = barBoxSize + 2; inventoryBar.Width = barBoxSize * inventory.InventoryBar.Length + 1; inventoryBar.Y = canvasFrame.Height - inventoryBar.Height; inventoryBar.X = (canvasFrame.Width - inventoryBar.Width) / 2; barSpaces = new InventoryBarSpace[inventory.InventoryBar.Length]; for (int i = 0; i < inventory.InventoryBar.Length; i++) { barSpaces[i] = new InventoryBarSpace(inventoryBar, MessageProvider, inventory, this, barItems, barBoxSize); barSpaces[i].X = i * barBoxSize; barSpaces[i].Y = 1; barSpaces[i].Width = barBoxSize + 1; barSpaces[i].Height = barBoxSize + 1; barSpaces[i].DrawDebugOutlines = false; if (i == inventory.ActiveBarPosition) { barSpaces[i].DrawDebugOutlines = true; barSpaces[i].Children.ForEach(c => c.DrawDebugOutlines = false); } } window.SetSize (itemGridFrame.Width + itemInfoFrame.Width + 16, itemGridFrame.Height + toolbarFrameSize + 28); window.SetPosition ((canvasFrame.Width - window.Width) / 2, (canvasFrame.Height - window.Height - inventoryBar.Height) / 2); window.Hide(); int w = 0, h = 0; for (int y = 0; y < inventory.Size.Y; y++) { for (int x = 0; x < inventory.Size.X; x++) { spaces [x, y] = new InventorySpace (itemGridFrame, BoxSize, inventory); spaces [x, y].X = w; spaces [x, y].Y = h; spaces [x, y].Width = BoxSize + 1; spaces [x, y].Height = BoxSize + 1; w += BoxSize; } h += BoxSize; w = 0; } imagePanel = new ImagePanel(itemInfoFrame); imagePanel.Width = infoFrameSize; imagePanelHeight = itemGridFrame.Height / 3; imagePanel.Hide(); items = new List<InventoryButton>(); inventory.Items.ForEach((item, position) => { AddItem(item, position); }); }
public static void Main(string[] args) { g_testEntries = AllTests.GetTests(); testCount = g_testEntries.Count(); testIndex = Math.Max(0, Math.Min(testIndex, testCount - 1)); testSelection = testIndex; entry = g_testEntries[testIndex]; test = entry.createFcn(); GraphicsManager.SetWindowState(OpenTK.WindowState.Maximized); string title = String.Format("Box2D Version {0}.{1}.{2}", Settings._version.major, Settings._version.minor, Settings._version.revision); GraphicsManager.SetTitle(title); camera = new Camera2D(); camera.OnRender += SimulationLoop; camera.SetZoom(12); camera.CenterOnTarget(true); camera.SetLocation(0, 0); GraphicsManager.Update += new GraphicsManager.Updater(GraphicsManager_Update); WindowControl glui = new WindowControl(MainCanvas.GetCanvas()); glui.Dock = Gwen.Pos.Left; Label text = new Label(glui); text.Text = "Tests"; text.SetPosition(10, 10); testList = new ListBox(glui); testList.RowSelected += delegate(Base sender, ItemSelectedEventArgs tlargs) { testSelection = testList.SelectedRowIndex; }; foreach (TestEntry e in g_testEntries) { testList.AddRow(e.name, "", e); } testList.SelectedRowIndex = testSelection; testList.SetPosition(10, 30); testList.SetSize(170, 180); //glui.add_separator(); Base SettingsBox = new Base(glui); SettingsBox.SetSize(200, 185); SettingsBox.SetPosition(0, 250); { NumericUpDown spinner = new NumericUpDown(SettingsBox); spinner.Text = "Vel Iters"; spinner.Min = 1; spinner.Max = 500; spinner.ValueChanged += delegate(Base sender, EventArgs vcargs) { settings.velocityIterations = (int)spinner.Value; }; spinner.Value = settings.velocityIterations; spinner.SetPosition(10, 10); NumericUpDown posSpinner = new NumericUpDown(SettingsBox); posSpinner.Min = 0; posSpinner.Max = 100; posSpinner.Text = "Pos Iters"; posSpinner.ValueChanged += delegate(Base sender, EventArgs psargs) { settings.positionIterations = (int)posSpinner.Value; }; posSpinner.Value = settings.positionIterations; posSpinner.SetPosition(10, 35); NumericUpDown hertzSpinner = new NumericUpDown(SettingsBox); hertzSpinner.Text = "Hertz"; hertzSpinner.Min = 5; hertzSpinner.Max = 200; hertzSpinner.ValueChanged += delegate(Base sender, EventArgs hargs) { settingsHz = hertzSpinner.Value; }; hertzSpinner.Value = settingsHz; hertzSpinner.SetPosition(10, 60); LabeledCheckBox scb = new LabeledCheckBox(SettingsBox); scb.Text = "Sleep"; scb.CheckChanged += delegate(Base sender, EventArgs argsscb) { settings.enableSleep = scb.IsChecked; }; scb.IsChecked = settings.enableSleep; scb.SetPosition(10, 85); LabeledCheckBox wsu = new LabeledCheckBox(SettingsBox); wsu.Text = "Warm Starting"; wsu.CheckChanged += delegate(Base sender, EventArgs argsscb) { settings.enableWarmStarting = wsu.IsChecked; }; wsu.IsChecked = settings.enableWarmStarting; wsu.SetPosition(10, 110); LabeledCheckBox toi = new LabeledCheckBox(SettingsBox); toi.Text = "Time of Impact"; toi.CheckChanged += delegate(Base sender, EventArgs argsscb) { settings.enableContinuous = toi.IsChecked; }; toi.IsChecked = settings.enableContinuous; toi.SetPosition(10, 135); LabeledCheckBox ssb = new LabeledCheckBox(SettingsBox); ssb.Text = "Sub-Stepping"; ssb.CheckChanged += delegate(Base sender, EventArgs argsscb) { settings.enableSubStepping = ssb.IsChecked; }; ssb.IsChecked = settings.enableSubStepping; ssb.SetPosition(10, 160); } Base drawPanel = new Base(glui); drawPanel.Dock = Gwen.Pos.Bottom; drawPanel.SetSize(200, 225); { LabeledCheckBox cbShapes = new LabeledCheckBox(drawPanel); cbShapes.Text = "Shapes"; cbShapes.IsChecked = settings.drawShapes; cbShapes.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawShapes = cbShapes.IsChecked; }; cbShapes.SetPosition(10, 10); //glui.add_checkbox_to_panel(drawPanel, "Joints", &settings.drawJoints); LabeledCheckBox cbJoints = new LabeledCheckBox(drawPanel); cbJoints.Text = "Joints"; cbJoints.IsChecked = settings.drawJoints; cbJoints.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawJoints = cbJoints.IsChecked; }; cbJoints.SetPosition(10, 30); //glui.add_checkbox_to_panel(drawPanel, "AABBs", &settings.drawAABBs); LabeledCheckBox cbAABBs = new LabeledCheckBox(drawPanel); cbAABBs.Text = "AABBs"; cbAABBs.IsChecked = settings.drawAABBs; cbAABBs.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawAABBs = cbAABBs.IsChecked; }; cbAABBs.SetPosition(10, 50); //glui.add_checkbox_to_panel(drawPanel, "Contact Points", &settings.drawContactPoints); LabeledCheckBox cbPoints = new LabeledCheckBox(drawPanel); cbPoints.Text = "Contact Points"; cbPoints.IsChecked = settings.drawContactPoints; cbPoints.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawContactPoints = cbPoints.IsChecked; }; cbPoints.SetPosition(10, 70); //glui.add_checkbox_to_panel(drawPanel, "Contact Normals", &settings.drawContactNormals); LabeledCheckBox cbNormals = new LabeledCheckBox(drawPanel); cbNormals.Text = "Contact Normals"; cbNormals.IsChecked = settings.drawContactNormals; cbNormals.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawContactNormals = cbNormals.IsChecked; }; cbNormals.SetPosition(10, 90); //glui.add_checkbox_to_panel(drawPanel, "Contact Impulses", &settings.drawContactImpulse); LabeledCheckBox cbImpulses = new LabeledCheckBox(drawPanel); cbImpulses.Text = "Contact Impulses"; cbImpulses.IsChecked = settings.drawContactImpulse; cbImpulses.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawContactImpulse = cbImpulses.IsChecked; }; cbImpulses.SetPosition(10, 110); //glui.add_checkbox_to_panel(drawPanel, "Friction Impulses", &settings.drawFrictionImpulse); LabeledCheckBox cbFriction = new LabeledCheckBox(drawPanel); cbFriction.Text = "Friction Impulses"; cbFriction.IsChecked = settings.drawFrictionImpulse; cbFriction.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawFrictionImpulse = cbFriction.IsChecked; }; cbFriction.SetPosition(10, 130); //glui.add_checkbox_to_panel(drawPanel, "Center of Masses", &settings.drawCOMs); LabeledCheckBox cbMasses = new LabeledCheckBox(drawPanel); cbMasses.Text = "Center of Masses"; cbMasses.IsChecked = settings.drawCOMs; cbMasses.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawCOMs = cbMasses.IsChecked; }; cbMasses.SetPosition(10, 150); //glui.add_checkbox_to_panel(drawPanel, "Statistics", &settings.drawStats); LabeledCheckBox cbStatistics = new LabeledCheckBox(drawPanel); cbStatistics.Text = "Statistics"; cbStatistics.IsChecked = settings.drawStats; cbStatistics.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawStats = cbStatistics.IsChecked; }; cbStatistics.SetPosition(10, 170); //glui.add_checkbox_to_panel(drawPanel, "Profile", &settings.drawProfile); LabeledCheckBox cbProfile = new LabeledCheckBox(drawPanel); cbProfile.Text = "Profile"; cbProfile.IsChecked = settings.drawProfile; cbProfile.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawProfile = cbProfile.IsChecked; }; cbProfile.SetPosition(10, 190); } Base Buttons = new Base(glui); Buttons.Dock = Gwen.Pos.Bottom; Buttons.Height = 100; { Button btnPause = new Button(Buttons); btnPause.Text = "Pause"; btnPause.IsToggle = true; btnPause.SetPosition(10, 10); btnPause.ToggleState = settings.pause; btnPause.Clicked += delegate(Base sender, ClickedEventArgs evargs) { settings.pause = btnPause.ToggleState; }; Button btnSS = new Button(Buttons); btnSS.Text = "Single Step"; btnSS.SetPosition(10, 40); btnSS.Clicked += delegate(Base sender, ClickedEventArgs evargs) { SingleStep(); }; Button btnRestart = new Button(Buttons); btnRestart.Text = "Restart"; btnRestart.SetPosition(10, 70); btnRestart.Clicked += delegate(Base sender, ClickedEventArgs evargs) { Restart(); }; } glui.SetSize(200, 300); GraphicsManager.Start(); }
Base ConstructMainMenu() { Base MainMenu = new Base(MainCanvas.GetCanvas()); MainMenu.SetSize(300, 300); MainMenu.Dock = Gwen.Pos.Center; Button SinglePlayer = new Button(MainMenu); SinglePlayer.SetText("Single Player"); SinglePlayer.SetPosition(10, 10); SinglePlayer.SetSize(220, 20); //SinglePlayer.Clicked += delegate(Base caller) { // Mode = SINGLEPLAYER; // MainMenu.Hide(); //}; SinglePlayer.Disable(); Button JoinGame = new Button(MainMenu); JoinGame.SetText("Join Game"); JoinGame.SetPosition(10, 70); JoinGame.SetSize(220, 20); JoinGame.Clicked += delegate(Base sender, ClickedEventArgs args) { MainMenu.Hide(); FindGame.Show(); Mode = MenuMode.JoiningGame; }; Button Quit = new Button(MainMenu); Quit.SetText("Quit"); Quit.SetPosition(10, 100); Quit.SetSize(220, 20); Quit.Clicked += delegate(Base sender, ClickedEventArgs args) { MainCanvas.Dispose(); Environment.Exit(0); }; return MainMenu; }