• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BitmapTexture类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getTextureFromAsset

import org.andengine.opengl.texture.bitmap.BitmapTexture; //导入依赖的package包/类
private TextureRegion getTextureFromAsset(final String path) {
    try {
        texture = new BitmapTexture(engine.getTextureManager(), new IInputStreamOpener() {
            @Override
            public InputStream open() throws IOException {
                return context.getAssets().open("gfx/" + path); // path of the image
            }
        }, TextureOptions.BILINEAR);
        texture.load();
        return TextureRegionFactory.extractFromTexture(texture);
    } catch (IOException e) {
        e.printStackTrace();
        Log.e(ASSETS_ERROR_TAG, e.toString());
    }
    return null;
}
 
开发者ID:viniciusDSL,项目名称:One-Cachito,代码行数:17,代码来源:ResourceManager.java


示例2: getTiledTextureFromAsset

import org.andengine.opengl.texture.bitmap.BitmapTexture; //导入依赖的package包/类
private TiledTextureRegion getTiledTextureFromAsset(final String path, int rows, int columns) {
    try {
        texture = new BitmapTexture(engine.getTextureManager(), new IInputStreamOpener() {
            @Override
            public InputStream open() throws IOException {
                return context.getAssets().open("gfx/" + path); // path of the image
            }
        }, TextureOptions.BILINEAR);
        texture.load();
        return TextureRegionFactory.extractTiledFromTexture(texture, rows, columns);
    } catch (IOException e) {
        e.printStackTrace();
        Log.e(ASSETS_ERROR_TAG, e.toString());
    }
    return null;
}
 
开发者ID:viniciusDSL,项目名称:One-Cachito,代码行数:17,代码来源:ResourceManager.java


示例3: BitmapFontPage

import org.andengine.opengl.texture.bitmap.BitmapTexture; //导入依赖的package包/类
public BitmapFontPage(final AssetManager pAssetManager, final String pAssetBasePath, final String pData) throws IOException {
	final String[] pageAttributes = TextUtils.SPLITPATTERN_SPACE.split(pData, BitmapFont.TAG_PAGE_ATTRIBUTECOUNT + 1);

	if ((pageAttributes.length - 1) != BitmapFont.TAG_PAGE_ATTRIBUTECOUNT) {
		throw new FontException("Expected: '" + BitmapFont.TAG_PAGE_ATTRIBUTECOUNT + "' " + BitmapFont.TAG_PAGE + " attributes, found: '" + (pageAttributes.length - 1) + "'.");
	}
	if (!pageAttributes[0].equals(BitmapFont.TAG_PAGE)) {
		throw new FontException("Expected: '" + BitmapFont.TAG_PAGE + "' attributes.");
	}

	this.mID = BitmapFont.getIntAttribute(pageAttributes, BitmapFont.TAG_PAGE_ATTRIBUTE_ID_INDEX, BitmapFont.TAG_PAGE_ATTRIBUTE_ID);
	final String file = BitmapFont.getStringAttribute(pageAttributes, BitmapFont.TAG_PAGE_ATTRIBUTE_FILE_INDEX, BitmapFont.TAG_PAGE_ATTRIBUTE_FILE);

	final String assetPath = pAssetBasePath + file;
	this.mTexture = new BitmapTexture(BitmapFont.this.mTextureManager, new AssetInputStreamOpener(pAssetManager, assetPath), BitmapFont.this.mBitmapTextureFormat, BitmapFont.this.mTextureOptions);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:17,代码来源:BitmapFont.java


示例4: uploadTexture

import org.andengine.opengl.texture.bitmap.BitmapTexture; //导入依赖的package包/类
public void uploadTexture(final String assetPath) throws IOException {
    if (mTextures.containsKey(assetPath)) {
        return;
    }
    final BaseGameActivity gameActivity = mActivityReference.get();
    if (gameActivity == null) {
        return;
    }
    ITexture texture = new BitmapTexture(gameActivity.getTextureManager(), new IInputStreamOpener() {
        @Override
        public InputStream open() throws IOException {
            return gameActivity.getAssets().open(assetPath);
        }
    });
    texture.load();
    mTextures.put(assetPath, texture);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:18,代码来源:ResourcesManager.java


示例5: addTextureAndLoad

import org.andengine.opengl.texture.bitmap.BitmapTexture; //导入依赖的package包/类
public void addTextureAndLoad(final String assetPath) throws IOException {
    if (resources.containsKey(assetPath)) {
        return;
    }
    final BaseGameActivity gameActivity = mActivityReference.get();
    if (gameActivity == null) {
        return;
    }
    ITexture texture = new BitmapTexture(gameActivity.getTextureManager(), new IInputStreamOpener() {
        @Override
        public InputStream open() throws IOException {
            return gameActivity.getAssets().open(assetPath);
        }
    });
    resources.put(assetPath, texture);
    texture.load();
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:18,代码来源:GameResources.java


示例6: BitmapFontPage

import org.andengine.opengl.texture.bitmap.BitmapTexture; //导入依赖的package包/类
public BitmapFontPage(final AssetManager pAssetManager, final String pAssetBasePath, final String pData) throws IOException {
	final String[] pageAttributes = TextUtils.SPLITPATTERN_SPACE.split(pData, BitmapFont.TAG_PAGE_ATTRIBUTECOUNT + 1);

	if((pageAttributes.length - 1) != BitmapFont.TAG_PAGE_ATTRIBUTECOUNT) {
		throw new FontException("Expected: '" + BitmapFont.TAG_PAGE_ATTRIBUTECOUNT + "' " + BitmapFont.TAG_PAGE + " attributes, found: '" + (pageAttributes.length - 1) + "'.");
	}
	if(!pageAttributes[0].equals(BitmapFont.TAG_PAGE)) {
		throw new FontException("Expected: '" + BitmapFont.TAG_PAGE + "' attributes.");
	}

	this.mID = BitmapFont.getIntAttribute(pageAttributes, BitmapFont.TAG_PAGE_ATTRIBUTE_ID_INDEX, BitmapFont.TAG_PAGE_ATTRIBUTE_ID);
	final String file = BitmapFont.getStringAttribute(pageAttributes, BitmapFont.TAG_PAGE_ATTRIBUTE_FILE_INDEX, BitmapFont.TAG_PAGE_ATTRIBUTE_FILE);

	final String assetPath = pAssetBasePath + file;
	this.mTexture = new BitmapTexture(BitmapFont.this.mTextureManager, new AssetInputStreamOpener(pAssetManager, assetPath), BitmapFont.this.mBitmapTextureFormat, BitmapFont.this.mTextureOptions);
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:17,代码来源:BitmapFont.java


示例7: getTexture

import org.andengine.opengl.texture.bitmap.BitmapTexture; //导入依赖的package包/类
TextureRegion getTexture(final String path) {

        try {
            ITexture texture = new BitmapTexture(textureManager, new IInputStreamOpener() {

                        @Override
                        public InputStream open() throws IOException {

                            return assetManager.open(path);
                        }
                    }, TextureOptions.BILINEAR);

            return TextureRegionFactory.extractFromTexture(texture);
        } catch (IOException e) {
            e.printStackTrace();
        }

        return null;
    }
 
开发者ID:djschilling,项目名称:sopa,代码行数:20,代码来源:ResourceLoader.java


示例8: doInBackground

import org.andengine.opengl.texture.bitmap.BitmapTexture; //导入依赖的package包/类
@Override
protected Sprite doInBackground(final String... params) {
    try {
        ITexture mTexture = new BitmapTexture(engine.getTextureManager(), new IInputStreamOpener() {
            @Override
            public InputStream open() throws IOException {

                URL url = new URL(params[0]);

                HttpURLConnection connection = (HttpURLConnection) url.openConnection();
                connection.setDoInput(true);
                connection.connect();
                InputStream input = connection.getInputStream();
                return new BufferedInputStream(input);
            }
        });
        mTexture.load();
        textureRegionAnotherPlayer = TextureRegionFactory.extractFromTexture(mTexture);
        if (GameManager.getInstance() != null && GameManager.getInstance().players != null &&
                GameManager.getInstance().players.length > 0 && engine != null) {
            IEntity entity = GameManager.getInstance().players[1].tabSprite;
            Sprite user = new Sprite(0, 0, textureRegionAnotherPlayer, engine.getVertexBufferObjectManager());
            user.setWidth(entity.getHeight() - 27);
            user.setHeight(entity.getHeight() - 27);
            user.setX(-13 + entity.getWidth() / 2);
            user.setY(+4 + entity.getHeight() / 2);
            return user;
        }

    } catch (IOException e) {
        Debug.e(e);
    }
    return null;
}
 
开发者ID:viniciusDSL,项目名称:One-Cachito,代码行数:35,代码来源:ResourceManager.java


示例9: getTexture

import org.andengine.opengl.texture.bitmap.BitmapTexture; //导入依赖的package包/类
public synchronized ITexture getTexture(final String pID, final IInputStreamOpener pInputStreamOpener, final BitmapTextureFormat pBitmapTextureFormat, final TextureOptions pTextureOptions, final boolean pLoadToHardware) throws IOException {
	if (this.hasMappedTexture(pID)) {
		return this.getMappedTexture(pID);
	} else {
		final ITexture texture = new BitmapTexture(this, pInputStreamOpener, pBitmapTextureFormat, pTextureOptions);
		if (pLoadToHardware) {
			this.loadTexture(texture);
		}
		this.addMappedTexture(pID, texture);

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


示例10: getTexture

import org.andengine.opengl.texture.bitmap.BitmapTexture; //导入依赖的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 BitmapTexture(this, new AssetInputStreamOpener(pAssetManager, pAssetPath), pTextureOptions);
		this.loadTexture(texture);
		this.addMappedTexture(pID, texture);

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ASTMatcher类代码示例发布时间:2022-05-22
下一篇:
Java ParameterMap类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap