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


Java Resolution類代碼示例

本文整理匯總了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;
		}
	}
}
 
開發者ID:bladecoder,項目名稱:bladecoder-adventure-engine,代碼行數:18,代碼來源:EngineResolutionFileResolver.java

示例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);
}
 
開發者ID:unlimitedggames,項目名稱:gdxjam-ugg,代碼行數:32,代碼來源:GUIConfig.java

示例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);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:15,代碼來源:AssetManagerTest.java

示例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);
}
 
開發者ID:bladecoder,項目名稱:bladecoder-adventure-engine,代碼行數:15,代碼來源:EngineAssetManager.java

示例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()]);
}
 
開發者ID:bladecoder,項目名稱:bladecoder-adventure-engine,代碼行數:37,代碼來源:EngineAssetManager.java

示例6: getResolutions

import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; //導入依賴的package包/類
public Resolution[] getResolutions() {
	return descriptors;
}
 
開發者ID:bladecoder,項目名稱:bladecoder-adventure-engine,代碼行數:4,代碼來源:EngineResolutionFileResolver.java

示例7: getResolution

import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; //導入依賴的package包/類
public Resolution getResolution() {
	return bestDesc;
}
 
開發者ID:bladecoder,項目名稱:bladecoder-adventure-engine,代碼行數:4,代碼來源:EngineResolutionFileResolver.java

示例8: setResolutions

import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; //導入依賴的package包/類
public void setResolutions(Resolution[] resolutions) {
	this.descriptors = resolutions;
}
 
開發者ID:bladecoder,項目名稱:bladecoder-adventure-engine,代碼行數:4,代碼來源:EngineResolutionFileResolver.java

示例9: getResolution

import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; //導入依賴的package包/類
public Resolution getResolution() {
	return resResolver.getResolution();
}
 
開發者ID:bladecoder,項目名稱:bladecoder-adventure-engine,代碼行數:4,代碼來源:EngineAssetManager.java


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