当前位置: 首页>>代码示例>>Java>>正文


Java AssetBitmapTexture类代码示例

本文整理汇总了Java中org.andengine.opengl.texture.bitmap.AssetBitmapTexture的典型用法代码示例。如果您正苦于以下问题:Java AssetBitmapTexture类的具体用法?Java AssetBitmapTexture怎么用?Java AssetBitmapTexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AssetBitmapTexture类属于org.andengine.opengl.texture.bitmap包,在下文中一共展示了AssetBitmapTexture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SplashScene

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
public SplashScene(TextureManager textureManager, AssetManager assetManager, VertexBufferObjectManager vbo, Camera camera) {
    super();
    this.setBackground(new Background(new Color(100, 100, 100)));
    try {
        splashTexture = new AssetBitmapTexture(textureManager, assetManager, "textures/splash.png", TextureOptions.BILINEAR);
        splashTextureRegion = TextureRegionFactory.extractFromTexture(splashTexture);
        splashTexture.load();
        splash = new Sprite(0, 0, splashTextureRegion, vbo);

        final float scale_factor = GameActivity.CAMERA_HEIGHT / splashTextureRegion.getHeight();
        splash.setScale(scale_factor+0.1f);
        splash.setPosition((camera.getWidth()) * 0.5f, (camera.getHeight()) * 0.5f);
        this.attachChild(splash);
    } catch (final IOException e) {
        System.err.println("Error loading splash!");
        e.printStackTrace(System.err);
    }
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:19,代码来源:SplashScene.java

示例2: loadLocaleGames

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
private void loadLocaleGames() throws IOException {
    List<Game> blockGames = locale.games;
    try {
        // Load game assets
        for (int i = 0; i < blockGames.size(); i++) {
            Game game = blockGames.get(i);
            Debug.d("Loading game sprite texture from " + game.sprite_texture);
            final AssetBitmapTexture gameSpriteTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, game.sprite_texture);
            gameSpriteTexture.load();
            this.gameTextures.put(game, gameSpriteTexture);
            this.gameSprites.put(game, TextureRegionFactory.extractTiledFromTexture(gameSpriteTexture, 0, 0, GAME_SPRITE_WIDTH * GAME_SPRITE_COLS, GAME_SPRITE_HEIGHT * GAME_SPRITE_ROWS, GAME_SPRITE_COLS, GAME_SPRITE_ROWS));

            Debug.d("Loading game block texture from " + game.block_texture);
            final AssetBitmapTexture gameTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, game.block_texture);
            gameTexture.load();
            int[] gameTileSize = GameTextures.calculateTileSize(game.columns, game.rows, game.height);
            Debug.d("Word "+game.name+" has size "+game.columns+"x"+game.rows+" and sprite size "+gameTileSize[0]+"x"+gameTileSize[1]);
            this.gameBlocks.put(game, TextureRegionFactory.extractTiledFromTexture(gameTexture, 0, 0, gameTileSize[0] * GAME_TEXTURE_COLS, gameTileSize[1] * GAME_TEXTURE_ROWS, GAME_TEXTURE_COLS, GAME_TEXTURE_ROWS));
        }

    } catch (final IOException e)
    {
        e.printStackTrace();
        throw e;
    }
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:27,代码来源:PhoeniciaGame.java

示例3: loadLocaleDecorations

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
private void loadLocaleDecorations() throws IOException {
    List<Decoration> blockDecorations = locale.decorations;
    try {
        // Load game assets
        for (int i = 0; i < blockDecorations.size(); i++) {
            Decoration decoration = blockDecorations.get(i);
            Debug.d("Loading decoration sprite texture from " + decoration.sprite_texture);
            final AssetBitmapTexture decorationSpriteTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, decoration.sprite_texture);
            decorationSpriteTexture.load();
            this.decorationTextures.put(decoration, decorationSpriteTexture);
            this.decorationSprites.put(decoration, TextureRegionFactory.extractTiledFromTexture(decorationSpriteTexture, 0, 0, DECORATION_SPRITE_WIDTH * DECORATION_SPRITE_COLS, DECORATION_SPRITE_HEIGHT * DECORATION_SPRITE_ROWS, DECORATION_SPRITE_COLS, DECORATION_SPRITE_ROWS));

            Debug.d("Loading decoration block texture from " + decoration.block_texture);
            final AssetBitmapTexture decorationTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, decoration.block_texture);
            decorationTexture.load();
            int[] decorationTileSize = GameTextures.calculateTileSize(decoration.columns, decoration.rows, decoration.height);
            Debug.d("Word "+decoration.name+" has size "+decoration.columns+"x"+decoration.rows+" and sprite size "+decorationTileSize[0]+"x"+decorationTileSize[1]);
            this.decorationBlocks.put(decoration, TextureRegionFactory.extractTiledFromTexture(decorationTexture, 0, 0, decorationTileSize[0] * DECORATION_TEXTURE_COLS, decorationTileSize[1] * DECORATION_TEXTURE_ROWS, DECORATION_TEXTURE_COLS, DECORATION_TEXTURE_ROWS));
        }

    } catch (final IOException e)
    {
        e.printStackTrace();
        throw e;
    }
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:27,代码来源:PhoeniciaGame.java

示例4: setSpotlight

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
public void setSpotlight(String texture) {
    try {
        final AssetBitmapTexture spotlight_texture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, texture);
        spotlight_texture.load();
        TextureRegion spotlight_region = TextureRegionFactory.extractFromTexture(spotlight_texture);
        this.clearSpotlight();
        this.spotlight = new Sprite(this.getWidth()/2, this.getHeight()/2, spotlight_region, PhoeniciaContext.vboManager);
        this.spotlight.setZIndex(this.guideSprite.getZIndex()-1);
        this.attachChild(this.spotlight);
        this.sortChildren();
    } catch (IOException e) {
        Debug.e("Failed to load spotlight texture: "+texture);
    }
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:15,代码来源:TourOverlay.java

示例5: LoadingScene

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
public LoadingScene(PhoeniciaGame game) {
    super();
    this.game = game;
    this.setBackground(new Background(new Color(100, 100, 100)));
    try {
        AssetBitmapTexture splashTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, "textures/loading.png", TextureOptions.BILINEAR);
        splashTextureRegion = TextureRegionFactory.extractFromTexture(splashTexture);
        splashTexture.load();
        splash = new Sprite(0, 0, splashTextureRegion, PhoeniciaContext.vboManager);

        final float scale_factor = (GameActivity.CAMERA_HEIGHT / splashTextureRegion.getHeight()) + 0.1f;
        splash.setScale(scale_factor);
        splash.setPosition((GameActivity.CAMERA_WIDTH) * 0.5f, (GameActivity.CAMERA_HEIGHT) * 0.5f);
        this.attachChild(splash);

        AssetBitmapTexture progressbarTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, "textures/progressbar.png", TextureOptions.BILINEAR);
        progressbarTexture.load();
        progressbarTextureRegion = TextureRegionFactory.extractFromTexture(progressbarTexture);
        progress = new ProgressBar((GameActivity.CAMERA_WIDTH + 5) * 0.5f, (125 * scale_factor), progressbarTextureRegion, PhoeniciaContext.vboManager);
        progress.setScale(scale_factor);
        this.attachChild(progress);

    } catch (final IOException e) {
        System.err.println("Error loading splash!");
        e.printStackTrace(System.err);
    }
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:28,代码来源:LoadingScene.java

示例6: loadLocale

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
private void loadLocale(ProgressDisplay progress) throws IOException {
    // Initialize game shell textures
    Texture newShell = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, this.locale.shell_src);
    newShell.load();
    GameUI.init(newShell);

    // For storing sound data
    blockSounds = new HashMap<String, Sound>();

    // Load background music
    try {
        this.music = MusicFactory.createMusicFromAsset(PhoeniciaContext.musicManager, PhoeniciaContext.context, locale.music_src);
        this.music.setLooping(true);
        this.music.setVolume(0.3f);
    } catch (Exception e) {
        Debug.e("Failed to load background music asset: "+locale.music_src);
    }

    progress.setProgress(0.3f);
    this.loadLocaleMap();
    progress.setProgress(0.4f);
    this.loadLocaleDefaults();
    this.loadLocalePeople();
    progress.setProgress(0.5f);
    this.loadLocaleTour();
    progress.setProgress(0.6f);
    this.loadLocaleNumbers();
    progress.setProgress(0.65f);
    this.loadLocaleLetters();
    progress.setProgress(0.7f);
    this.loadLocaleWords();
    progress.setProgress(0.8f);
    this.loadLocaleGames();
    progress.setProgress(0.9f);
    this.loadLocaleDecorations();
    this.loadLocaleLevels();
    progress.setProgress(0.99f);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:39,代码来源:PhoeniciaGame.java

示例7: loadLocaleDefaults

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
private void loadLocaleDefaults() throws IOException {
    try {

        inventoryTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, this.locale.inventoryBlock.block_texture);
        inventoryTexture.load();
        int[] inventoryTileSize = GameTextures.calculateTileSize(locale.inventoryBlock.columns, locale.inventoryBlock.rows, locale.inventoryBlock.height);
        inventoryTiles = TextureRegionFactory.extractTiledFromTexture(inventoryTexture, 0, 0, inventoryTileSize[0] * 4, inventoryTileSize[1] * 2, 4, 2);
        this.spriteMasks.put(inventoryTiles, AssetBitmapTextureAtlasSource.create(PhoeniciaContext.assetManager, this.locale.inventoryBlock.block_texture).onLoadBitmap(Bitmap.Config.ALPHA_8));

        marketTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, this.locale.marketBlock.block_texture);
        marketTexture.load();
        int[] marketTileSize = GameTextures.calculateTileSize(locale.marketBlock.columns, locale.marketBlock.rows, locale.marketBlock.height);
        marketTiles = TextureRegionFactory.extractTiledFromTexture(marketTexture, 0, 0, marketTileSize[0] * 4, marketTileSize[1] * 2, 4, 2);
        this.spriteMasks.put(marketTiles, AssetBitmapTextureAtlasSource.create(PhoeniciaContext.assetManager, this.locale.marketBlock.block_texture).onLoadBitmap(Bitmap.Config.ALPHA_8));

        workshopTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, this.locale.workshopBlock.block_texture);
        workshopTexture.load();
        int[] workshopTileSize = GameTextures.calculateTileSize(locale.workshopBlock.columns, locale.workshopBlock.rows, locale.workshopBlock.height);
        workshopTiles = TextureRegionFactory.extractTiledFromTexture(workshopTexture, 0, 0, workshopTileSize[0] * 4, workshopTileSize[1] * 2, 4, 2);
        this.spriteMasks.put(workshopTiles, AssetBitmapTextureAtlasSource.create(PhoeniciaContext.assetManager, this.locale.workshopBlock.block_texture).onLoadBitmap(Bitmap.Config.ALPHA_8));

    } catch (final IOException e) {
        e.printStackTrace();
        throw e;
    }

}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:28,代码来源:PhoeniciaGame.java

示例8: loadLocalePeople

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
private void loadLocalePeople() throws IOException {
    for (Person person : this.locale.people) {
        try {
            AssetBitmapTexture texture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, person.texture_src);
            texture.load();
            this.personTextures.put(person, texture);
            this.personTiles.put(person, TextureRegionFactory.extractFromTexture(texture, 0, 0, PERSON_TILE_WIDTH, PERSON_TILE_HEIGHT));
        } catch (final IOException e) {
            e.printStackTrace();
            throw e;
        }
    }
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:14,代码来源:PhoeniciaGame.java

示例9: getTexture

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
public synchronized ITexture getTexture(final String pID, final AssetManager pAssetManager, final String pAssetPath, final TextureOptions pTextureOptions) throws IOException {
	if (this.hasMappedTexture(pID)) {
		return this.getMappedTexture(pID);
	} else {
		final ITexture texture = new AssetBitmapTexture(this, pAssetManager, pAssetPath, pTextureOptions);
		this.loadTexture(texture);
		this.addMappedTexture(pID, texture);

		return texture;
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:12,代码来源:TextureManager.java

示例10: onCreateResources

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
@Override
protected void onCreateResources() throws IOException {
    mTexture = new AssetBitmapTexture(getTextureManager(), getAssets(), "player.png");
    mTextureRegion = TextureRegionFactory.extractFromTexture(mTexture);
    mTexture.load();

    mBitmapTextureAtlas = new BitmapTextureAtlas(getTextureManager(), 100, 100, TextureOptions.BILINEAR);
    mTiledTextureRegion = BitmapTextureAtlasTextureRegionFactory
            .createTiledFromAsset(mBitmapTextureAtlas, getAssets(), "npc-oldman1.png", 0, 0, 4, 1);

    mBitmapTextureAtlas.load();
}
 
开发者ID:Phonbopit,项目名称:30-android-libraries-in-30-days,代码行数:13,代码来源:AndEngineActivity.java

示例11: load

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
@Override
public void load(BaseGameActivity activity) throws IOException {
	ITexture scaleTexture = new AssetBitmapTexture(activity.getTextureManager(), activity.getAssets(), scaleTextureName, TextureOptions.BILINEAR);
	this.scaleTextureRegion = TextureRegionFactory.extractFromTexture(scaleTexture);
	scaleTexture.load();
	ITexture labelsTexture = new AssetBitmapTexture(activity.getTextureManager(),activity.getAssets(), this.labelsTextureName, TextureOptions.BILINEAR);
	this.labelsTextureRegion = TextureRegionFactory.extractFromTexture(labelsTexture);
	labelsTexture.load();
	ITexture arrowTexture = new AssetBitmapTexture(activity.getTextureManager(),activity.getAssets(), this.arrowTextureName, TextureOptions.BILINEAR);
	this.arrowTextureRegion = TextureRegionFactory.extractFromTexture(arrowTexture);
	arrowTexture.load();
}
 
开发者ID:mmlevin,项目名称:secu3droid,代码行数:13,代码来源:GaugeAnalog.java

示例12: load

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
@Override
public void load(BaseGameActivity activity) throws IOException {
	if (textureName != null) {
		ITexture texture = new AssetBitmapTexture(activity.getTextureManager(),activity.getAssets(), this.textureName, TextureOptions.BILINEAR);
		this.textureRegion = TextureRegionFactory.extractFromTexture(texture);
		texture.load();
	}		
	
	int count = gauges.size();
	for (int i = 0;  i != count; i++) {
		gauges.get(i).load(activity);
	}			
}
 
开发者ID:mmlevin,项目名称:secu3droid,代码行数:14,代码来源:DashBoard.java

示例13: SessionSelectionScene

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
public SessionSelectionScene(final PhoeniciaGame game) {
    super();
    this.game = game;

    this.sessionSprites = new ArrayList<SessionSprite>();

    this.setBackground(new Background(new Color(100, 100, 100)));
    try {
        backgroundTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, "textures/session_selection_background.png", TextureOptions.BILINEAR);
        backgroundTextureRegion = TextureRegionFactory.extractFromTexture(backgroundTexture);
        backgroundTexture.load();
        background = new Sprite(0, 0, backgroundTextureRegion, PhoeniciaContext.vboManager);

        //background.setScale(1.5f);
        background.setPosition(GameActivity.CAMERA_WIDTH/2, GameActivity.CAMERA_HEIGHT/2);
        this.attachChild(background);
    } catch (final IOException e) {
        System.err.println("Error loading background!");
        e.printStackTrace(System.err);
    }

    List<GameSession> sessions = GameSession.objects(PhoeniciaContext.context).all().toList();
    Debug.d("Number of Sessions: "+sessions.size());

    Scrollable sessions_pane = new Scrollable(GameActivity.CAMERA_WIDTH/2, (GameActivity.CAMERA_HEIGHT/2)+100, GameActivity.CAMERA_WIDTH, 350, Scrollable.SCROLL_HORIZONTAL);
    sessions_pane.setPadding(16);
    this.attachChild(sessions_pane);
    this.registerTouchArea(sessions_pane);

    float startY = sessions_pane.getHeight() / 2;
    float startX = (sessions_pane.getWidth() / 2) - ((sessions.size()-1) * 136);
    if (startX < 136) {
        startX = 136f;
    }

    float offsetX = 0;
    for (int i = 0; i < sessions.size(); i++) {
        final GameSession session = sessions.get(i);

        SessionSprite sprite = new SessionSprite(startX + (272 * offsetX), startY, session, PhoeniciaContext.vboManager);
        this.registerTouchArea(sprite);
        sessions_pane.attachChild(sprite);

        sessionSprites.add(sprite);
        offsetX++;

    }

    //Button new_button = new Button(GameActivity.CAMERA_WIDTH/2, 100, 400, 100, "Mchezo Mpya", PhoeniciaContext.vboManager, new Button.OnClickListener() {
    Button new_button = new Button(GameActivity.CAMERA_WIDTH/2, 100, 400, 100, "New Game", PhoeniciaContext.vboManager, new Button.OnClickListener() {
        @Override
        public void onClicked(Button button) {
            newGame();
        }
    });
    this.attachChild(new_button);
    this.registerTouchArea(new_button);

    game.activity.getEngine().registerUpdateHandler(this);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:61,代码来源:SessionSelectionScene.java

示例14: SessionSprite

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
public SessionSprite(float px, float py, GameSession session, VertexBufferObjectManager vbo) {
    super(px, py, PhoeniciaGame.PERSON_TILE_WIDTH, PhoeniciaGame.PERSON_TILE_HEIGHT+32);
    Debug.d("Adding SessionSprite as "+px+","+py);
    this.session = session;
    if (session.session_name.get() == null) {
        Debug.d("Session has no name, setting it to Player " + (sessionSprites.size() + 1));
        session.session_name.set("Player "+(sessionSprites.size()+1));
        //session.session_name.set("Mchezaji"+(sessionSprites.size()+1));
        session.save(PhoeniciaContext.context);
    }
    Debug.i("Adding Game session: " + session.session_name.get() + " in " + session.locale_pack.get());
    LocaleLoader localeLoader = new LocaleLoader();
    Locale session_locale;
    try {
        session_locale = localeLoader.load(PhoeniciaContext.assetManager.open(session.locale_pack.get()));
        Person currentPerson = session_locale.person_map.get(session.person_name.get());
        if (currentPerson == null) {
            Debug.w("Game Session without person!");
            // TODO: use an "unknown user" image instead
            int person_index = sessionSprites.size() % session_locale.people.size();
            currentPerson = session_locale.people.get(person_index);
            session.person_name.set(currentPerson.name);
            session.save(PhoeniciaContext.context);
        }
        AssetBitmapTexture texture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, currentPerson.texture_src);
        texture.load();
        ITextureRegion personRegion = TextureRegionFactory.extractFromTexture(texture, 0, 0, game.PERSON_TILE_WIDTH, game.PERSON_TILE_HEIGHT);

        block = new ButtonSprite(this.getWidth()/2, py, personRegion, PhoeniciaContext.vboManager);

        personName = new Text(block.getWidth()/2, -16, GameFonts.dialogText(), session.session_name.get(), session.session_name.get().length(),  new TextOptions(AutoWrap.WORDS, 256, HorizontalAlign.CENTER), PhoeniciaContext.vboManager);
        //block.attachChild(personName);

        Texture newShell = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, session_locale.shell_src);
        newShell.load();
        final int GU = 96;
        ITextureRegion levelRegion = TextureRegionFactory.extractFromTexture(newShell, GU*5, GU*0, GU*3, GU*1);
        final ButtonSprite levelIcon = new ButtonSprite(block.getWidth()/2, (0 - levelRegion.getHeight()/2), levelRegion, PhoeniciaContext.vboManager);
        String current_level = session.current_level.get();
        if (current_level == null) current_level = "0";
        final Text levelName = new Text(160, levelIcon.getHeight()/2, GameFonts.defaultHUDDisplay(), current_level, 4, PhoeniciaContext.vboManager);
        levelIcon.attachChild(levelName);
        block.attachChild(levelIcon);

        this.attachChild(block);

    } catch (final IOException e) {
        Debug.e("Failed to load game session person!", e);
    }

    clickDetector = new ClickDetector(this);
    holdDetector = new HoldDetector(this);
    holdDetector.setTriggerHoldMinimumMilliseconds(2000);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:55,代码来源:SessionSelectionScene.java

示例15: LevelIntroHUD

import org.andengine.opengl.texture.bitmap.AssetBitmapTexture; //导入依赖的package包/类
/**
 * Display level transition text pages, images and sound.
 * @param game Reference to the PhoeniciaGame this HUD is running in
 * @param level The level to display introduction pages for
 */
public LevelIntroHUD(final PhoeniciaGame game, final Level level) {
    super(game);
    this.setBackgroundEnabled(false);
    this.game = game;
    this.level = level;
    this.current_page = 0;
    this.setOnSceneTouchListener(this);

    Debug.d("New level guide: "+game.locale.tour.guide.name);
    this.guideSprite = new Sprite(-112, 160, game.personTiles.get(game.locale.tour.guide), PhoeniciaContext.vboManager);
    this.attachChild(guideSprite);
    final float messageBoxWidth = this.getWidth()-this.guideSprite.getWidth()-32;
    final float messageBoxHeight = 256;

    String texture = "textures/tour/tour-focus-none.png";
    try {
        final AssetBitmapTexture spotlight_texture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, texture);
        spotlight_texture.load();
        TextureRegion spotlight_region = TextureRegionFactory.extractFromTexture(spotlight_texture);
        Sprite backdrop = new Sprite(this.getWidth()/2, this.getHeight()/2, spotlight_region, PhoeniciaContext.vboManager);
        backdrop.setZIndex(guideSprite.getZIndex()-1);
        this.attachChild(backdrop);
        this.sortChildren();
    } catch (IOException e) {
        Debug.e("Failed to load spotlight texture: "+texture);
    }

    Debug.d("New Level into guide sprite width: "+this.guideSprite.getWidth());
    this.messageBox = new BorderRectangle((messageBoxWidth/2)+this.guideSprite.getWidth(), this.guideSprite.getY(), messageBoxWidth, messageBoxHeight, PhoeniciaContext.vboManager);
    this.messageBox.setColor(Color.WHITE);
    this.attachChild(messageBox);
    this.registerTouchArea(messageBox);

    ITextureRegion nextRegion = GameUI.getInstance().getNextIcon();
    this.nextButton = new ButtonSprite(messageBox.getWidth() - 48, 50, nextRegion, PhoeniciaContext.vboManager);
    this.nextButton.setOnClickListener(new ButtonSprite.OnClickListener() {
        @Override
        public void onClick(ButtonSprite buttonSprite, float v, float v1) {
            if (current_page+1 < level.intro.size()) {
                nextButton.setVisible(false);
                showPage(current_page + 1);
            } else {
                finish();
            }
        }
    });
    this.nextButton.setVisible(false);
    this.registerTouchArea(this.nextButton);
    this.messageBox.attachChild(this.nextButton);
    Debug.d("Finished instantiating LevelIntroHUD");

    this.clickDetector = new ClickDetector(this);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:59,代码来源:LevelIntroHUD.java


注:本文中的org.andengine.opengl.texture.bitmap.AssetBitmapTexture类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。