Ejemplo n.º 1
0
  private void loadGameGraphics() {

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/game/");
    gameTextureAtlas =
        new BuildableBitmapTextureAtlas(
            activity.getTextureManager(),
            1024,
            1024,
            TextureOptions.REPEATING_NEAREST_PREMULTIPLYALPHA);
    rockTop_region =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTextureAtlas, activity, "Red_Rock_Top.png");
    rockMid_region =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTextureAtlas, activity, "Red_Rock_Middle.png");
    rockOre_region =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTextureAtlas, activity, "Ore_Rock.png");
    player_region =
        BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(
            gameTextureAtlas, activity, "player.png", 1, 1);
    dpad_region =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTextureAtlas, activity, "Dpad_Notpressed.png");
    try {
      this.gameTextureAtlas.build(
          new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 0, 0));
      this.gameTextureAtlas.load();
    } catch (final TextureAtlasBuilderException e) {
      Debug.e(e);
    }
  }
Ejemplo n.º 2
0
  @Override
  public void loadScene() {

    menuTextureAtlas =
        new BuildableBitmapTextureAtlas(
            activity.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
    menu_background_region =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            menuTextureAtlas, activity, "menu_background.png");
    play_region =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            menuTextureAtlas, activity, "play.png");
    options_region =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            menuTextureAtlas, activity, "options.png");

    try {
      this.menuTextureAtlas.build(
          new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 1, 0));

    } catch (TextureAtlasBuilderException e) {
      Debug.e(e);
    }
    this.menuTextureAtlas.load();
  }
Ejemplo n.º 3
0
  @Override
  protected void onCreateResources() throws IOException {
    this.gameManager = GomokuGameManager.getInstance();
    this.gameManager.setCallback(this);
    this.gameManager.initialize(COLUMNS - 1, ROWS - 1);
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

    this.mBitmapTextureAtlas = new BuildableBitmapTextureAtlas(this.getTextureManager(), 512, 512);
    this.blankRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            mBitmapTextureAtlas, this, "blankIcon.png");
    this.xRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            mBitmapTextureAtlas, this, "xIcon.png");
    this.oRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            mBitmapTextureAtlas, this, "oIcon.png");
    this.winRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            mBitmapTextureAtlas, this, "blueIcon.png");
    try {
      this.mBitmapTextureAtlas.build(
          new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 1, 1));
      this.mBitmapTextureAtlas.load();
    } catch (ITextureAtlasBuilder.TextureAtlasBuilderException e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 4
0
 private void initControlResources() {
   this.mOnScreenControlTexture =
       new BitmapTextureAtlas(this.getTextureManager(), 256, 128, TextureOptions.BILINEAR);
   this.mOnScreenControlBaseTextureRegion =
       BitmapTextureAtlasTextureRegionFactory.createFromAsset(
           this.mOnScreenControlTexture, this, "onscreen_control_base.png", 0, 0);
   this.mOnScreenControlKnobTextureRegion =
       BitmapTextureAtlasTextureRegionFactory.createFromAsset(
           this.mOnScreenControlTexture, this, "onscreen_control_knob.png", 128, 0);
   this.mOnScreenControlTexture.load();
 }
 @Override
 public void onCreateResourcesAsync(final IProgressListener pProgressListener) throws Exception {
   pProgressListener.onProgressChanged(0);
   Thread.sleep(1000);
   pProgressListener.onProgressChanged(20);
   BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
   Thread.sleep(1000);
   this.mBitmapTextureAtlas =
       new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
   pProgressListener.onProgressChanged(40);
   Thread.sleep(1000);
   this.mFaceTextureRegion =
       BitmapTextureAtlasTextureRegionFactory.createFromAsset(
           AsyncGameActivityExample.this.mBitmapTextureAtlas,
           AsyncGameActivityExample.this,
           "face_box.png",
           0,
           0);
   pProgressListener.onProgressChanged(60);
   Thread.sleep(1000);
   this.mBitmapTextureAtlas.load();
   pProgressListener.onProgressChanged(80);
   Thread.sleep(1000);
   pProgressListener.onProgressChanged(100);
 }
Ejemplo n.º 6
0
  public ITextureRegion loadImageResourceFromSD(
      String nameResource,
      BitmapTextureAtlas pBitmapTextureAtlas,
      int pTexturePositionX,
      int pTexturePositionY) {

    if (BuildConfig.TEST_VERSION) {
      return BitmapTextureAtlasTextureRegionFactory.createFromAsset(
          pBitmapTextureAtlas, getActivity(), nameResource, pTexturePositionX, pTexturePositionY);
    } else {
      String path =
          Environment.getExternalStorageDirectory()
              + "/Android/data/"
              + getActivity().getPackageName()
              + "/files/"
              + songName
              + "/gfx/"
              + nameResource
              + ".nomedia";
      File tmp = new File(path);
      if (!tmp.exists()) {
        return null;
      }
      return BitmapTextureAtlasTextureRegionFactory.createFromSource(
          pBitmapTextureAtlas,
          FileBitmapTextureAtlasSource.create(tmp),
          pTexturePositionX,
          pTexturePositionY);
    }
  }
Ejemplo n.º 7
0
 public void createResources(Main main) {
   textureAtlas =
       new BitmapTextureAtlas(main.getTextureManager(), 512, 512, TextureOptions.BILINEAR);
   textureRegion =
       BitmapTextureAtlasTextureRegionFactory.createFromAsset(
           textureAtlas, main, "object_tree.png", 0, 0);
   textureAtlas.load();
 }
  public void onCreateResources() {
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

    this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 512, 512);
    mBotonTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            this.mBitmapTextureAtlas, this, "botontuto.png", 0, 0);
    this.mBitmapTextureAtlas.load();
  }
Ejemplo n.º 9
0
 // ------------------------------------------------------------------------------------
 // CLASS LOGIC
 // -------------------------------------------------------------------------------------
 public void loadSplashScreen() {
   BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
   splashTextureAtlas =
       new BitmapTextureAtlas(activity.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
   splash_region =
       BitmapTextureAtlasTextureRegionFactory.createFromAsset(
           splashTextureAtlas, activity, "splash.png", 0, 0);
   splashTextureAtlas.load();
 }
Ejemplo n.º 10
0
  public void loadSplashResources() {
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
    splashTA = new BitmapTextureAtlas(activity.getTextureManager(), 256, 256);

    splashTR =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            splashTA, activity, "splash12.png", 0, 0);

    splashTA.load();
  }
  private void loadOptionsGraphics() {
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/options/");
    optionsTextureAtlas =
        new BuildableBitmapTextureAtlas(
            activity.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR);

    optionsBackgroundTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            optionsTextureAtlas, activity, "background.jpg");
    optionsTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            optionsTextureAtlas, activity, "options.png");

    try {
      optionsTextureAtlas.build(
          new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 0, 1));
      optionsTextureAtlas.load();
    } catch (ITextureAtlasBuilder.TextureAtlasBuilderException e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 12
0
  public void loadSplashResources() {
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath(
        ResourceManager.AssetFolders.Images + "/" + ResourceManager.ImageFolders.Textures + "/");
    splashTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 1024, 512);
    splashTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            splashTextureAtlas, activity, "splash_bg.png", 0, 0);
    splashTextureAtlas.load();
    backgroundSprite =
        new Sprite(0, 0, splashTextureRegion, vertexBufferObjectManager) {
          @Override
          protected void preDraw(GLState pGLState, Camera pCamera) {
            super.preDraw(pGLState, pCamera);
            pGLState.enableDither();
          }
        };
    float width = camera.getWidth();
    float height = camera.getHeight();
    backgroundSprite.setPosition(width / 2, height / 2);
    backgroundSprite.setSize(width, height);

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath(
        ResourceManager.AssetFolders.Images
            + "/"
            + ResourceManager.ImageFolders.TiledTextures
            + "/");
    spinnerTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 1398, 128);
    spinnerTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(
            spinnerTextureAtlas, activity, "android_loading.png", 0, 0, 8, 1);
    spinnerTextureAtlas.load();
    spinner =
        new AnimatedSprite(width / 2, height / 2, spinnerTextureRegion, vertexBufferObjectManager);
    spinner.setZIndex(10);
    spinner.animate(200);

    FontFactory.setAssetBasePath(ResourceManager.AssetFolders.Fonts + "/");
    ITexture fontTexture2 =
        new BitmapTextureAtlas(activity.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
    textFont =
        FontFactory.createStrokeFromAsset(
            activity.getFontManager(),
            fontTexture2,
            activity.getAssets(),
            "OpenSans-Regular.ttf",
            25,
            true,
            Color.WHITE,
            1,
            Color.rgb(70, 70, 70));
    textFont.load();
  }
Ejemplo n.º 13
0
 private void loadMenuGraphics() {
   BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/menu/");
   menuTextureAtlas =
       new BuildableBitmapTextureAtlas(
           activity.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR);
   menu_background_region =
       BitmapTextureAtlasTextureRegionFactory.createFromAsset(
           menuTextureAtlas, activity, "menu_background.png");
   play_region =
       BitmapTextureAtlasTextureRegionFactory.createFromAsset(
           menuTextureAtlas, activity, "play.png");
   options_region =
       BitmapTextureAtlasTextureRegionFactory.createFromAsset(
           menuTextureAtlas, activity, "options.png");
   try {
     this.menuTextureAtlas.build(
         new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 1, 0));
     this.menuTextureAtlas.load();
   } catch (final TextureAtlasBuilderException e) {
     Debug.e(e);
   }
 }
Ejemplo n.º 14
0
  @Override
  protected void onCreateResources() {
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

    this.mBitmapTextureAtlas =
        new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);

    this.mParticleTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            this.mBitmapTextureAtlas, this, "particle_point.png", 0, 0);

    this.mBitmapTextureAtlas.load();
  }
  public void loadLoadingResources() {
    if (loadingTextureAtlas != null) {
      loadingTextureAtlas.load();
      return;
    }

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/loading/");
    loadingTextureAtlas =
        new BitmapTextureAtlas(activity.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR);
    loadingTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            loadingTextureAtlas, activity, "background.png", 0, 0);
    loadingTextureAtlas.load();
  }
Ejemplo n.º 16
0
  @Override
  public void onCreateResources(OnCreateResourcesCallback pOnCreateResourcesCallback)
      throws Exception {
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

    this.mBitmapTextureAtlas =
        new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
    this.mFaceTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
    this.mBitmapTextureAtlas.load();

    this.mOnScreenControlTexture =
        new BitmapTextureAtlas(this.getTextureManager(), 256, 128, TextureOptions.BILINEAR);
    this.mOnScreenControlBaseTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            this.mOnScreenControlTexture, this, "onscreen_control_base.png", 0, 0);
    this.mOnScreenControlKnobTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            this.mOnScreenControlTexture, this, "onscreen_control_knob.png", 128, 0);
    this.mOnScreenControlTexture.load();

    pOnCreateResourcesCallback.onCreateResourcesFinished();
  }
Ejemplo n.º 17
0
  @Override
  protected void onCreateResources() {
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
    this.mBitmapTextureAtlas2 =
        new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
    this.mFaceTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            this.mBitmapTextureAtlas2, this, "face_box.png", 0, 0);
    this.mBitmapTextureAtlas2.load();

    // Load resoure player
    loadResourePlayer();

    //
  }
  private void loadGameGraphics() {

    if (gameTextureAtlas != null) {
      gameTextureAtlas.load();
    }

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/game/");
    gameTextureAtlas =
        new BuildableBitmapTextureAtlas(
            activity.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR);

    backgroundGameTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTextureAtlas, activity, "background.png");
    buttonOkTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTextureAtlas, activity, "button_ok.png");
    buttonNoTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTextureAtlas, activity, "button_no.png");
    lifeBarBorderTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTextureAtlas, activity, "bar_border.png");

    playerRegion =
        BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(
            gameTextureAtlas, activity, "blackFish.png", 2, 1);

    try {
      gameTextureAtlas.build(
          new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 0, 1));
      gameTextureAtlas.load();
    } catch (ITextureAtlasBuilder.TextureAtlasBuilderException e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 19
0
  @Override
  protected void onCreateResources() throws IOException { // #2
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath(
        "gfx/"); // indicamos donde están las imágenes
    myAtlas =
        new BitmapTextureAtlas(
            getTextureManager(),
            1000,
            1000,
            TextureOptions.DEFAULT); // Atlas lugar en memoria donde estaran las iamgenes
    celdaTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            myAtlas, this, "celda.png", 0, 0); // ubicamos la imagen en el atlas

    myAtlas.load();
  }
Ejemplo n.º 20
0
  public void loadResources() {
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
    TA =
        new BuildableBitmapTextureAtlas(
            this.activity.getTextureManager(),
            1024,
            1024,
            BitmapTextureFormat.RGBA_4444,
            TextureOptions.BILINEAR_PREMULTIPLYALPHA);
    map.loadResources(TA);

    creditsTR =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(TA, activity, "menu/credits.png");
    homeTR = BitmapTextureAtlasTextureRegionFactory.createFromAsset(TA, activity, "home.png");
    gamebyTR =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            TA, this.activity, "credits/game by.png");
    zarokhanTR =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            TA, this.activity, "credits/zarokhan.png");
    robinTR =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            TA, this.activity, "credits/robin.png");
    musicbyTR =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            TA, this.activity, "credits/music by.png");
    alexTR =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            TA, this.activity, "credits/alexander.png");

    font =
        FontFactory.create(
            this.activity.getFontManager(),
            this.activity.getTextureManager(),
            256,
            256,
            Typeface.create(Typeface.DEFAULT, Typeface.NORMAL),
            GameManager.lengthOfTile);
    font.load();

    try {
      TA.build(
          new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(1, 1, 0));
      TA.load();
    } catch (TextureAtlasBuilderException e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 21
0
 @Override
 protected void loadResourcesImpl() {
   mBgTextureRegion =
       AEUtils.createTextureRegionFromAssets("gfx/storm_flush_bg.png", mBaseActivity);
   mFont = AEUtils.createGameFont(mBaseActivity);
   BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
   mItemTexture =
       new BitmapTextureAtlas(this.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR);
   mLocTextureRegion =
       BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(
           mItemTexture, mBaseActivity, "item_names.png", 0, 0, 1, 3);
   mMessageBox =
       BitmapTextureAtlasTextureRegionFactory.createFromAsset(
           mItemTexture, mBaseActivity, "msg_storm_flush.png", 0, 80);
   mBgTextureRegion.getTexture().load();
   mItemTexture.load();
   mFont.load();
 }
Ejemplo n.º 22
0
  public Sprite getMenuBackground() {
    mMenuBackgroundRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            mBuildableBitmapTextureAtlas, Game.getContext(), "menuback.png");
    try {
      mBuildableBitmapTextureAtlas.build(
          new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 0, 1));
      mBuildableBitmapTextureAtlas.load();
    } catch (TextureAtlasBuilderException e) {
      e.printStackTrace();
    }
    mMenuBackgroundSprite =
        new Sprite(0, 0, mMenuBackgroundRegion, Game.getContext().getVertexBufferObjectManager());
    mMenuBackgroundSprite.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    mMenuBackgroundSprite.setAlpha(0.2f);

    return mMenuBackgroundSprite;
  }
Ejemplo n.º 23
0
 public SceneSprite(String spritePath, int width, int height, float posX, float posY) {
   this.sceneTextureAtlas =
       new BitmapTextureAtlas(
           (TextureManager) Global.getResource(Global.TEXTURE_MANAGER),
           width,
           height,
           TextureOptions.BILINEAR);
   this.sceneTextureRegion =
       BitmapTextureAtlasTextureRegionFactory.createFromAsset(
           this.sceneTextureAtlas,
           (Context) Global.getResource(Global.MAIN_ACTIVITY),
           spritePath,
           0,
           0);
   this.sceneSprite =
       new Sprite(
           posX,
           posY,
           this.sceneTextureRegion,
           (VertexBufferObjectManager) Global.getResource(Global.VERTEX_BUFFERED_OBJECT_MANAGER));
 }
Ejemplo n.º 24
0
  @Override
  public void onCreateResources(OnCreateResourcesCallback pOnCreateResourcesCallback)
      throws Exception {
    // TODO Auto-generated method stub

    this.mFontTexture =
        new BitmapTextureAtlas(
            this.getTextureManager(), 256, 256, TextureOptions.BILINEAR_PREMULTIPLYALPHA);

    FontFactory.setAssetBasePath("font/");
    mFont =
        FontFactory.createFromAsset(
            this.getFontManager(),
            this.mFontTexture,
            this.getAssets(),
            "texas.ttf",
            60.0f,
            true,
            Color.BLACK);
    mFont.load();

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

    texBanana =
        new BitmapTextureAtlas(
            this.getTextureManager(), 256, 128, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
    regBanana =
        BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(
            texBanana, this.getAssets(), "spr_banana.png", 0, 0, SPR_COLUMN, SPR_ROWS);
    texBanana.load();

    mMenuTexture =
        new BitmapTextureAtlas(this.getTextureManager(), 1024, 512, TextureOptions.BILINEAR);
    mMenuTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            mMenuTexture, this.getAssets(), "menu.png", 0, 0);
    mMenuTexture.load();

    pOnCreateResourcesCallback.onCreateResourcesFinished();
  }
  @Override
  public void load(Context context, Engine engine) {
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/main-menu/");

    BuildableBitmapTextureAtlas bitmapTextureAtlas =
        new BuildableBitmapTextureAtlas(
            engine.getTextureManager(),
            1024,
            1024,
            BitmapTextureFormat.RGBA_8888,
            TextureOptions.BILINEAR);

    backgroundTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            bitmapTextureAtlas, context, "background.png");
    titleTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            bitmapTextureAtlas, context, "title.png");
    easyUnlockTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            bitmapTextureAtlas, context, "easy_unlock.png");
    normalUnlockTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            bitmapTextureAtlas, context, "normal_unlock.png");
    hardUnlockTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            bitmapTextureAtlas, context, "hard_unlock.png");
    normalLockTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            bitmapTextureAtlas, context, "normal_lock.png");
    hardLockTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            bitmapTextureAtlas, context, "hard_lock.png");

    try {
      bitmapTextureAtlas.build(
          new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 0, 0));
      bitmapTextureAtlas.load();
    } catch (TextureAtlasBuilderException e) {
      Debug.e(e);
    }
  }
Ejemplo n.º 26
0
  public void loadMenuResources() {
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
    ResourceManager.playBitmapTextureAtlas =
        new BitmapTextureAtlas(activity.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
    ResourceManager.optionsBitmapTextureAtlas =
        new BitmapTextureAtlas(activity.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
    ResourceManager.scoresBitmapTextureAtlas =
        new BitmapTextureAtlas(activity.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
    ResourceManager.instructionsTextureAtlas =
        new BitmapTextureAtlas(activity.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
    ResourceManager.exitBitmapTextureAtlas =
        new BitmapTextureAtlas(activity.getTextureManager(), 256, 256, TextureOptions.BILINEAR);

    // load the button texture regions
    mMenuBgTextureAtlas =
        new BitmapTextureAtlas(
            activity.getTextureManager(),
            (int) camera.getWidth(),
            (int) camera.getHeight(),
            TextureOptions.DEFAULT);

    mBgTexture =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            mMenuBgTextureAtlas, activity, "image.jpg", 0, 0);
    ResourceManager.newGameTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            ResourceManager.playBitmapTextureAtlas, activity, "new_game.PNG", 0, 0);
    ResourceManager.optionsTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            ResourceManager.optionsBitmapTextureAtlas, activity, "settings1.png", 0, 0);
    ResourceManager.quitTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            ResourceManager.exitBitmapTextureAtlas, activity, "exit.PNG", 0, 50);
    ResourceManager.scoresTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            ResourceManager.scoresBitmapTextureAtlas, activity, "menu_reset.png", 0, 0);
    ResourceManager.instructionsTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            ResourceManager.instructionsTextureAtlas, activity, "instructions.PNG", 0, 0);

    ResourceManager.optionsBitmapTextureAtlas.load();
    ResourceManager.playBitmapTextureAtlas.load();
    ResourceManager.scoresBitmapTextureAtlas.load();
    ResourceManager.instructionsTextureAtlas.load();
    ResourceManager.exitBitmapTextureAtlas.load();
    ResourceManager.mMenuBgTextureAtlas.load();
  }
  private void loadMainMenuGraphics() {

    if (menuTextureAtlas != null) {
      menuTextureAtlas.load();
      return;
    }

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/menu/");
    menuTextureAtlas =
        new BuildableBitmapTextureAtlas(
            activity.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR);

    menuBackgroundTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            menuTextureAtlas, activity, "background.jpg");
    buttonAboutTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            menuTextureAtlas, activity, "menu_help.png");
    buttonExitTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            menuTextureAtlas, activity, "menu_exit.png");
    buttonNewGameTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            menuTextureAtlas, activity, "menu_new.png");
    buttonOptionsTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            menuTextureAtlas, activity, "menu_options.png");
    buttonHighScoreTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            menuTextureAtlas, activity, "menu_high.png");
    buttonMultiplayerTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            menuTextureAtlas, activity, "menu_multiplayer.png");

    try {
      menuTextureAtlas.build(
          new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 0, 1));
      menuTextureAtlas.load();
    } catch (ITextureAtlasBuilder.TextureAtlasBuilderException e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 28
0
  public static IBackground createImageBackground(
      final TextureManager textureManager,
      final int textureWidth,
      final int textureHeight,
      final String fileName,
      final VertexBufferObjectManager vertexBufferObjectManager) {
    final Context context = ContextManager.getInstance().getContext();

    final BitmapTextureAtlas bitmapTextureAtlas =
        new BitmapTextureAtlas(
            textureManager, textureWidth, textureHeight, TextureOptions.BILINEAR_PREMULTIPLYALPHA);

    final TextureRegion textureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            bitmapTextureAtlas, context, fileName, 0, 0);

    bitmapTextureAtlas.load();

    final Sprite sprite = new Sprite(0, 0, textureRegion, vertexBufferObjectManager);

    return new SpriteBackground(sprite);
  }
  private void loadHighScoreGraphics() {
    if (recordTextureAtlas != null) {
      recordTextureAtlas.load();
    }

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/highscore/");

    recordTextureAtlas =
        new BuildableBitmapTextureAtlas(
            activity.getTextureManager(), 1024, 512, TextureOptions.BILINEAR);
    recordBackgroundTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            recordTextureAtlas, activity, "background.png");

    try {
      recordTextureAtlas.build(
          new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 0, 0));
      recordTextureAtlas.load();
    } catch (ITextureAtlasBuilder.TextureAtlasBuilderException e) {
      e.printStackTrace();
    }
  }
  private void loadGameTypeGraphics() {
    if (gameTypeTextureAtlas != null) {
      gameTypeTextureAtlas.load();
    }

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/gametype/");
    gameTypeTextureAtlas =
        new BuildableBitmapTextureAtlas(
            activity.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR);

    backgroundGameTypeTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTypeTextureAtlas, activity, "background.png");

    starGoldTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTypeTextureAtlas, activity, "goldStar.png");
    starWhiteTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTypeTextureAtlas, activity, "whiteStar.png");
    awesomeTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTypeTextureAtlas, activity, "awesome.png");
    lockTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTypeTextureAtlas, activity, "lock.png");
    playButtonTextureRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            gameTypeTextureAtlas, activity, "playButton.png");

    try {
      gameTypeTextureAtlas.build(
          new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(1, 1, 1));
      gameTypeTextureAtlas.load();
    } catch (ITextureAtlasBuilder.TextureAtlasBuilderException e) {
      e.printStackTrace();
    }
  }