本文整理匯總了Java中com.badlogic.gdx.graphics.Texture.TextureFilter.Linear方法的典型用法代碼示例。如果您正苦於以下問題:Java TextureFilter.Linear方法的具體用法?Java TextureFilter.Linear怎麽用?Java TextureFilter.Linear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.Texture.TextureFilter
的用法示例。
在下文中一共展示了TextureFilter.Linear方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: main
import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
public static void main(String args[]){
if(resolver == null){
resolver = new Main();
}
boolean hacer_packer = false;
if(hacer_packer){
Settings settings = new Settings();
settings.pot = false;
settings.maxHeight = 1024;
settings.maxWidth = 1024;
settings.paddingX = 1;
settings.paddingY = 1;
settings.filterMin = TextureFilter.Linear;
settings.filterMag = TextureFilter.Linear;
TexturePacker.process(settings, "dataPC/screens/play/", "data/screens/play/", "play");
TexturePacker.process(settings, "dataPC/screens/background/", "data/screens/background", "bg");
}
new LwjglApplication(new Bar(resolver), "Bar", 480, 854, true);
}
示例3: loadAssets
import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
@Override
public void loadAssets() {
FreeTypeFontLoaderParameter params = new FreeTypeFontLoaderParameter();
float scale = EngineAssetManager.getInstance().getScale();
params.fontFileName = EngineAssetManager.FONT_DIR + fontName + EngineAssetManager.FONT_EXT;
params.fontParameters.size = (int)(fontSize * scale);
params.fontParameters.borderWidth = (int)(borderWidth * scale);
params.fontParameters.borderColor = borderColor;
params.fontParameters.borderStraight = borderStraight;
params.fontParameters.shadowOffsetX = (int)(shadowOffsetX * scale);
params.fontParameters.shadowOffsetY = (int)(shadowOffsetY * scale);
params.fontParameters.shadowColor = shadowColor;
params.fontParameters.characters = "";
params.fontParameters.incremental = true;
params.fontParameters.magFilter = TextureFilter.Linear;
params.fontParameters.minFilter = TextureFilter.Linear;
EngineAssetManager.getInstance().load(fontName + getFontSize() + ".ttf", BitmapFont.class, params);
}
示例4: getFont
import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
/**
* Retrieve the desired font and size (may load the font
* if not cached).
*
* @param alias
* @param size
* @return the font
*/
private BitmapFont getFont(String alias, int size) {
BitmapFont font = null;
String mask = alias + ":" + size;
if(this.fonts.containsKey(mask)) {
font = this.fonts.get(mask);
}
else if(this.generators.containsKey(alias)) {
FreeTypeFontParameter params = new FreeTypeFontParameter();
params.size = size;
params.characters = FreeTypeFontGenerator.DEFAULT_CHARS;
params.flip = true;
params.magFilter = TextureFilter.Linear;
params.minFilter = TextureFilter.Linear;
font = this.generators.get(alias).generateFont(params);
this.fonts.put(mask, font);
}
return font;
}
示例5: loadAsync
import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle handle, TextureParameter parameter) {
TextureParameter mTextureParameter = new TextureParameter();
if (parameter != null) {
// copy old vars
mTextureParameter.format = parameter.format;
mTextureParameter.genMipMaps = parameter.genMipMaps;
mTextureParameter.texture = parameter.texture;
mTextureParameter.textureData = parameter.textureData;
}
// our settings
mTextureParameter.magFilter = TextureFilter.Linear;
mTextureParameter.minFilter = TextureFilter.Linear;
mTextureParameter.wrapU = Texture.TextureWrap.MirroredRepeat;
mTextureParameter.wrapV = Texture.TextureWrap.MirroredRepeat;
super.loadAsync(manager, fileName, handle, mTextureParameter);
}
示例6: loadSync
import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
@Override
public Texture loadSync(AssetManager manager, String fileName, FileHandle handle, TextureParameter parameter) {
TextureParameter mTextureParameter = new TextureParameter();
if (parameter != null) {
// copy old vars
mTextureParameter.format = parameter.format;
mTextureParameter.genMipMaps = parameter.genMipMaps;
mTextureParameter.texture = parameter.texture;
mTextureParameter.textureData = parameter.textureData;
}
// our settings
mTextureParameter.magFilter = TextureFilter.Linear;
mTextureParameter.minFilter = TextureFilter.Linear;
mTextureParameter.wrapU = Texture.TextureWrap.MirroredRepeat;
mTextureParameter.wrapV = Texture.TextureWrap.MirroredRepeat;
return super.loadSync(manager, fileName, handle, mTextureParameter);
}
示例7: main
import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
public static void main (String[] arg) {
final boolean needToPackTexture=false;
if(needToPackTexture)
{
// for high resolution (1280x720)
Settings settings=new Settings();
settings.maxHeight=2048;
settings.maxWidth=2048;
settings.filterMin=TextureFilter.MipMapLinearLinear;
settings.filterMag=TextureFilter.Linear;
settings.fast=true;
settings.duplicatePadding=true;
settings.scale=new float[]{1,0.5f};
settings.scaleSuffix=new String[]{"e","e_small"};
TexturePacker.process(settings, "../../images", ".", "gam");
// for lower resolution
settings.maxHeight=1024;
settings.maxWidth=1024;
//TexturePacker.process(settings, "../../images_small", ".", "game_small");
}
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.width=482;
config.height=320;
//config.width=320;
//config.height=480;
config.useGL30 = false;
ShapeClearGame game=new ShapeClearGame();
game.platformSpecific=new DesktopSpecific();
new LwjglApplication(game, config);
}
示例8: read
import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
@Override
public void read (Json json, JsonValue jsonData) {
super.read(json, jsonData);
if (jsonData.has("width"))
width = jsonData.getFloat("width");
if (jsonData.has("height"))
height = jsonData.getFloat("height");
if (jsonData.has("texture"))
texturePath = jsonData.getString("texture");
if (jsonData.has("srcX")) {
useCustomSrc = true;
srcX = jsonData.getInt("srcX");
}
if (jsonData.has("srcY"))
srcY = jsonData.getInt("srcY");
if (jsonData.has("srcWidth"))
srcWidth = jsonData.getInt("srcWidth");
if (jsonData.has("srcHeight"))
srcHeight = jsonData.getInt("srcHeight");
if (jsonData.has("originX"))
originX = jsonData.getFloat("originX");
if (jsonData.has("originY"))
originY = jsonData.getFloat("originY");
if (jsonData.has("minFilter"))
minFilter = jsonData.getString("minFilter").equals("Linear") ? TextureFilter.Linear : TextureFilter.Nearest;
if (jsonData.has("magFilter"))
magFilter = jsonData.getString("magFilter").equals("Linear") ? TextureFilter.Linear : TextureFilter.Nearest;
if (jsonData.has("tint"))
setColor(JsonUtil.readColorFromJson(jsonData, "tint"));
if (jsonData.has("uWrap")) {
String uWrapStrings = jsonData.getString("uWrap");
uWrap = uWrapStrings.equals("ClampToEdge") ? TextureWrap.ClampToEdge
: uWrapStrings.equals("Repeat") ? TextureWrap.Repeat : TextureWrap.MirroredRepeat;
}
if (jsonData.has("vWrap")) {
String vWrapStrings = jsonData.getString("vWrap");
vWrap = vWrapStrings.equals("ClampToEdge") ? TextureWrap.ClampToEdge
: vWrapStrings.equals("Repeat") ? TextureWrap.Repeat : TextureWrap.MirroredRepeat;
}
}
示例9: getLibGDXTextureFilter
import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
private TextureFilter getLibGDXTextureFilter( int glConst ) {
for ( TextureFilter tf : TextureFilter.values() ) {
if ( tf.getGLEnum() == glConst ) {
return tf;
}
}
return TextureFilter.Linear;
}
示例10: loadFonts
import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
/**
* Load the font {@code GatsbyFLF-Bold} in size 21.
*
* @return The loaded font.
*/
private BitmapFont loadFonts()
{
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/GatsbyFLF-Bold.ttf"));
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.magFilter = TextureFilter.Linear;
parameter.size = 21;
parameter.flip = true;
BitmapFont font = generator.generateFont(parameter); // font size 20 pixels
generator.dispose();
return font;
}
示例11: toGdxFilter
import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
/**
* Converts {@link GLScaleFilter} to its equivalent {@link TextureFilter}.
*/
public static TextureFilter toGdxFilter(GLScaleFilter filter) {
switch (filter) {
case NEAREST: return TextureFilter.Nearest;
case NEAREST_MIPMAP: return TextureFilter.MipMapNearestLinear;
case LINEAR: return TextureFilter.Linear;
case LINEAR_MIPMAP: return TextureFilter.MipMapLinearLinear;
}
throw new IllegalArgumentException("Unsupported filter type: " + filter);
}
示例12: 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();
camera.setToOrtho(false, (w / h) * 10, 10);
camera.zoom = 2;
camera.update();
cameraController = new OrthoCamController(camera);
Gdx.input.setInputProcessor(cameraController);
font = new BitmapFont();
batch = new SpriteBatch();
AtlasTiledMapLoaderParameters params = new AtlasTiledMapLoaderParameters();
params.forceTextureFilters = true;
params.textureMinFilter = TextureFilter.Linear;
params.textureMagFilter = TextureFilter.Linear;
assetManager = new AssetManager();
assetManager.setErrorListener(new AssetErrorListener() {
@Override
public void error (AssetDescriptor asset, Throwable throwable) {
errorMessage = throwable.getMessage();
}
});
assetManager.setLoader(TiledMap.class, new AtlasTmxMapLoader(new InternalFileHandleResolver()));
assetManager.load(fileName, TiledMap.class);
}
示例13: drawFont
import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
private int drawFont (BitmapFont font, String description, boolean linearFiltering, boolean useShader, float smoothing, int x) {
int y = 10;
float maxWidth = 0;
spriteBatch.setShader(null);
descriptionFont.drawMultiLine(spriteBatch, description, x, y);
spriteBatch.flush();
y += 10 + 2 * descriptionFont.getLineHeight();
// set filters for each page
TextureFilter minFilter = linearFiltering ? TextureFilter.MipMapLinearNearest : TextureFilter.Nearest;
TextureFilter magFilter = linearFiltering ? TextureFilter.Linear : TextureFilter.Nearest;
for (int i = 0; i < font.getRegions().length; i++) {
font.getRegion(i).getTexture().setFilter(minFilter, magFilter);
}
if (useShader) {
spriteBatch.setShader(distanceFieldShader);
} else {
spriteBatch.setShader(null);
}
for (float scale : SCALES) {
font.setScale(scale);
maxWidth = Math.max(maxWidth, font.getBounds(TEXT).width);
if (useShader) {
distanceFieldShader.setSmoothing(smoothing / scale);
}
font.draw(spriteBatch, TEXT, x, y + scale * getBaselineShift(font));
y += font.getLineHeight();
spriteBatch.flush();
}
return (int)Math.ceil(maxWidth);
}
示例14: getParameterForSize
import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
private FreeTypeFontParameter getParameterForSize (int size) {
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.size = size;
parameter.minFilter = TextureFilter.Linear;
parameter.magFilter = TextureFilter.Linear;
return parameter;
}
示例15: main
import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
public static void main(String[] args) {
Settings settings = new Settings();
settings.filterMin = TextureFilter.Linear;
settings.filterMag = TextureFilter.Linear;
TexturePacker2.process(settings, "../dev-images", "../Droha-android/assets/data", "empaquetado");
System.out.println("Empaquetado Completo!");
}