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


Java Texture.setFilter方法代码示例

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


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

示例1: create

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
@Override
public void create() {		
	float w = Gdx.graphics.getWidth();
	float h = Gdx.graphics.getHeight();
	
	camera = new OrthographicCamera(1, h/w);
	batch = new SpriteBatch();
	
	texture = new Texture(Gdx.files.internal("data/libgdx.png"));
	texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
	
	TextureRegion region = new TextureRegion(texture, 0, 0, 200, 200);
	
	sprite = new Sprite(region);
	sprite.setSize(1f,  sprite.getHeight() / sprite.getWidth());
	sprite.setOrigin(sprite.getWidth()/2, sprite.getHeight()/2);
	sprite.setPosition(-.5f, -.5f);

}
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:20,代码来源:MyGdxGame.java

示例2: drawtopcombat

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
private void drawtopcombat(){
    groupTop = new Group();
    Texture lookup = managerAssets.getAssetsCombat().getTexture(NameFiles.progressbarcircular);
    lookup.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    progressBarEnergy = ProgressBarEnergy.getInstance();
    Image imageLeftprofile = new Image(new TextureRegion(managerAssets.getAssetsButton().get(NameFiles.buttonBack1)));
    imageLeftprofile.setSize(Gdx.graphics.getWidth() * 0.15f, Gdx.graphics.getWidth() * 0.15f);
    imageLeftprofile.setPosition(imageLeftprofile.getWidth() * 0.1f, Gdx.graphics.getHeight() - imageLeftprofile.getHeight() * 1.1f);
    imageLeftprofile.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if(InformationProfile.getInstance().getDateUserGame().getEnklaveCombatId() == -1)
                gameManager.setScreen(gameManager.screenEnklave);
            else
                dialogExit("You can't out from combat!");
        }
    });
    groupTop.addActor(imageLeftprofile);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:20,代码来源:ScreenCombat.java

示例3: show

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
@Override
public void show() {
    bg = new Texture("BG.png");
    bg.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);

    stage = new Stage();
    Gdx.input.setInputProcessor(stage);

    if (skin == null)
        createBasicSkin();

    // Create & add the window
    CatanWindow window = new CatanWindow(TITLE, skin);
    stage.addActor(window);

    Label usernameLabel = new Label ("Username:", skin);
    TextField usernameText = new TextField ("", skin);
    Label passwordLabel = new Label ("Password:", skin);
    TextField passwordText = new TextField("", skin);

    /*//Create table
    Table mainTable = new Table();
    //add labels to table
    mainTable.add(usernameLabel);
    mainTable.add(usernameText).width(200);
    mainTable.row();
    mainTable.add(passwordLabel);
    mainTable.add(passwordText).width(200);

    mainTable.setFillParent(true);
    stage.addActor(mainTable);*/
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:33,代码来源:SignUpScreen.java

示例4: init

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public void init(AssetManager assetManager) {
    this.assetManager = assetManager;
    assetManager.setErrorListener(this);
    assetManager.load(TEXTURE_ATLAS_OBJECTS, TextureAtlas.class);
    // load sounds
    assetManager.load("sounds/jump.wav", Sound.class);
    assetManager.load("sounds/jump_with_feather.wav", Sound.class);
    assetManager.load("sounds/pickup_coin.wav", Sound.class);
    assetManager.load("sounds/pickup_feather.wav", Sound.class);
    assetManager.load("sounds/live_lost.wav", Sound.class);
    // load music
    assetManager.load("music/hair.ogg", Music.class);
    assetManager.finishLoading();

    Gdx.app.debug(TAG, "# of assets loaded: " + assetManager.getAssetNames().size);
    for (String a : assetManager.getAssetNames()) {
        Gdx.app.debug(TAG, "asset: " + a);
    }

    TextureAtlas atlas = assetManager.get(TEXTURE_ATLAS_OBJECTS);

    //激活平滑文理过度
    for (Texture t : atlas.getTextures()) {
        t.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    }

    //创建游戏资源对象
    bunny = new AssetBunny(atlas);
    rock = new AssetRock(atlas);
    goldCoin = new AssetGoldCoin(atlas);
    feather = new AssetFeather(atlas);
    levelDecoration = new AssetLevelDecoration(atlas);
    sounds = new AssetSounds(assetManager);
    music = new AssetMusic(assetManager);

    fonts = new AssetFonts();
}
 
开发者ID:davyjoneswang,项目名称:libgdx-learnlib,代码行数:38,代码来源:Assets.java

示例5: loadTexture

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
@Override
public Texture loadTexture(String filepath, Format format, boolean useMipMap)
{
	Texture texture = new Texture(Gdx.files.internal(filepath), format, useMipMap);
	texture.setFilter(TextureFilter.MipMap, TextureFilter.Linear);
	return texture;
}
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:8,代码来源:DefaultGameAsset.java

示例6: load

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
private void load(TextureAtlasData data) {
    ObjectMap<TextureAtlasData.Page, Texture> pageToTexture = new ObjectMap<TextureAtlasData.Page, Texture>();
    for (TextureAtlasData.Page page : data.getPages()) {
        Texture texture = TextureDecryptor.loadTexture(crypto, page.textureFile, page.format, page.useMipMaps);
        texture.setFilter(page.minFilter, page.magFilter);
        texture.setWrap(page.uWrap, page.vWrap);
        getTextures().add(texture);
        pageToTexture.put(page, texture);
    }

    // Same as libGDX source
    for (TextureAtlasData.Region region : data.getRegions()) {
        int width = region.width;
        int height = region.height;
        AtlasRegion atlasRegion = new AtlasRegion(pageToTexture.get(region.page), region.left, region.top,
                region.rotate ? height : width, region.rotate ? width : height);
        atlasRegion.index = region.index;
        atlasRegion.name = region.name;
        atlasRegion.offsetX = region.offsetX;
        atlasRegion.offsetY = region.offsetY;
        atlasRegion.originalHeight = region.originalHeight;
        atlasRegion.originalWidth = region.originalWidth;
        atlasRegion.rotate = region.rotate;
        atlasRegion.splits = region.splits;
        atlasRegion.pads = region.pads;
        if (region.flip) atlasRegion.flip(false, true);
        getRegions().add(atlasRegion);
    }
}
 
开发者ID:akivamu,项目名称:libgdx-crypt-texture,代码行数:30,代码来源:CryptTextureAtlas.java

示例7: getPackedTextureSheet

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
private static PackedTextureSheet getPackedTextureSheet(AssetType... assetType) {
	if (Adapter.isDedicatedServer())
		return null;
	TexturePacker texturePacker = new TexturePacker(2048, 2048, 1, true);
	Pixmap pixmap;
	getPacketTextureSheetFor(assetType, texturePacker, pixmap);

	FileHandle fileHandle = assetsFolder.child("packed");
	fileHandle.mkdirs();
	Compatibility.get().nomedia(fileHandle);
	fileHandle = fileHandle.child(assetType[0].name() + ".cim");

	try {
		PixmapIO.writeCIM(fileHandle, texturePacker.getPixmap());
	} catch (GdxRuntimeException e) {
		Log.error("Failed to write packed image", e);
	}

	Texture texture = new Texture(fileHandle);
	texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
	PackedTextureSheet packedTextureSheet = new PackedTextureSheet(
			new Material(TextureAttribute.createDiffuse(texture)));
	packedTextureSheet.getMaterial().set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA));

	Map<Asset, TexturePacker.PackRectangle> rectangles = texturePacker.getRectangles();
	int num = 0;
	for (Map.Entry<Asset, TexturePacker.PackRectangle> entry : rectangles.entrySet()) {
		num++;
		TextureRegion textureRegion = new TextureRegion(texture, entry.getValue().x, entry.getValue().y,
				entry.getValue().width, entry.getValue().height);
		entry.getKey().setPackedTextureRegion(textureRegion, packedTextureSheet);
		packedTextureSheet.getPackedTextures().put(entry.getKey().toString(), textureRegion);
	}

	for (AssetType type : assetType) {
		type.setPackedTextureSheet(packedTextureSheet);
	}
	return packedTextureSheet;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:40,代码来源:Assets.java

示例8: generateFontWriteFiles

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
/** Convenience method for generating a font, and then writing the fnt and png files.
 * Writing a generated font to files allows the possibility of only generating the fonts when they are missing, otherwise
 * loading from a previously generated file.
 * @param fontFile
 * @param fontSize
 */
private BitmapFont generateFontWriteFiles(String fontName, FileHandle fontFile, int fontSize, int pageWidth, int pageHeight) {
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);

    PixmapPacker packer = new PixmapPacker(pageWidth, pageHeight, Pixmap.Format.RGBA8888, 2, false);
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = fontSize;
    parameter.characters = FreeTypeFontGenerator.DEFAULT_CHARS;
    parameter.packer = packer;
    FreeTypeFontGenerator.FreeTypeBitmapFontData fontData = generator.generateData(parameter);//(fontSize, FreeTypeFontGenerator.DEFAULT_CHARS, false, packer);
    Array<PixmapPacker.Page> pages = packer.getPages();
    Array<TextureRegion> texRegions = new Array<TextureRegion>(pageSize);
    for (int i=0; i<pages.size; i++) {
        PixmapPacker.Page p = pages.get(i);
        Texture tex = new Texture(new PixmapTextureData(p.getPixmap(), p.getPixmap().getFormat(), false, false, true)) {
            @Override
            public void dispose () {
                super.dispose();
                getTextureData().consumePixmap().dispose();
            }
        };
        tex.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
        texRegions.add(new TextureRegion(tex));
    }
    BitmapFont font = new BitmapFont(fontData,texRegions,false); //fontData, texRegions, false);
    saveFontToFile(font, fontSize, fontName, packer);
    generator.dispose();
    packer.dispose();
    return font;
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:36,代码来源:SmartFontGenerator.java

示例9: load

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public static void load() {
    texture = new Texture(Gdx.files.internal("data/boytexture.png"));
    texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);

    bg = new TextureRegion(new Texture((Gdx.files.internal("data/floor.png"))));
    bg.flip(false, true);

    boyhead = new TextureRegion(new Texture((Gdx.files.internal("data/boy.png"))));
    boyhead.flip(false, true);
    boyshadow = new TextureRegion(new Texture((Gdx.files.internal("data/boyshadow.png"))));
    boyshadow.flip(false, true);

    goal = new TextureRegion(new Texture((Gdx.files.internal("data/kth.png"))));
    goal.flip(false, true);
    wall = new TextureRegion(new Texture((Gdx.files.internal("data/wall2.png"))));
    wall.flip(false, true);
    wall2 = new TextureRegion(new Texture((Gdx.files.internal("data/wall.png"))));
    wall2.flip(false, true);

    dead = Gdx.audio.newSound(Gdx.files.internal("data/dead.wav"));
    coin = Gdx.audio.newSound(Gdx.files.internal("data/coin.wav"));
    flap = Gdx.audio.newSound(Gdx.files.internal("data/flap.wav"));
    wallfx = Gdx.audio.newSound(Gdx.files.internal("data/vulture.wav"));
    goalfx = Gdx.audio.newSound(Gdx.files.internal("data/dead.wav"));

    font = new BitmapFont(Gdx.files.internal("data/text.fnt"));
    font.setScale(.25f, -.25f);
    shadow = new BitmapFont(Gdx.files.internal("data/shadow.fnt"));
    shadow.setScale(.25f, -.25f);

    fontSmall = new BitmapFont(Gdx.files.internal("data/text.fnt"));
    fontSmall.setScale(.10f, -.10f);

    prefs = Gdx.app.getPreferences("Maze");

}
 
开发者ID:LenaShervarly,项目名称:TreasureHunting,代码行数:37,代码来源:AssetLoader.java

示例10: draw

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
@Override
public void draw(Batch batch, float parentAlpha) {
	// TODO Auto-generated method stub
	super.draw(batch, parentAlpha);
	if(is_me_get_focus == false){
		if(Math.pow(this.page_no-book.current_page,2)<=book.pages_range_to_load){
			page_textrue=new Texture(Gdx.files.internal("pagestray/p"+page_no+".png"));
			page_textrue.setFilter(TextureFilter.Linear,TextureFilter.Linear);
			page_sprite = new Sprite(page_textrue); 
			page_sprite.setSize(Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
			
			is_me_get_focus = true;
			//book.android.make_toast("page no : "+page_no+" loaded", false);
		}
	}else
	{
		
		b_a_s.setColor(255/255f,27/255f,177/255f,book.bookmark_a_page == page_no? (book.stage_detector==Stages.menu?.6f:(book.them_detector ==Thems.colord?.5f:.4f)):0);
		b_b_s.setColor(27/255f,255/255f,215/255f,book.bookmark_b_page == page_no? (book.stage_detector==Stages.menu?.6f:(book.them_detector ==Thems.colord?.5f:.4f)):0);
		b_c_s.setColor(255/255f,220/255f,27/255f,book.bookmark_c_page == page_no? (book.stage_detector==Stages.menu?.6f:(book.them_detector ==Thems.colord?.5f:.4f)):0);
		
		
		b_a_s.setPosition(b_first_x,book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight()+ b_y);
		b_b_s.setPosition(b_first_x+b_pading_x+b_width, book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight()+b_y);
		b_c_s.setPosition(b_first_x+2*b_pading_x+2*b_width, book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight()+b_y);
	
		back_ground.setPosition(0,book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight());
		britness.setPosition(0,book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight());
		
		page_sprite.setPosition(0,book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight());
		page_sprite.setAlpha(book.stage_detector==Stages.menu?.3f:1);
		back_ground.setAlpha(book.them_detector ==Thems.colord?1:0);
	
		britness.setAlpha(1f-(book.light_value*.01f));
		back_ground.draw(batch);
		page_sprite.draw(batch);
		britness.draw(batch);
		b_a_s.draw(batch);
		b_b_s.draw(batch);
		b_c_s.draw(batch);
	}
	if(Math.pow(this.page_no-book.current_page,2)>book.pages_range_to_load&&is_me_get_focus){
	//	book.android.make_toast("page no : "+page_no+" unloaded", false);
		is_me_get_focus = false ;
		page_sprite = null ;
		page_textrue.dispose() ;
		
		
	}
	
}
 
开发者ID:omar6597,项目名称:alquran-alkarem,代码行数:52,代码来源:PageSeen.java

示例11: load

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public static void load() {

        texture = new Texture(Gdx.files.internal("data/texture.png"));
        texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);

        bg = new TextureRegion(texture, 0, 0, 136, 43);
        bg.flip(false, true);

        grass = new TextureRegion(texture, 0, 43, 143, 11);
        grass.flip(false, true);

        birdDown = new TextureRegion(texture, 136, 0, 17, 12);
        birdDown.flip(false, true);

        bird= new TextureRegion(texture,153,0,17,12);
        bird.flip(false,true);

        birdUp=new TextureRegion(texture,170,0,17,12);
        birdUp.flip(false,true);

        TextureRegion[] birds = {birdDown, bird, birdUp};
        birdAnimation=new Animation(0.06f,birds);
        birdAnimation.setPlayMode(Animation.PlayMode.LOOP_PINGPONG);

        skullUp =new TextureRegion(texture,192,0,24,14);
        skullDown = new TextureRegion(skullUp);
        skullDown.flip(false,true);

        bar = new TextureRegion(texture, 136, 16, 22, 3);
        bar.flip(false,true);

    }
 
开发者ID:610ksh,项目名称:MyRoom,代码行数:33,代码来源:AssetLoader.java

示例12: setTextureFilters

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
private void setTextureFilters(TextureFilter min, TextureFilter mag) {
	for (Texture texture : trackedTextures) {
		texture.setFilter(min, mag);
	}
	trackedTextures.clear();
}
 
开发者ID:kyperbelt,项目名称:KyperBox,代码行数:7,代码来源:KyperMapLoader.java


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