本文整理汇总了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);
}
示例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);
}
示例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);*/
}
示例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();
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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");
}
示例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() ;
}
}
示例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);
}
示例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();
}