private void creatingRegisterButton() { Sprite spriteRegisterButton = new Sprite(Assets.registerButton); Assets.spriteDefaultColor(spriteRegisterButton); spriteRegisterButton.setSize( (Constant.CONSTANT_WIDTH_FIELD_AND_BUTTON), (Constant.CONSTANCE_HEIGHT_BUTTONS)); SpriteDrawable registerSpriteDrawable = new SpriteDrawable(spriteRegisterButton); registerButton = new ImageButton(registerSpriteDrawable); }
@Override public void show() { skin = new Skin(Gdx.files.internal("uiskin.json")); stage = new Stage(new ScreenViewport()); batch = new SpriteBatch(); Gdx.input.setInputProcessor(stage); // Adding the game title to the screen Sprite spriteTitle = new Sprite(Assets.zombieShooterTitle); Assets.spriteDefaultColorSolid(spriteTitle); SpriteDrawable spriteDrawableTitle = new SpriteDrawable(spriteTitle); imageTitle = new Image(spriteDrawableTitle); // Creating all the containers for the positioning and arranging of our stuff container = new Table(); container.setWidth(stage.getWidth()); container.align(Align.center | Align.top); container.setPosition(0, Constant.HEIGHT_SCREEN); containerFirstRow = new Table(); containerFirstRow.setWidth(stage.getWidth()); containerFirstRow.align(Align.center | Align.top); containerFirstRow.setPosition(0, Constant.HEIGHT_SCREEN); containerSecondRow = new Table(); containerSecondRow.setWidth(stage.getWidth()); containerSecondRow.align(Align.center | Align.top); containerSecondRow.setPosition(0, Constant.HEIGHT_SCREEN); creatingRegisterButton(); creatingTheTextFields(); // Setting the text field text to be on the center settingTextFieldsTextToCenter(); // Remove any text in hte text fields on click so that user can write his information cleaningTextFieldsToBlank(); // Adding all the object into the stage. First of all we add to the container // for the row then to the main container , finally into the main stage arrangingTheScreen(); // Creating the background backGroundSprite = new Sprite(Assets.backgroundMenu); backGroundSprite.setSize(Constant.WIDTH_SCREEN, Constant.HEIGHT_SCREEN); // Setting the back key on android to true, so it can accept interaction Gdx.input.setCatchBackKey(true); inizializiraneWarningMessage(); // When clicking on the register button we start the validation process. // It calls all the methods which are checking the user input registerButton.addListener( new ClickListener() { public void clicked(InputEvent e, float x, float y) { Assets.clickButton.play(); if ((checkUserField(userField.getText().toString())) && (checkPasswordField(passwordField.getText().toString())) && (checkPasswordAndRePassword( passwordField.getText().toString(), passwordCheckField.getText().toString())) && (checkEmailField(emailField.getText().toString()))) { registerJson(); } } }); }