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