Beispiel #1
0
  public void render(float delta) {

    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.act(delta);
    stage.draw();

    tweenManager.update(delta);
  }
Beispiel #2
0
  @Override
  public void resize(int width, int height) {
    if (stage == null) {
      stage = new Stage(width, height, true);
    }
    stage.clear();

    Gdx.input.setInputProcessor(stage);

    TextButtonStyle butStyle = new TextButtonStyle();
    butStyle.up = butSkin.getDrawable("butdown");
    butStyle.down = butSkin.getDrawable("butup");
    butStyle.font = font1;

    LabelStyle labelStyle = new LabelStyle();
    labelStyle.font = font1;

    mainButton = new TextButton("Start Game!", butStyle);
    closeButton = new TextButton("Do nothing", butStyle);

    mainButton.setWidth(400);
    mainButton.setHeight(100);
    mainButton.setX(Gdx.graphics.getWidth() / 2 - mainButton.getWidth() / 2);
    mainButton.setY(Gdx.graphics.getHeight() / 2 - 2 * (mainButton.getHeight() / 1.2f));

    closeButton.setWidth(400);
    closeButton.setHeight(100);
    closeButton.setX(Gdx.graphics.getWidth() / 2 - closeButton.getWidth() / 2);
    closeButton.setY(
        Gdx.graphics.getHeight() / 2
            - 2 * (closeButton.getHeight() / 1.2f)
            - (closeButton.getHeight() + 5));

    mainButton.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("down");
            return true;
          }

          public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            golf.setCall(false); // disable splash screen after first use
            golf.setScreen(golf.hole, 1);
          }
        });

    stage.addActor(mainButton);
    stage.addActor(closeButton);
  }
Beispiel #3
0
  @Override
  public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    stage.act(delta);

    logoMenuBatch.begin();
    menuBGSprite.draw(logoMenuBatch);
    logoSprite.draw(logoMenuBatch);
    logoMenuBatch.end();

    butBatch.begin();
    stage.draw();
    butBatch.end();

    if (splashYes) {

      splashBatch.begin();
      splashBGSprite.draw(splashBatch);

      if ((fadeInOut < 1) && (fadeInOut > fadeCopy)) {
        System.out.println(fadeInOut);
        fadeCopy = fadeInOut;
        fadeInOut += 0.005;
        if (fadeInOut >= 1) fadeInOut = 1;

      } else {
        if (fadeInOut <= 0) splashYes = false;
        System.out.println(fadeInOut);
        fadeInOut -= 0.005;
        if (fadeInOut <= 0) {
          splashYes = false;
          fadeInOut = 0;
        }
      }

      splashSprite.setColor(1, 1, 1, fadeInOut);
      splashSprite.draw(splashBatch);
      splashBatch.end();
    }
  }
Beispiel #4
0
  @Override
  public void dispose() {
    Gdx.input.setInputProcessor(null);

    if (disposeCount == 1) return;
    butBatch.dispose();
    splashBatch.dispose();
    logoMenuBatch.dispose();
    butAtlas.dispose();
    font1.dispose();
    butSkin.dispose();
    stage.dispose();
    disposeCount = 1;
  }
Beispiel #5
0
  public void show() {

    stage = new Stage();

    Gdx.input.setInputProcessor(stage);

    atlas = new TextureAtlas("ui/atlas.pack");
    skin = new Skin(Gdx.files.internal("ui/menuSkin.json"), atlas);

    Texture chipBg = new Texture(Gdx.files.internal("img/chips.png"));
    stage.addActor(new Image(chipBg));

    table = new Table(skin);
    table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    table.bottom().right();

    backButton = new TextButton("BACK", skin);
    backButton.addListener(
        new ClickListener() {
          public void clicked(InputEvent event, float x, float y) {
            ((Game) Gdx.app.getApplicationListener()).setScreen(new PotatoMenu());
          }
        });
    backButton.pad(10);

    table.add(backButton).bottom().right();
    ;

    stage.addActor(table);

    tweenManager = new TweenManager();
    Tween.registerAccessor(Actor.class, new ActorAccessor());

    tweenManager.update(Gdx.graphics.getDeltaTime());

    stage.addAction(sequence(moveTo(0, stage.getHeight()), moveTo(0, 0, .5f)));
  }
Beispiel #6
0
  public void resize(int width, int height) {

    stage.setViewport(width, height, true);
    table.invalidateHierarchy();
    table.setSize(width, height);
  }
Beispiel #7
0
  public void dispose() {

    stage.dispose();
    atlas.dispose();
    skin.dispose();
  }