本文整理汇总了Java中com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution类的典型用法代码示例。如果您正苦于以下问题:Java Resolution类的具体用法?Java Resolution怎么用?Java Resolution使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Resolution类属于com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver包,在下文中一共展示了Resolution类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectBestResolution
import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; //导入依赖的package包/类
private void selectBestResolution() {
bestDesc = descriptors[0];
int width = Gdx.graphics.getWidth() > Gdx.graphics.getHeight() ?Gdx.graphics.getWidth():Gdx.graphics.getHeight();
int bestDist = Math.abs(width - bestDesc.portraitWidth);
for (int i = 1; i < descriptors.length; i++) {
Resolution other = descriptors[i];
int dist = Math.abs(width - other.portraitWidth);
if (dist < bestDist) {
bestDesc = descriptors[i];
bestDist = dist;
}
}
}
示例2: initializeValues
import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; //导入依赖的package包/类
public static void initializeValues(Resolution[] resolutions){
Resolution r = ResolutionFileResolver.choose(resolutions);
float multiplier = 1;
if(r.folder.equals("1")){
multiplier = 0.80f;
RES_MULTIPLIER = 6f;
}else if(r.folder.equals("0.66")){
multiplier = 0.60f;
RES_MULTIPLIER = 4f;
}else if(r.folder.equals("0.416")){
multiplier = 0.400f;
RES_MULTIPLIER = 2.5f;
}else{
multiplier = 0.16f;
RES_MULTIPLIER = 1f;
}
MINPADDING = (int)(MINPADDING*multiplier);
WINDOW_PADDING_Y = (int)(WINDOW_PADDING_Y*multiplier);
WINDOW_PADDING_X = (int)(WINDOW_PADDING_X*multiplier);
MIN_BUTTON_HEIGHT = (int)(MIN_BUTTON_HEIGHT * multiplier);
MIN_BTN_WIDTH = (int)(MIN_BTN_WIDTH * multiplier);
SLIDER_WIDTH = (int)(SLIDER_WIDTH * multiplier);
PIXELS_PER_METER_X = (int)(PIXELS_PER_METER_X*multiplier);
MIN_BTN_SELECT_WIDTH = (int)(MIN_BTN_SELECT_WIDTH*multiplier);
}
示例3: create
import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; //导入依赖的package包/类
public void create () {
Gdx.app.setLogLevel(Application.LOG_ERROR);
Resolution[] resolutions = {new Resolution(320, 480, ".320480"), new Resolution(480, 800, ".480800"),
new Resolution(480, 856, ".480854")};
ResolutionFileResolver resolver = new ResolutionFileResolver(new InternalFileHandleResolver(), resolutions);
manager = new AssetManager();
manager.setLoader(Texture.class, new TextureLoader(resolver));
manager.setErrorListener(this);
load();
Texture.setAssetManager(manager);
batch = new SpriteBatch();
font = new BitmapFont(Gdx.files.internal("data/font.fnt"), false);
}
示例4: setScale
import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; //导入依赖的package包/类
public void setScale(int worldWidth, int worldHeight) {
Resolution r[] = getResolutions(resResolver.getBaseResolver(), worldWidth, worldHeight);
if (r == null || r.length == 0) {
EngineLogger.error("No resolutions defined. Maybe your 'assets' folder doesn't exists or it's empty");
return;
}
resResolver.setResolutions(r);
resResolver.selectResolution();
scale = resResolver.getResolution().portraitWidth / (float) worldWidth;
EngineLogger.debug("Setting ASSETS SCALE: " + scale);
}
示例5: getResolutions
import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; //导入依赖的package包/类
private Resolution[] getResolutions(FileHandleResolver resolver, int worldWidth, int worldHeight) {
ArrayList<Resolution> rl = new ArrayList<Resolution>();
String list[] = null;
String configRes = Config.getProperty(Config.RESOLUTIONS, null);
if(configRes != null) {
list = configRes.split(",");
} else {
list = listAssetFiles("ui");
}
for (String name : list) {
try {
float scale = Float.parseFloat(name);
EngineLogger.debug("RES FOUND: " + scale);
Resolution r = new Resolution((int) (worldWidth * scale), (int) (worldHeight * scale), name);
rl.add(r);
} catch (NumberFormatException e) {
}
}
Collections.sort(rl, new Comparator<Resolution>() {
public int compare(Resolution a, Resolution b) {
return a.portraitWidth - b.portraitWidth;
}
});
return rl.toArray(new Resolution[rl.size()]);
}
示例6: getResolutions
import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; //导入依赖的package包/类
public Resolution[] getResolutions() {
return descriptors;
}
示例7: getResolution
import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; //导入依赖的package包/类
public Resolution getResolution() {
return bestDesc;
}
示例8: setResolutions
import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; //导入依赖的package包/类
public void setResolutions(Resolution[] resolutions) {
this.descriptors = resolutions;
}
示例9: getResolution
import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; //导入依赖的package包/类
public Resolution getResolution() {
return resResolver.getResolution();
}