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


Java Texture.load方法代码示例

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


在下文中一共展示了Texture.load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadLocale

import org.andengine.opengl.texture.Texture; //导入方法依赖的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

示例2: SessionSprite

import org.andengine.opengl.texture.Texture; //导入方法依赖的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


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