Ejemplo n.º 1
0
  public void addResumeButton(Table table) {
    TextButton resume = new TextButton("Resume", assetHolder.buttonStyle);
    resume.addListener(
        new InputListener() {
          private GameOverlay gOverlay;

          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            return true;
          }

          public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            gOverlay.unpauseOverlay();
          }

          public InputListener setSceneChanger(GameOverlay s) {
            this.gOverlay = s;
            return this;
          }
        }.setSceneChanger(this));
    table
        .add(resume)
        .height(assetHolder.getPercentHeightInt(assetHolder.buttonHeight))
        .width(assetHolder.getPercentWidthInt(assetHolder.buttonWidth))
        .pad(10);
    table.row();
  }
Ejemplo n.º 2
0
  public void setupWinButtons() {
    bottomMenu.clearChildren();
    if (assetHolder.levelLoader.areMoveLevels()) {
      TextButton nextLevel = new TextButton("Next Level", assetHolder.buttonStyle);
      nextLevel.addListener(
          new InputListener() {
            private GameOverlay gOverlay;

            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
              return true;
            }

            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
              gOverlay.unpauseOverlay();
              gOverlay.nextLevel();
            }

            public InputListener setSceneChanger(GameOverlay s) {
              this.gOverlay = s;
              return this;
            }
          }.setSceneChanger(this));
      bottomMenu
          .add(nextLevel)
          .height(assetHolder.getPercentHeightInt(assetHolder.buttonHeight))
          .width(assetHolder.getPercentWidthInt(assetHolder.buttonWidth))
          .pad(10);
      bottomMenu.row();
    }
    addRetryButtons(bottomMenu);
  }
  @Override
  public void show() {
    stage = new Stage();

    Gdx.input.setInputProcessor(stage);

    atlas = new TextureAtlas("button.pack");
    skin = new Skin(atlas);

    table = new Table(skin);
    table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    // table.background(new TextureRegionDrawable(new TextureRegion("Splash.png")));

    // creating font
    white = new BitmapFont(Gdx.files.internal("font.fnt"), false);

    // creating buttons
    TextButtonStyle buttonStyle = new TextButtonStyle();
    buttonStyle.up = skin.getDrawable("button.up");
    buttonStyle.down = skin.getDrawable("button.down");
    buttonStyle.pressedOffsetX = 1;
    buttonStyle.pressedOffsetY = -1;
    buttonStyle.font = white;

    buttonStart = new TextButton("START", buttonStyle);
    buttonStart.pad(10);

    table.add(buttonStart);
    stage.addActor(table);
  }
Ejemplo n.º 4
0
  public Option() {
    selection_ = StateMEnuEnum.OPTION;
    values_ = GlobalValues.getInstance();

    // creation zone affichage du menu
    stage = new Stage(new ScreenViewport());

    // boutons et label
    layout_table = new Table();
    layout_table.setSize(values_.get_width(), values_.get_width());
    retour_ = new TextButton("Retour", values_.get_Skin()); // init du bouton retour

    retour_.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            selection_ = StateMEnuEnum.MENU;
          }
        });

    layout_table.add(retour_).width(values_.get_width()).pad(10);
    stage.addActor(layout_table);
    // Gdx.input.setInputProcessor(stage);

  }
Ejemplo n.º 5
0
  public PlayerManagement(Player pc) {
    batch = new SpriteBatch();
    stage = new Stage(new ScreenViewport());
    //		stage.toScreenCoordinates(coords, transformMatrix)
    Gdx.input.setInputProcessor(stage);
    pixmap = new Pixmap(Vals.SCREEN_WIDTH, Vals.SCREEN_HEIGHT, Pixmap.Format.RGBA8888);
    // Equipment and Stats
    pixmap.setColor(Color.BLUE);
    pixmap.fillRectangle(
        Vals.GRID_HALF,
        Vals.GRID_HALF,
        Vals.SCREEN_WIDTH / 2 - Vals.GRID_HALF,
        Vals.SCREEN_HEIGHT / 2 - Vals.GRID_SIZE);
    // Inventory and item descriptions
    pixmap.setColor(Color.WHITE);
    pixmap.fillRectangle(
        Vals.GRID_HALF,
        Vals.SCREEN_HEIGHT / 2,
        Vals.SCREEN_WIDTH / 2 - Vals.GRID_SIZE * 6,
        Vals.SCREEN_HEIGHT / 2 - Vals.GRID_SIZE);
    pixmap.setColor(Color.GRAY);
    pixmap.fillRectangle(
        Vals.GRID_HALF + Vals.SCREEN_WIDTH / 2 - Vals.GRID_SIZE * 6,
        Vals.SCREEN_HEIGHT / 2,
        Vals.GRID_SIZE * 6 - Vals.GRID_HALF,
        Vals.SCREEN_HEIGHT / 2 - Vals.GRID_SIZE);

    texture = new Texture(pixmap);
    Table table = new Table();
    for (Item item : pc.inventory) {
      table.add(new ItemWidget(item));
    }
    ScrollPane inventoryView = new ScrollPane(table);
    stage.addActor(inventoryView);
  }
Ejemplo n.º 6
0
  public IntroScreen(final DirectedGame game) {
    super(game);

    rootTable = new Table();
    rootTable.setFillParent(true);
    final Actor logo = new Image(Assets.assetsManager.get(Assets.HEADMADE_LOGO, Texture.class));
    // logo.setOrigin(logo.getWidth() / 2, logo.getHeight() / 2);
    // logo.scaleBy(2f);
    logo.setColor(Color.BLACK);

    rootTable.add(logo).center().expand();
    rootTable.row();

    // rootTable.setDebug(true);
    this.stage.addActor(rootTable);

    stage.addListener(
        new InputListener() {

          @Override
          public boolean keyDown(InputEvent event, int keycode) {
            if (keycode == Keys.ESCAPE) {
              Gdx.app.exit();
              return true;
            }
            return super.keyDown(event, keycode);
          }
        });

    Assets.instance.loadAll();
  }
Ejemplo n.º 7
0
  public JoinServerAsGuestState() {
    Input.setContext(Contexts.get(Sps.Contexts.Non_Free), Client.get().getFirstPlayerIndex());
    stage = new Stage();

    Gdx.input.setInputProcessor(stage);

    Label.LabelStyle lblStyle = new Label.LabelStyle(Assets.get().font(), Color.WHITE);
    label = new Label("Server IP:", lblStyle);

    TextField.TextFieldStyle style = new TextField.TextFieldStyle();
    style.font = Assets.get().font();
    style.cursor = UiAssets.getNewCursor();

    style.fontColor = Color.WHITE;
    style.background = UiAssets.getNewBtnBg();
    ipIn = new TextField("", style);
    stage.setKeyboardFocus(ipIn);

    ipIn.addListener(
        new ChangeListener() {

          @Override
          public void changed(ChangeEvent changeEvent, Actor actor) {
            ipIn.setBlinkTime(1);
          }
        });

    Table table = new Table();
    table.setFillParent(true);
    table.add(label);
    table.add(ipIn).minWidth(300);

    stage.addActor(table);
  }
Ejemplo n.º 8
0
  public GameScreen(DdsGame game) {
    Dds.gameScreen = this;
    this.game = game;

    stage = new Stage(new FitViewport(Const.DESIGN_WIDTH, Const.DESIGN_HEIGHT));
    Gdx.input.setInputProcessor(stage);
    skin = new Skin(Gdx.files.internal("uiskin.json"));

    Image img = new Image(new Texture("bg.jpg"));
    stage.addActor(img);

    Table table = new Table();
    //		table.debug();
    stage.addActor(table);
    table.setFillParent(true);

    int n = NUM;
    int w = (Const.DESIGN_HEIGHT - n * Const.PAD_DIST - 2 * Const.EDGE_DIST) / n;
    table.defaults().width(w).height(w).pad(Const.PAD_DIST);

    labelHit = new Label("0", skin);
    labelHit.setAlignment(Align.right);
    stage.addActor(labelHit);

    labelMiss = new Label("0", skin);
    labelHit.setAlignment(Align.left);
    stage.addActor(labelHit);

    LevelData ld =
        LevelManager.getInstance().getLevelData(LevelManager.getInstance().getCurLevel());
    level = new Level(ld);
    HoleManager.getInstance().init(table, level.data.n);
    level.start();
  }
	private void buildTutorialDialog(String animationPath) {
		AssetManager manager = AssetManager.getInstance();
		StyleHelper helper = StyleHelper.getInstance();

		final Dialog tutorial = new Dialog("", StyleHelper.getInstance()
				.getDialogStyle());
		tutorial.clear();
		tutorial.fadeDuration = 0f;

		Table buttonTable = new Table();
		Drawable drawable = new TextureRegionDrawable(new TextureRegion(
				manager.get(animationPath, Texture.class)));
		// used image button here because it keeps the ratio of the texture
		ImageButton tutorialImage = new ImageButton(drawable);
		ImageButton okay = new ImageButton(
				helper.getImageButtonStyleRound("widgets/icon-check"));

		okay.addListener(new ClickListener() {
			@Override
			public void clicked(InputEvent event, float x, float y) {
				tutorial.hide();
			}
		});

		buttonTable.add(okay).size(100).bottom().right().expand().pad(30);
		tutorial.stack(tutorialImage, buttonTable).height(500).width(800);
		tutorial.show(stage);
	}
  private void setStage() {

    stage = new Stage();
    Gdx.input.setInputProcessor(stage);
    Table table = new Table();
    table.setFillParent(true);
    stage.addActor(table);
  }
Ejemplo n.º 11
0
  public void showSheepMessageButtons() {
    if (sheepGame.isLosing()) {
      setupLoseButtons();
    } else if (sheepGame.isWinning()) {
      setupWinButtons();
    } else if (sheepGame.lastMessage()) {
      bottomMenu.clearChildren();
      TextButton start = new TextButton("Start Level", assetHolder.buttonStyle);
      start.addListener(
          new InputListener() {
            private GameOverlay gOverlay;

            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
              return true;
            }

            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
              gOverlay.removeSheepMessage();
            }

            public InputListener setSceneChanger(GameOverlay s) {
              this.gOverlay = s;
              return this;
            }
          }.setSceneChanger(this));
      bottomMenu
          .add(start)
          .height(assetHolder.getPercentHeightInt(assetHolder.buttonHeight))
          .width(assetHolder.getPercentWidthInt(assetHolder.buttonWidth))
          .pad(10);
    } else {
      bottomMenu.clearChildren();
      TextButton next = new TextButton("Next", assetHolder.buttonStyle);
      next.addListener(
          new InputListener() {
            private GameOverlay gOverlay;

            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
              return true;
            }

            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
              gOverlay.removeSheepMessage();
            }

            public InputListener setSceneChanger(GameOverlay s) {
              this.gOverlay = s;
              return this;
            }
          }.setSceneChanger(this));
      bottomMenu
          .add(next)
          .height(assetHolder.getPercentHeightInt(assetHolder.buttonHeight))
          .width(assetHolder.getPercentWidthInt(assetHolder.buttonWidth))
          .pad(10);
    }
  }
Ejemplo n.º 12
0
 private Table buildBackgoundLayer() {
   Table layer = new Table();
   imgBackgound = new Image(skinCanyonBunny, "map");
   imgBackgound.setScale(Constants.SCALE);
   layer.add(imgBackgound);
   imgBackgound.setColor(
       imgBackgound.getColor().r, imgBackgound.getColor().g, imgBackgound.getColor().b, 0.2f);
   return layer;
 }
Ejemplo n.º 13
0
 public void setBenchmarkManagerActive(boolean isActive) {
   if (isActive) {
     isBenchmarkManagerActive = true;
     table.setVisible(true);
   } else {
     isBenchmarkManagerActive = false;
     table.setVisible(false);
   }
 }
 private void doStars(float stars) {
   for (int star = 0; star < 3; star++) {
     if (stars > star) {
       starTable.add(new Image(skin.getDrawable("star-filled"))).width(20).height(15);
     } else {
       starTable.add(new Image(skin.getDrawable("star-unfilled"))).width(20).height(15);
     }
   }
 }
Ejemplo n.º 15
0
 /** Set up benchmark table and the rest */
 private void setUp(BenchmarkPosition benchmarkPosition) {
   table = new Table();
   table.setFillParent(true);
   table.setTouchable(Touchable.disabled);
   stage.addActor(table);
   //
   setUpBencmarks();
   setUpPosition(benchmarkPosition);
 }
Ejemplo n.º 16
0
 public void setStyle(Style style) {
   this.style = style;
   // window
   window.setBackground(style.background);
   window.pad(style.vPad, style.hPad, style.vPad, style.hPad);
   // title
   title.setStyle(style.title);
   // action buttons
   actionsGroup.setStyle(style.actionsGroup);
 }
Ejemplo n.º 17
0
  public void update(float dt, OrthographicCamera cam) {
    stage.act(dt);
    if (Core.persistentAssets.update() && !assetsLoaded) {

      GameSave.save();

      assetsLoaded = true;

      layout = new Table(Core.persistentAssets.get("skins/uiskin.json", Skin.class));
      layout.setFillParent(true);
      layout.center().bottom();

      pressBtn =
          new Label(
              "Press any key to continue",
              Core.persistentAssets.get("skins/uiskin.json", Skin.class));

      layout.add(pressBtn).padBottom(40);

      layout.debug();

      stage.addActor(layout);

      stage.addListener(
          new InputListener() {
            public boolean keyUp(InputEvent event, int keycode) {
              gsm.setState(GameStateManager.MENU);
              return false;
            }

            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
              return true;
            }

            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
              gsm.setState(GameStateManager.MENU);
            }
          });
    }

    if (Core.persistentAssets.isLoaded("images/main-menu/background.jpg")) {
      if (!bgLoaded) {
        bgLoaded = true;
        bg =
            new Sprite(Core.persistentAssets.get("images/main-menu/background.jpg", Texture.class));
        float[] size =
            ImageUtils.minimalStretch(bg.getWidth(), bg.getHeight(), Core.WIDTH, Core.HEIGHT);

        bg.setSize(size[0], size[1]);
        bg.setPosition(size[2], size[3]);
      }
      bgOpacity += bgOpacityModifier * dt;
      bgOpacity = bgOpacity > 1 ? 1 : bgOpacity;
    }
  }
Ejemplo n.º 18
0
 protected Table getTable() {
   if (table == null) {
     table = new Table(getSkin());
     table.setFillParent(true);
     if (BeatBlaster.DEV_MODE) {
       table.debug();
     }
     stage.addActor(table);
   }
   return table;
 }
Ejemplo n.º 19
0
  public MainUI() {
    stage = new Stage();

    Table table = new Table();
    table.setFillParent(true);
    stage.addActor(table);

    // LabelStyle style = new LabelStyle();
    // Label label = new Label("SOME TEXT", style);
    resize(200, 200);
  }
  @Override
  public void layout() {
    if (table == null) return;

    table.setBounds(0, 0, table.getPrefWidth(), table.getPrefHeight());

    if (actionRunning == false) {
      if (collapsed) currentWidth = 0;
      else currentWidth = table.getPrefWidth();
    }
  }
Ejemplo n.º 21
0
 private void updateScrollPane() {
   innerContainer.clear();
   switch (screen) {
     case SCREEN_LICENSE:
       innerContainer.add(getLicenseWidget()).row();
       break;
     case SCREEN_CREDITS:
       innerContainer.add(getCreditsWidget()).row();
       break;
   }
 }
Ejemplo n.º 22
0
  private void inizializiraneWarningMessage() {
    tableMessage = new Table();
    tableMessage.setFillParent(true);
    tableMessage.top();

    labelMessage = new Label("", skin);
    labelMessage.setColor(Color.WHITE);
    labelMessage.setAlignment(Align.center);
    tableMessage.add(labelMessage).expandX().padTop(Constant.CONSTANT_TABLE_MESSAGE_PAD_TOP);
    stage.addActor(tableMessage);
  }
Ejemplo n.º 23
0
  public void addRetryButtons(Table table) {
    TextButton retry = new TextButton("Restart Level", assetHolder.buttonStyle);
    retry.addListener(
        new InputListener() {
          private GameOverlay gOverlay;

          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            return true;
          }

          public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            gOverlay.unpauseOverlay();
            gOverlay.retryLevel();
          }

          public InputListener setSceneChanger(GameOverlay s) {
            this.gOverlay = s;
            return this;
          }
        }.setSceneChanger(this));
    table
        .add(retry)
        .height(assetHolder.getPercentHeightInt(assetHolder.buttonHeight))
        .width(assetHolder.getPercentWidthInt(assetHolder.buttonWidth))
        .pad(10);
    table.row();
    TextButton selectLevel = new TextButton("Main Menu", assetHolder.buttonStyle);
    selectLevel.addListener(
        new InputListener() {
          private GameOverlay gOverlay;

          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            return true;
          }

          public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            gOverlay.unpauseOverlay();
            gOverlay.toMainMenu();
          }

          public InputListener setSceneChanger(GameOverlay s) {
            this.gOverlay = s;
            return this;
          }
        }.setSceneChanger(this));
    table
        .add(selectLevel)
        .height(assetHolder.getPercentHeightInt(assetHolder.buttonHeight))
        .width(assetHolder.getPercentWidthInt(assetHolder.buttonWidth))
        .pad(10);
    table.row();
    if (assetHolder.levelLoader.currentLevelHasHelp()) addHelpButton(table);
  }
Ejemplo n.º 24
0
  @Override
  public void show() {
    super.show();

    // retrieve the default table actor
    Table table = super.getTable();
    stage.clear();

    // atlas = new TextureAtlas(Gdx.files.internal("assets/data/uiskin.atlas"));
    // skin = new Skin(Gdx.files.internal("assets/data/uiskin.json"));

    Label label = new Label("Jamkhed", getSkin());
    Button bouton1 = new Button(getSkin());
    bouton1.add("Start Game");
    bouton1.addListener(
        new ChangeListener() {
          @Override
          public void changed(ChangeEvent event, Actor actor) {
            game.setScreen(game.getStartGameScreen());
            Gdx.app.log(Jamkhed.LOG, "Allez HOP ACTION");
          }
        });

    TextButton bouton2 = new TextButton("Options", getSkin());

    bouton2.addListener(
        new ChangeListener() {

          @Override
          public void changed(ChangeEvent event, Actor actor) {
            game.setScreen(new OptionsScreen(game));
            Gdx.app.log(Jamkhed.LOG, "Allez HOP Options");
          }
        });

    Button bouton3 = new Button(getSkin());
    bouton3.add("Hall Of Fame");
    bouton3.addListener(
        new ChangeListener() {
          @Override
          public void changed(ChangeEvent event, Actor actor) {

            Gdx.app.log(Jamkhed.LOG, "Allez HOP Classement");
          }
        });

    table.add(label).spaceBottom(20);
    table.row();
    table.add(bouton1).width(150).spaceBottom(10);
    table.row();
    table.add(bouton2).width(150).spaceBottom(10);
    table.row();
    table.add(bouton3).width(150);
    table.row();

    stage.addActor(table);
  }
Ejemplo n.º 25
0
 /** Set up benchmark labels */
 private void setUpBencmarks() {
   LabelStyle style = new LabelStyle(font, null);
   //
   labelResolution = new Label(getResolution(), style);
   labelRunTime = new Label(getRunTime(), style);
   labelFps = new Label(getFPS(), style);
   //
   table.add().row().left();
   table.add(labelResolution).row().left();
   table.add(labelRunTime).row().left();
   table.add(labelFps).row().left();
   table.add().left();
 }
Ejemplo n.º 26
0
 private void invalidateListPanes() {
   if (militaryBottomPane != null) {
     militaryBottomPane.clear();
   }
   if (militaryTopPane != null) {
     militaryTopPane.clear();
   }
   showingTextWidgets.forEach(TextWidget::dispose);
   showingTextWidgets.clear();
   militaryBottomPane = null;
   militaryTopPane = null;
   currentMilitary = null;
   currentMilitaryPos = null;
 }
Ejemplo n.º 27
0
 @Override
 public void setFocus(boolean focus) {
   super.setFocus(focus);
   top.setVisible(focus);
   if (!focus) {
     if (topCell.hasWidget()) {
       topCell.setWidget(null);
     }
   } else {
     topCell.setWidget(top);
   }
   top.invalidateHierarchy();
   previousTime = Float.valueOf(time.getText());
 }
Ejemplo n.º 28
0
  public void create() {
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);
    Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));

    Label nameLabel = new Label("Name:", skin);
    TextField nameText = new TextField("", skin);
    Label addressLabel = new Label("Address:", skin);
    TextField addressText = new TextField("", skin);

    Table table = new Table();
    stage.addActor(table);
    table.setSize(260, 195);
    table.setPosition(190, 142);
    // table.align(Align.right | Align.bottom);

    table.debug();

    TextureRegion upRegion = skin.getRegion("default-slider-knob");
    TextureRegion downRegion = skin.getRegion("default-slider-knob");
    BitmapFont buttonFont = skin.getFont("default-font");

    TextButton button = new TextButton("Button 1", skin);
    button.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("touchDown 1");
            return false;
          }
        });
    table.add(button);
    // table.setTouchable(Touchable.disabled);

    Table table2 = new Table();
    stage.addActor(table2);
    table2.setFillParent(true);
    table2.bottom();

    TextButton button2 = new TextButton("Button 2", skin);
    button2.addListener(
        new ChangeListener() {
          public void changed(ChangeEvent event, Actor actor) {
            System.out.println("2!");
          }
        });
    button2.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("touchDown 2");
            return false;
          }
        });
    table2.add(button2);
  }
Ejemplo n.º 29
0
  @Override
  protected void build(Controller controller) {

    widget = new Image();

    ApplicationAssets assets = controller.getApplicationAssets();
    Skin skin = assets.getSkin();
    I18N i18n = assets.getI18N();

    this.time =
        new TextField("", skin) {
          @Override
          public float getPrefWidth() {
            return IMAGE_WIDTH;
          }
        };

    IconButton dup = new IconButton("copy24x24", skin);
    dup.setTooltip(i18n.m("frames.duplicate"));
    dup.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            timeline.duplicate(FrameWidget.this);
          }
        });

    IconButton delete = new IconButton("recycle24x24", skin);
    delete.setTooltip(i18n.m("frames.delete"));
    delete.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            timeline.delete(FrameWidget.this);
          }
        });

    top = new Table();
    top.setVisible(false);
    top.add(dup).left();
    top.add(delete).expandX().right();

    getImage().setScaling(Scaling.fit);
    topCell = add().expandX().fillX();
    row();
    add(widget).height(IMAGE_HEIGHT).width(IMAGE_WIDTH);
    row();
    add(time);
  }
Ejemplo n.º 30
0
  // constructors -------------------------------------------------------------------------
  public MenuScreen() {
    stage = new Stage(new ExtendViewport(screenWidth, screenHeight));

    // loads the assets
    Resources.loadMainMenu(highDef);
    Resources.manager.finishLoading();
    menuSkin =
        Resources.manager.get(
            (highDef ? "skins/mainMenuHigh.json" : "skins/mainMenu.json"), Skin.class);

    // creates the table
    table = new Table();
    table.setSkin(menuSkin);
    table.setBackground("uiBackground");
  }