public override bool Init() { _inputName = new InputField(Vector2.Zero, new Rectangle(0, 0, 200, 0), 2f); _inputName.CenterAlignment(new Rectangle(0, 0, Consts.VIEWPORT_WIDTH, Consts.VIEWPORT_HEIGHT)); Vector2 inputPosition = _inputName.GetPosition(); Rectangle inputRect = _inputName.GetBoundingBox(); _loginButton = new Button("Login", new Vector2(inputPosition.X + inputRect.Width, inputPosition.Y), new Rectangle(0, 0, 100, 0), 2.0f); _exitButton = new Button("", new Vector2(Consts.VIEWPORT_WIDTH - 40, Consts.VIEWPORT_HEIGHT - 40), new Rectangle(0, 0, 40, 40), 1.0f); _sOptionalButton = new Button("", new Vector2(Consts.VIEWPORT_WIDTH - 80, Consts.VIEWPORT_HEIGHT - 40), new Rectangle(0, 0, 40, 40), 0.0f); _inputName.SetPosition(inputPosition + new Vector2(0, -Consts.VIEWPORT_HEIGHT * 0.2f)); _loginButton.SetPosition(_loginButton.GetPosition() + new Vector2(0, -Consts.VIEWPORT_HEIGHT * 0.2f)); _loginButton.CMD(Consts.UI_CMD_CHANGE_TO_LOGIN_BUTTON); _exitButton.CMD(Consts.UI_CMD_CHANGE_TO_EXIT_BUTTON); _sBg = new SBackground(); return(base.Init()); }
public override bool Init() { _inputName = new InputField(Vector2.Zero, new Rectangle(0, 0, 200, 0), 2f); _inputName.CenterAlignment(new Rectangle(0, 0, Consts.VIEWPORT_WIDTH, Consts.VIEWPORT_HEIGHT)); _inputName.SetPosition(_inputName.GetPosition() + new Vector2(0, -Consts.VIEWPORT_HEIGHT * 0.1f)); Vector2 inputPosition = _inputName.GetPosition(); Rectangle inputRect = _inputName.GetBoundingBox(); _inputHost = new InputField( inputPosition + new Vector2(0, -inputRect.Height), new Rectangle(0, 0, 200, 0), 2f, "127.0.0.1"); _inputPort = new InputField( _inputHost.GetPosition() + new Vector2(0, -_inputHost.GetBoundingBox().Height), new Rectangle(0, 0, 200, 0), 2f, "9933"); _loginButton = new Button("Login", new Vector2(inputPosition.X + inputRect.Width, inputPosition.Y), new Rectangle(0, 0, 100, 0), 2.0f); _exitButton = new Button("", new Vector2(Consts.VIEWPORT_WIDTH - 40, Consts.VIEWPORT_HEIGHT - 40), new Rectangle(0, 0, 40, 40), 1.0f); _sOptionalButton = new Button("", new Vector2(Consts.VIEWPORT_WIDTH - 80, Consts.VIEWPORT_HEIGHT - 40), new Rectangle(0, 0, 40, 40), 0.0f); _sBg = new SBackground(); _inputPort.SetTextAlignment(0.45f); _inputPort.SetTextMaxSize(0.5f); return(base.Init()); }