public MainScreen(IDictionary <Type, object> managers) : base(managers) { _background = ResourceManager.GetSprite("mainbg_filler"); _background.Smoothing = Smoothing.Smooth; _btnConnect = new ImageButton { ImageNormal = "connect_norm", ImageHover = "connect_hover" }; _btnConnect.Clicked += _buttConnect_Clicked; _btnOptions = new ImageButton { ImageNormal = "options_norm", ImageHover = "options_hover" }; _btnOptions.Clicked += _buttOptions_Clicked; _btnExit = new ImageButton { ImageNormal = "exit_norm", ImageHover = "exit_hover" }; _btnExit.Clicked += _buttExit_Clicked; _txtConnect = new Textbox(100, ResourceManager) { Text = ConfigurationManager.GetServerAddress() }; _txtConnect.OnSubmit += ConnectTextboxOnSubmit; Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); _lblVersion = new Label("v. " + fvi.FileVersion, "CALIBRI", ResourceManager); _lblVersion.Text.Color = Color.WhiteSmoke; _lblVersion.Position = new Point(Gorgon.Screen.Width - _lblVersion.ClientArea.Width - 3, Gorgon.Screen.Height - _lblVersion.ClientArea.Height - 3); _imgTitle = new SimpleImage { Sprite = "SpaceStationLogoColor", Position = new Point(Gorgon.Screen.Width - 550, 100) }; _lblVersion.Update(0); _imgTitle.Update(0); _txtConnect.Position = new Point(_imgTitle.ClientArea.Left + 40, _imgTitle.ClientArea.Bottom + 50); _txtConnect.Update(0); _btnConnect.Position = new Point(_txtConnect.Position.X, _txtConnect.ClientArea.Bottom + 20); _btnConnect.Update(0); _btnOptions.Position = new Point(_btnConnect.Position.X, _btnConnect.ClientArea.Bottom + 20); _btnOptions.Update(0); _btnExit.Position = new Point(_btnOptions.Position.X, _btnOptions.ClientArea.Bottom + 20); _btnExit.Update(0); }
public void FormResize() { _Width = (int)CluwneLib.Screen.Size.X; _Height = (int)CluwneLib.Screen.Size.Y; _lblVersion.Update(0); _imgTitle.Update(0); _btnExit.Update(0); _btnOptions.Update(0); _btnConnect.Update(0); _txtConnect.Update(0); }
public void UpdateGUIPosition() { _imgMainBg.Position = new Vector2i( (int)((CluwneLib.Screen.Size.X / 2f) - (_imgMainBg.ClientArea.Width / 2f)), (int)((CluwneLib.Screen.Size.Y / 2f) - (_imgMainBg.ClientArea.Height / 2f))); _imgMainBg.Update(0); _recStatus = new FloatRect(_imgMainBg.Position.X + 10, _imgMainBg.Position.Y + 63, 785, 21); _imgStatus.Position = new Vector2i((int)_recStatus.Left, (int)_recStatus.Top); _imgStatus.Update(0); _lblServer.Position = new Vector2i((int)_recStatus.Left + 5, (int)_recStatus.Top + 2); _lblServer.Update(0); _lblServerInfo.Position = new Vector2i(_lblServer.ClientArea.Right(), _lblServer.ClientArea.Top); _lblServerInfo.Update(0); _lblMode.Position = new Vector2i(_lblServerInfo.ClientArea.Right() + (int)_lastLblSpacing, _lblServerInfo.ClientArea.Top); _lblMode.Update(0); _lblModeInfo.Position = new Vector2i(_lblMode.ClientArea.Right(), _lblMode.ClientArea.Top); _lblModeInfo.Update(0); _lblPlayers.Position = new Vector2i(_lblModeInfo.ClientArea.Right() + (int)_lastLblSpacing, _lblModeInfo.ClientArea.Top); _lblPlayers.Update(0); _lblPlayersInfo.Position = new Vector2i(_lblPlayers.ClientArea.Right(), _lblPlayers.ClientArea.Top); _lblPlayersInfo.Update(0); _lblPort.Position = new Vector2i(_lblPlayersInfo.ClientArea.Right() + (int)_lastLblSpacing, _lblPlayersInfo.ClientArea.Top); _lblPort.Update(0); _lblPortInfo.Position = new Vector2i(_lblPort.ClientArea.Right(), _lblPort.ClientArea.Top); _lblPortInfo.Update(0); _tabs.Position = _imgMainBg.Position + new Vector2i(5, 90); _tabs.Update(0); _lobbyChat.Position = new Vector2i(_imgMainBg.ClientArea.Left + 12, _imgMainBg.ClientArea.Bottom() - _lobbyChat.ClientArea.Height - 12); //Wish the chat box wasnt such shit. Then i wouldnt have to do this here. _lobbyChat.Update(0); _imgChatBg.Position = new Vector2i(_lobbyChat.ClientArea.Left - 6, _lobbyChat.ClientArea.Top - 9); _imgChatBg.Update(0); _btnReady.Position = new Vector2i(_lobbyChat.ClientArea.Right() - _btnReady.ClientArea.Width - 5, _lobbyChat.ClientArea.Top - _btnReady.ClientArea.Height - 8); _btnReady.Update(0); }
public void FormResize() { _Width = (int)CluwneLib.Screen.Size.X; _Height = (int)CluwneLib.Screen.Size.Y; _background.Scale = new Vector2f((float)_Width / _background.TextureRect.Width, (float)_Height / _background.TextureRect.Height); _lblVersion.Position = new Vector2i(_Width - _lblVersion.ClientArea.Width - 3, _Height - _lblVersion.ClientArea.Height - 3); _lblVersion.Update(0); _imgTitle.Position = new Vector2i(_Width - 550, 100); _imgTitle.Update(0); _txtConnect.Position = new Vector2i(_imgTitle.ClientArea.Left + 10, _imgTitle.ClientArea.Bottom + 50); _txtConnect.Update(0); _btnConnect.Position = new Vector2i(_txtConnect.Position.X, _txtConnect.ClientArea.Bottom + 20); _btnConnect.Update(0); _btnOptions.Position = new Vector2i(_btnConnect.Position.X, _btnConnect.ClientArea.Bottom + 20); _btnOptions.Update(0); _btnExit.Position = new Vector2i(_btnOptions.Position.X, _btnOptions.ClientArea.Bottom + 20); _btnExit.Update(0); }
public MainScreen(IDictionary <Type, object> managers) : base(managers) { _Width = (int)CluwneLib.Screen.Size.X; _Height = (int)CluwneLib.Screen.Size.Y; _background = ResourceManager.GetSprite("coderart"); _btnConnect = new ImageButton { ImageNormal = "connect_norm", ImageHover = "connect_hover" }; _btnConnect.Clicked += _buttConnect_Clicked; _btnOptions = new ImageButton { ImageNormal = "options_norm", ImageHover = "options_hover" }; _btnOptions.Clicked += _buttOptions_Clicked; _btnExit = new ImageButton { ImageNormal = "exit_norm", ImageHover = "exit_hover" }; _btnExit.Clicked += _buttExit_Clicked; _txtConnect = new Textbox(100, ResourceManager) { Text = ConfigurationManager.GetCVar <string>("net.server") }; _txtConnect.Position = new Vector2i(_Width / 3, _Height / 2); _txtConnect.OnSubmit += ConnectTextboxOnSubmit; Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); _lblVersion = new Label("v. " + fvi.FileVersion, "CALIBRI", ResourceManager); _lblVersion.Text.Color = new SFML.Graphics.Color(245, 245, 245); _lblVersion.Position = new Vector2i(_Width - _lblVersion.ClientArea.Width - 3, _Height - _lblVersion.ClientArea.Height - 3); _imgTitle = new SimpleImage { Sprite = "SpaceStationLogoColor", Position = new Vector2i(_Width - 550, 100), }; _lblVersion.Update(0); _imgTitle.Update(0); _txtConnect.Position = new Vector2i(_imgTitle.ClientArea.Left + 40, _imgTitle.ClientArea.Bottom() + 50); _txtConnect.Update(0); _btnConnect.Position = new Vector2i(_txtConnect.Position.X, _txtConnect.ClientArea.Bottom() + 20); _btnConnect.Update(0); _btnOptions.Position = new Vector2i(_btnConnect.Position.X, _btnConnect.ClientArea.Bottom() + 20); _btnOptions.Update(0); _btnExit.Position = new Vector2i(_btnOptions.Position.X, _btnOptions.ClientArea.Bottom() + 20); _btnExit.Update(0); }