當前位置: 首頁>>代碼示例>>Java>>正文


Java TextureFilter類代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.Texture.TextureFilter的典型用法代碼示例。如果您正苦於以下問題:Java TextureFilter類的具體用法?Java TextureFilter怎麽用?Java TextureFilter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TextureFilter類屬於com.badlogic.gdx.graphics.Texture包,在下文中一共展示了TextureFilter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: create

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
public void create () {
	batch = new SpriteBatch();
	sceneMatrix = new Matrix4().setToOrtho2D(0, 0, 480, 320);
	textMatrix = new Matrix4().setToOrtho2D(0, 0, 480, 320);

	atlas = new TextureAtlas(Gdx.files.internal("data/issue_pack"), Gdx.files.internal("data/"));
	texture = new Texture(Gdx.files.internal("data/resource1.jpg"), true);
	texture.setFilter(TextureFilter.MipMap, TextureFilter.Nearest);
	setTextureFilter(0);
	setModeString();

	sprite = atlas.createSprite("map");
	sprite2 = new Sprite(texture, 0, 0, 855, 480);
	font = new BitmapFont(Gdx.files.internal("data/font.fnt"), Gdx.files.internal("data/font.png"), false);

	Gdx.input.setInputProcessor(new InputAdapter() {
		public boolean touchDown (int x, int y, int pointer, int newParam) {
			mode++;
			if (mode == filters.length * 2) mode = 0;
			setTextureFilter(mode / 2);
			setModeString();
			return false;
		}
	});
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:26,代碼來源:FilterPerformanceTest.java

示例2: Wave

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
/**
    * @param hitPoint
    * @param bonus
    * @param speed
    * @param numberOfMonster
    * @param timeToRelease
    */
   public Wave(IGameService service, int index) {
super(service);
this.index = index;
texture= GameAsset.monsterTexture[index];
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
ended = false;
action = new BaseLoopingAction(GameSpecs.numberOfMonster[index], GameSpecs.timeToRelease[index]) {
    
    @Override
    public void onActionRemove() {
	ended = true;
    }
    
    @Override
    public void onActionPerformance() {
	createMonster();
    }
};
   }
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:27,代碼來源:Wave.java

示例3: create

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的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

示例4: initUtils

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
private void initUtils() {
    //init camera & viewport
    camera = new OrthographicCamera();
    viewport = new StretchViewport(Polymorph.WORLD_WIDTH, Polymorph.WORLD_HEIGHT, camera);
    viewport.apply(true);
    camera.update();

    //init sprite batch
    batch = new SpriteBatch();
    batch.setProjectionMatrix(camera.combined);

    //init font
    FreeTypeFontGenerator fontGenerator = polymorph.getAssetManager().get(Polymorph.FONT_BOLD_PATH, FreeTypeFontGenerator.class);
    FreeTypeFontParameter fontSettings = new FreeTypeFontParameter();
    fontSettings.size = 80;
    fontSettings.minFilter = TextureFilter.Linear;
    fontSettings.magFilter = TextureFilter.Linear;
    font = fontGenerator.generateFont(fontSettings);
}
 
開發者ID:DurianHLN,項目名稱:Polymorph,代碼行數:20,代碼來源:GameScreen.java

示例5: addTexture

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
public void addTexture(String file) {
		Texture texture = new Texture(Gdx.files.internal(file), true);
		
		texture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
		if(ExterminateGame.useGL3) {
			texture.setFilter(TextureFilter.MipMapLinearLinear, TextureFilter.Linear);
		}
		else {
			texture.setFilter(TextureFilter.MipMapLinearNearest, TextureFilter.Linear);				
		}
		
		if(ltid==0) {
			textureHerbe = texture;
		}
		else if(ltid==1) {
			textureSand = texture;
		}
		else if(ltid==2) {
			textureDirt = texture;
		}
		else if(ltid==3) {
			textureRock = texture;
		}

	ltid++;
}
 
開發者ID:Osaris31,項目名稱:exterminate,代碼行數:27,代碼來源:Biome.java

示例6: Renderer

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
public Renderer () {
	try {
		lights = new Environment();
		lights.add(new DirectionalLight().set(Color.WHITE, new Vector3(-1, -0.5f, 0).nor()));

		spriteBatch = new SpriteBatch();
		modelBatch = new ModelBatch();

		backgroundTexture = new Texture(Gdx.files.internal("data/planet.jpg"), Format.RGB565, true);
		backgroundTexture.setFilter(TextureFilter.MipMap, TextureFilter.Linear);

		font = new BitmapFont(Gdx.files.internal("data/font10.fnt"), Gdx.files.internal("data/font10.png"), false);

		camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	} catch (Exception ex) {
		ex.printStackTrace();
	}
}
 
開發者ID:Motsai,項目名稱:neblina-libgdx3d,代碼行數:19,代碼來源:Renderer.java

示例7: GameOver

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
public GameOver (Invaders invaders) {
	super(invaders);
	spriteBatch = new SpriteBatch();
	background = new Texture(Gdx.files.internal("data/planet.jpg"));
	background.setFilter(TextureFilter.Linear, TextureFilter.Linear);

	logo = new Texture(Gdx.files.internal("data/title.png"));
	logo.setFilter(TextureFilter.Linear, TextureFilter.Linear);

	font = new BitmapFont(Gdx.files.internal("data/font16.fnt"), Gdx.files.internal("data/font16.png"), false);

	if (invaders.getController() != null) {
		invaders.getController().addListener(new ControllerAdapter() {
			@Override
			public boolean buttonUp(Controller controller,
					int buttonIndex) {
				controller.removeListener(this);
				isDone = true;
				return false;
			}
		});
	}
}
 
開發者ID:Motsai,項目名稱:neblina-libgdx3d,代碼行數:24,代碼來源:GameOver.java

示例8: MainMenu

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
public MainMenu (Invaders invaders) {
	super(invaders);

	spriteBatch = new SpriteBatch();
	background = new Texture(Gdx.files.internal("data/planet.jpg"));
	background.setFilter(TextureFilter.Linear, TextureFilter.Linear);

	logo = new Texture(Gdx.files.internal("data/title.png"));
	logo.setFilter(TextureFilter.Linear, TextureFilter.Linear);

	font = new BitmapFont(Gdx.files.internal("data/font16.fnt"), Gdx.files.internal("data/font16.png"), false);

	if (invaders.getController() != null) {
		invaders.getController().addListener(new ControllerAdapter() {
			@Override
			public boolean buttonUp(Controller controller, int buttonIndex) {
				controller.removeListener(this);
				isDone = true;
				return false;
			}
		});
	}
}
 
開發者ID:Motsai,項目名稱:neblina-libgdx3d,代碼行數:24,代碼來源:MainMenu.java

示例9: write

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
@Override
public void write (Json json) {
	super.write(json);
	json.writeValue("width", width);
	json.writeValue("height", height);
	json.writeValue("texture", texturePath);
	if (regionName != null)
		json.writeValue(regionName);
	json.writeValue("srcX", srcX);
	json.writeValue("srcY", srcY);
	json.writeValue("srcWidth", srcWidth);
	json.writeValue("srcHeight", srcHeight);
	json.writeValue("originX", originX);
	json.writeValue("originY", originY);
	json.writeValue("minFilter", minFilter == TextureFilter.Linear ? "Linear" : "Nearest");
	json.writeValue("magFilter", magFilter == TextureFilter.Linear ? "Linear" : "Nearest");
	JsonUtil.writeColorToJson(json, color, "tint");
	json.writeValue("uWrap",
		uWrap == TextureWrap.ClampToEdge ? "ClampToEdge" : uWrap == TextureWrap.Repeat ? "Repeat" : "MirroredRepeat");
	json.writeValue("vWrap",
		vWrap == TextureWrap.ClampToEdge ? "ClampToEdge" : vWrap == TextureWrap.Repeat ? "Repeat" : "MirroredRepeat");
}
 
開發者ID:Quexten,項目名稱:RavTech,代碼行數:23,代碼來源:SpriteRenderer.java

示例10: LoadingScreen

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
public LoadingScreen(TheEndlessCastle game)
{
	super(game);

	// We need to use raw path to assets and load it without assetsHandler as we are loading assets and reading ressources xml file
	Texture INSATexture = new Texture(Gdx.files.internal(_INSA_LOGO_TEXTURE_PATH), true);
	INSATexture.setFilter(TextureFilter.MipMapLinearLinear, TextureFilter.Linear);
	Texture OpenTexture = new Texture(Gdx.files.internal(_OPEN_LOGO_TEXTURE_PATH), true);
	OpenTexture.setFilter(TextureFilter.MipMapLinearLinear, TextureFilter.Linear);
	_INSALogoSprite = new Sprite(INSATexture);
	_mainLogoSprite = new Sprite(OpenTexture);
	_mainLogoSprite.setSize(9, 9f *_mainLogoSprite.getHeight()/_mainLogoSprite.getWidth());
	_INSALogoSprite.setSize(4, 4f *_INSALogoSprite.getHeight()/_INSALogoSprite.getWidth());
	_INSALogoSprite.setCenter(_camera.viewportWidth/2f, 1f);
	_mainLogoSprite.setCenter(_camera.viewportWidth/2f+1f, 9.5f);
}
 
開發者ID:mitsuhirato,項目名稱:TheEndlessCastle,代碼行數:17,代碼來源:LoadingScreen.java

示例11: AbstractMenuScreen

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
public <E extends Enum<?>> AbstractMenuScreen(Class<E> menuEnumClass, BitmapFont pFont, Class<?> selectorClass) {

		stage = new Stage();
		Gdx.input.setInputProcessor(stage);
		font = pFont != null ? pFont : new BitmapFont();
		font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);		
		font.setColor(0, 0, 0, 1);
		selectorHeight = font.getCapHeight();
		initItemsPositions(menuEnumClass);
		generateSelector(selectorClass);
		foregroundGroup= new Group();
		backgroundGroup = new Group();
		addBackgroundElements();
		foregroundGroup.addActor(selector);
		stage.addActor(backgroundGroup);
		stage.addActor(foregroundGroup);		
	}
 
開發者ID:provenza24,項目名稱:Mario-Libgdx,代碼行數:18,代碼來源:AbstractMenuScreen.java

示例12: loadTitleTextures

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
/**
 * Load the normal texture for this train. This will be used to display the train one the playing field.
 */
private void loadTitleTextures()
{
	try
	{
		TextureRegion texture = new TextureRegion(new Texture(Gdx.files.internal("textures/Trains_" + _modelName + ".png")));
		texture.flip(false, true);
		texture.getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
		_textures.put(_modelName, texture);
		
		Logger.__info("Succesfully loaded image for train " + _modelName + ".");
	}
	catch (GdxRuntimeException ex)
	{
		Logger.__error("Error while loading trains title image!", ex);
	}
}
 
開發者ID:hauke96,項目名稱:METRO,代碼行數:20,代碼來源:TrainTemplate.java

示例13: loadModelTextures

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
/**
 * Load the title image for this train that'll be displayed by the train buy dialog.
 */
private void loadModelTextures()
{
	Logger.__info("Loading train title image");
	try
	{
		FileHandle handle = Gdx.files.internal("textures/Trains_" + _modelName + "_big.png");
		Texture texture = new Texture(handle);
		TextureRegion textureRegion = new TextureRegion(texture);
		textureRegion.flip(false, true);
		textureRegion.getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
		_titleTextures.put(_modelName, textureRegion);
		
		Logger.__info("Succesfully loaded title image for train " + _modelName + ".");
	}
	catch (GdxRuntimeException ex)
	{
		Logger.__error("Error while loading title image!", ex);
	}
}
 
開發者ID:hauke96,項目名稱:METRO,代碼行數:23,代碼來源:TrainTemplate.java

示例14: PowerLUT

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
/** W power will be in luminance, and H power will be in alpha**/
public PowerLUT(float powerW, float intensityW, float powerH, float intensityH, int width, int height){

	Pixmap pixmap = new Pixmap(width, height, Format.RGBA8888);
	for (int i=0; i<width; i++){
		float valueW = (float)Math.pow((float)i/width, powerW) * intensityW;
           for (int j = 0; j < height; j++) {
               float valueH = (float)Math.pow((float)j/height, powerH) * intensityH;
               pixmap.setColor(valueW, valueH, 1.0f, 1.0f);
               pixmap.drawPixel(i, j);
           }
	}
	
	PixmapTextureData data = new PixmapTextureData(pixmap, Format.RGBA8888, false, false, true);
	
	texture = new Texture(data);
	texture.setWrap(TextureWrap.ClampToEdge, TextureWrap.ClampToEdge);
	texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
}
 
開發者ID:CypherCove,項目名稱:DoubleHelix,代碼行數:20,代碼來源:PowerLUT.java

示例15: show

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入依賴的package包/類
@Override
public void show() {
    iciclesViewport = new ExtendViewport(Constants.WORLD_SIZE, Constants.WORLD_SIZE);

    renderer = new ShapeRenderer();
    renderer.setAutoShapeType(true);

    // TODO: Initialize the HUD viewport
    hudViewport = new ScreenViewport();

    // TODO: Initialize the SpriteBatch
    batch = new SpriteBatch();

    // TODO: Initialize the BitmapFont
    font = new BitmapFont();

    // TODO: Give the font a linear TextureFilter
    font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);

    player = new Player(iciclesViewport);
    icicles = new Icicles(iciclesViewport);

    // TODO: Set top score to zero
    topScore = 0;
}
 
開發者ID:udacity,項目名稱:ud405,代碼行數:26,代碼來源:IciclesScreen.java


注:本文中的com.badlogic.gdx.graphics.Texture.TextureFilter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。