コード例 #1
0
  @Override
  public void show() {
    Texture.setEnforcePotImages(false);
    butBatch = new SpriteBatch();
    logoMenuBatch = new SpriteBatch();
    splashBatch = new SpriteBatch();

    logoTexture = new Texture("resources/logo.png");
    splashTexture = new Texture("resources/teamlogo.png");
    splashBGTexture = new Texture("resources/background2.png");
    menuBGTexture = new Texture("resources/menubg.png");

    splashSprite = new Sprite(splashTexture);
    splashBGSprite = new Sprite(splashBGTexture);
    logoSprite = new Sprite(logoTexture);
    menuBGSprite = new Sprite(menuBGTexture);

    logoSprite.setX(Gdx.graphics.getWidth() / 2 - logoSprite.getWidth() / 2);
    logoSprite.setY(Gdx.graphics.getHeight() / 2 - Gdx.graphics.getHeight() / 7);
    splashSprite.setX(Gdx.graphics.getWidth() / 2 - logoSprite.getWidth() / 2);
    splashSprite.setY(Gdx.graphics.getHeight() / 7);

    // buttons
    butAtlas = new TextureAtlas("resources/button.pack");
    butSkin = new Skin();
    butSkin.addRegions(butAtlas);
    font1 = new BitmapFont(Gdx.files.internal("resources/font_black.fnt"), false);
  }
コード例 #2
0
ファイル: Assets.java プロジェクト: einsiboy/MazeSolverLibGDX
  public void init() {
    assetManager.load(ATLAS_UI, TextureAtlas.class);
    assetManager.load(SKIN_UI, Skin.class);

    assetManager.load(ATLAS_UI_BUTTONS, TextureAtlas.class);
    // assetManager.load(SKIN_UI_BUTTONS, Skin.class);
    // TODO: load game graphics atlas here
    assetManager.finishLoading();

    skinUI = assetManager.get(SKIN_UI);
    textureAtlasUI = assetManager.get(ATLAS_UI);

    textureAtlasButtons = assetManager.get(ATLAS_UI_BUTTONS, TextureAtlas.class);

    // Stopped loading the skinButton skin in the Assetmanager to generate font size on the fly
    skinButton = new Skin();
    skinButton.add(
        "default-font",
        this.fonts.getLemonMilk(Helpers.getFontSize(20, 720.0f, Gdx.graphics.getHeight())));
    skinButton.addRegions(new TextureAtlas(Gdx.files.internal("ui/9patch_buttons.atlas")));
    skinButton.load(Gdx.files.internal("ui/9patch_buttons.json"));

    // this.assetManager = assetManager;

    // assetManager.load(Constants.ATLAS_GAME, TextureAtlas.class);
    // assetManager.finishLoading();
    // TextureAtlas atlas = assetManager.get(Constants.ATLAS_GAME);

    // initAssets(atlas);
  }
コード例 #3
0
  public ButtonMenu(float fX, float fY, float fWidth, float fHeight, String sName) {
    setBounds(fX, fY, fWidth, fHeight);

    taMenu = new TextureAtlas("menu.atlas");

    skMenu = new Skin();
    skMenu.addRegions(taMenu);

    bsMenu = new ButtonStyle();
    bsMenu.up = skMenu.getDrawable(sName + "-up");
    bsMenu.over = skMenu.getDrawable(sName + "-over");
    bsMenu.down = skMenu.getDrawable(sName + "-down");
    setStyle(bsMenu);
  }
コード例 #4
0
ファイル: MainMenu.java プロジェクト: john2104/tutorial1
  @Override
  public void show() {
    // TODO Auto-generated method stub
    stage = new Stage();
    font = new BitmapFont(Gdx.files.internal("font.fnt"), false);
    style = new LabelStyle(font, Color.RED);
    label = new Label("Juego de Prueba", style);
    label.setPosition(Gdx.graphics.getWidth() / 3, Gdx.graphics.getHeight() - 100);
    stage.addActor(label);

    skin = new Skin();
    buttonatlas = new TextureAtlas("buttons/button.pack");
    skin.addRegions(buttonatlas);

    buttonstyle = new TextButtonStyle();
    buttonstyle.up = skin.getDrawable("button");
    buttonstyle.over = skin.getDrawable("buttonpress");
    buttonstyle.down = skin.getDrawable("buttonpress");
    buttonstyle.font = font;

    button = new TextButton("Play", buttonstyle);

    stage.addActor(button);

    button.addListener(
        new InputListener() {

          @Override
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            // TODO Auto-generated method stub

            game.setScreen(new PlayScreen(game));
            MainMenu.this.dispose();
            return true;
          }
        });

    // ok

    skin2 = new Skin();
    buttonatlas2 = new TextureAtlas("buttons/button2.pack");
    skin2.addRegions(buttonatlas2);

    buttonstyle2 = new TextButtonStyle();
    buttonstyle2.up = skin2.getDrawable("button2");
    buttonstyle2.over = skin2.getDrawable("button2press");
    buttonstyle2.down = skin2.getDrawable("button2press");
    buttonstyle2.font = font;

    button2 = new TextButton("", buttonstyle2);

    button2.setPosition(Gdx.graphics.getWidth() - 250, 0);

    stage.addActor(button2);

    button2.addListener(
        new InputListener() {

          @Override
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            // TODO Auto-generated method stub

            game.setScreen(new tablescreen(game));
            MainMenu.this.dispose();
            return true;
          }
        });

    batch = new SpriteBatch();

    Gdx.input.setInputProcessor(stage);
  }