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


Java ApplicationType.Desktop方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.Application.ApplicationType.Desktop方法的典型用法代碼示例。如果您正苦於以下問題:Java ApplicationType.Desktop方法的具體用法?Java ApplicationType.Desktop怎麽用?Java ApplicationType.Desktop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.Application.ApplicationType的用法示例。


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

示例1: newEngine

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
/**創建一個Card2DEngine實例 */
public static final Engine newEngine(BaseGame card2dAppListener) {
	if(_instance == null){
		if(_engineMode == null) {
			if(Gdx.app.getType() == ApplicationType.Desktop) {
				_engineMode = EngineMode.SingleThread;		//桌麵版本經過測試,backend已經實現了渲染線程分離,因此默認使用single模式
			} else {
				_engineMode = EngineMode.DoubleThread;		
			}
		}
		
		CCLog.engine("Engine", ">>>>>>>>>>>>>>>>>> engine run mode : " + _engineMode);
		
		_instance = new Engine();
		_instance.game = card2dAppListener;
		_instance.director = Director.getInstance();
		_instance.baseScheduler = BaseScheduler.instance();
	}
	return _instance;
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:21,代碼來源:Engine.java

示例2: create

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
@Override
public void create () {		
	// Net Shit
	System.out.println("Good morning!");
       game = this;
	batch = new SpriteBatch();
	if(Gdx.app.getType() == ApplicationType.Desktop) {
		// Run server
		server = new NetServer();
		setScreen(new SplashScreen(game));

	} else {
		// Run client
		client = new NetClient();
		setScreen(new LobbyScreen(game));
	}
}
 
開發者ID:edwardszczepanski,項目名稱:QuackHack,代碼行數:18,代碼來源:QuackHack.java

示例3: saveScreenshot

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
public static void saveScreenshot(final int w, final int h, final String prefix)
{
    try
    {
        FileHandle fh;
        do
        {
            if (Gdx.app.getType() == ApplicationType.Desktop)
            {
                fh = Gdx.files.local("bin/screenshot_" + prefix + "_" + counter++ + ".png");
            }
            else
            {
                fh = Gdx.files.local("screenshot_" + prefix + "_" + counter++ + ".png");
            }
        }
        while (fh.exists());
        final Pixmap pixmap = getScreenshot(0, 0, w, h, true);
        PixmapIO.writePNG(fh, pixmap);
        pixmap.dispose();
        Gdx.app.log("screenshot", "Screenshot saved to " + fh);
    }
    catch (final Exception e)
    {
    }
}
 
開發者ID:ncguy2,項目名稱:Argent,代碼行數:27,代碼來源:ScreenshotFactory.java

示例4: ShaderManager

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
public ShaderManager (String shaderDir, AssetManager am, boolean addProcessors) {
	shaders = new ObjectMap<String, ShaderProgram>();
	shaderPaths = new ObjectMap<String, String>();
	sourcesVert = new ObjectMap<String, String>();
	sourcesFrag = new ObjectMap<String, String>();
	frameBuffers = new ObjectMap<String, FrameBuffer>();
	openedFrameBuffers = new Array<String>(true, MAX_FRAMEBUFFERS);
	screenCamera = new OrthographicCamera(Gdx.graphics.getWidth() + 2, Gdx.graphics.getHeight() + 2);
	createScreenQuad();
	screenCamera.translate(0, -1);
	screenCamera.update();
	setShaderDir(shaderDir);
	setAssetManager(am);
	// add("empty", "empty.vert", "empty.frag");
	// add("default", "default.vert", "default.frag");
	if (addProcessors && (Gdx.app.getType() == ApplicationType.Desktop || Gdx.app.getType() == ApplicationType.Applet
		|| Gdx.app.getType() == ApplicationType.WebGL)) {
		/*
		 * add("processor", "processor.vert", "processor.frag"); add("processor_blur", "processor.vert", "processor_blur.frag");
		 * add("copy", "processor.vert", "copy.frag"); add("processor_draw", "processor.vert", "processor_draw.frag");
		 * add("processor_fill", "processor.vert", "processor_fill.frag");
		 */
	}
}
 
開發者ID:Quexten,項目名稱:RavTech,代碼行數:25,代碼來源:ShaderManager.java

示例5: tryLoadDesktopTwitterAPI

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
private void tryLoadDesktopTwitterAPI() {
	if (Gdx.app.getType() != ApplicationType.Desktop) {
		Gdx.app.debug(TAG, "Skip loading Twitter API for Desktop. Not running Desktop. \n");
		return;
	}
	try {

		final Class<?> twitterClazz = ClassReflection.forName("de.tomgrill.gdxtwitter.desktop.DesktopTwitterAPI");
		Object twitter = ClassReflection.getConstructor(twitterClazz, TwitterConfig.class).newInstance(config);

		twitterAPI = (TwitterAPI) twitter;

		Gdx.app.debug(TAG, "gdx-twitter for Desktop loaded successfully.");

	} catch (ReflectionException e) {
		Gdx.app.debug(TAG, "Error creating gdx-twitter for Desktop (are the gdx-twitter **.jar files installed?). \n");
		e.printStackTrace();
	}

}
 
開發者ID:TomGrill,項目名稱:gdx-twitter,代碼行數:21,代碼來源:TwitterSystem.java

示例6: installDesktopGDXDialogs

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
private void installDesktopGDXDialogs() {
	if (Gdx.app.getType() != ApplicationType.Desktop) {
		showDebugSkipInstall(ApplicationType.Desktop.name());
		return;
	}
	try {

		final Class<?> dialogManagerClazz = ClassReflection.forName("de.tomgrill.gdxdialogs.desktop.DesktopGDXDialogs");

		Object dialogManager = ClassReflection.getConstructor(dialogManagerClazz).newInstance();

		this.gdxDialogs = (GDXDialogs) dialogManager;

		showDebugInstallSuccessful(ApplicationType.Desktop.name());

	} catch (ReflectionException e) {
		showErrorInstall(ApplicationType.Desktop.name(), "desktop");
		e.printStackTrace();
	}

}
 
開發者ID:TomGrill,項目名稱:gdx-dialogs,代碼行數:22,代碼來源:GDXDialogsSystem.java

示例7: Db

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
public Db() {
	// deserialize all definitions
	definitions = new ObjectMap<>();
	Json json = new Json();
	json.setIgnoreUnknownFields(true);
	for (DefinitionReference reference : DefinitionReference.values()) {
		final String name = reference.id;
		final FileHandle handle = Gdx.files.external("umbracraft/" + name + ".json");
		if (handle.exists() && Gdx.app.getType() == ApplicationType.Desktop) {
			definitions.put(name, json.fromJson(reference.clazz, handle));
		} else {
			final FileHandle internalHandle = Gdx.files.internal("db/" + name + ".json");
			if (internalHandle.exists()) {
				definitions.put(name, json.fromJson(reference.clazz, internalHandle));
			} else {
				try {
					definitions.put(name, reference.clazz.newInstance());
				} catch (InstantiationException | IllegalAccessException e) {
					Game.error("Could not instantiate class: " + reference.clazz);
					e.printStackTrace();
				}
			}
		}
	}
}
 
開發者ID:adketuri,項目名稱:umbracraft,代碼行數:26,代碼來源:Db.java

示例8: saveScoreEtc

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
public void saveScoreEtc() {
	Preferences prefs = Gdx.app.getPreferences(GameSaves);
	// sum of all scores ever
	totalScoreSum += currentScore;
	prefs.putInteger("total_score_sum", totalScoreSum);
	// games played by player
	++totalGamesPlayed;
	prefs.putInteger("total_games_played", totalGamesPlayed);
	// save top score
	if (topScore < currentScore) {
		topScore = currentScore;
		// Save top score!!!!
		prefs.putInteger("topscore", topScore);
	}
	
	// hack / dont want to kill my ssd
	if (Gdx.app.getType() != ApplicationType.Desktop) {
		prefs.flush();
	}
}
 
開發者ID:igorcrevar,項目名稱:GoingUnder,代碼行數:21,代碼來源:GameManager.java

示例9: render

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
@Override
    public void render(float dt) {

  	Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

//compara si la aplicacion se ejecuta en escritorio o en android
if(Gdx.app.getType() == ApplicationType.Desktop){
	this.entradaEscritorio(dt);
}else if(Gdx.app.getType() == ApplicationType.Android){
	this.entradaAndroid(dt);
}
//actualizamos 
camara.update();
this.juegoGanado();
batch.setProjectionMatrix(camara.combined);
manejadorDeSprite.update(dt,arcanoid,jugador);

//renderiza el manejadorDeSprite, fondo de pantalla y fuente de jugador
batch.begin();
batch.draw(fondoPantalla, 0, 0,Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
jugador.draw(batch);
batch.end();
manejadorDeSprite.render();
    }
 
開發者ID:programacion2VideojuegosUM2015,項目名稱:practicos,代碼行數:26,代碼來源:PantallaJuego.java

示例10: getShader

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
@Override
public Shader getShader (Renderable renderable) {
	try {
		return super.getShader(renderable);
	} catch (Throwable e) {
		if (tempFolder != null && Gdx.app.getType() == ApplicationType.Desktop)
			Gdx.files.absolute(tempFolder).child(name + ".log.txt").writeString(e.getMessage(), false);
		if (!revert()) {
			Gdx.app.error("ShaderCollectionTest", e.getMessage());
			throw new GdxRuntimeException("Error creating shader, cannot revert to default shader", e);
		}
		error = true;
		Gdx.app.error("ShaderTest", "Could not create shader, reverted to default shader.", e);
		return super.getShader(renderable);
	}
}
 
開發者ID:if1live,項目名稱:amatsukaze,代碼行數:17,代碼來源:ShaderCollectionTest.java

示例11: create

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
@Override
public void create () {
	super.create();
	lights = new Environment();
	lights.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.1f, 0.1f, 0.1f, 1.f));
	lights.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -0.5f, -1.0f, -0.8f));

	shaderProvider = new TestShaderProvider();
	shaderBatch = new ModelBatch(shaderProvider);

	cam.position.set(1, 1, 1);
	cam.lookAt(0, 0, 0);
	cam.update();
	showAxes = true;

	onModelClicked("g3d/shapes/teapot.g3dj");

	shaderRoot = (hotLoadFolder != null && Gdx.app.getType() == ApplicationType.Desktop) ? Gdx.files.absolute(hotLoadFolder)
		: Gdx.files.internal("data/g3d/shaders");
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:21,代碼來源:ShaderCollectionTest.java

示例12: getUserFile

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
public FileHandle getUserFile(String filename) {
	FileHandle file = null;

	if (Gdx.app.getType() == ApplicationType.Desktop || Gdx.app.getType() == ApplicationType.Applet) {
		String dir = Config.getProperty(Config.TITLE_PROP, DESKTOP_PREFS_DIR);
		dir.replace(" ", "");

		StringBuilder sb = new StringBuilder();
		sb.append(".").append(dir).append("/").append(filename);
		
		if (System.getProperty("os.name").toLowerCase().contains("mac")
				&& System.getenv("HOME").contains("Containers")) {

			file = Gdx.files.absolute(System.getenv("HOME") + "/" + sb.toString());
		} else {

			file = Gdx.files.external(sb.toString());
		}
	} else {
		file = Gdx.files.local(NOT_DESKTOP_PREFS_DIR + filename);
	}

	return file;
}
 
開發者ID:bladecoder,項目名稱:bladecoder-adventure-engine,代碼行數:25,代碼來源:EngineAssetManager.java

示例13: getUserFolder

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
public FileHandle getUserFolder() {
	FileHandle file = null;

	if (Gdx.app.getType() == ApplicationType.Desktop || Gdx.app.getType() == ApplicationType.Applet) {
		String dir = Config.getProperty(Config.TITLE_PROP, DESKTOP_PREFS_DIR);
		dir.replace(" ", "");

		StringBuilder sb = new StringBuilder(".");
		
		if (System.getProperty("os.name").toLowerCase().contains("mac")
				&& System.getenv("HOME").contains("Containers")) {

			file = Gdx.files.absolute(System.getenv("HOME") + "/" + sb.append(dir).toString());
		} else {

			file = Gdx.files.external(sb.append(dir).toString());
		}
		
	} else {
		file = Gdx.files.local(NOT_DESKTOP_PREFS_DIR);
	}

	return file;
}
 
開發者ID:bladecoder,項目名稱:bladecoder-adventure-engine,代碼行數:25,代碼來源:EngineAssetManager.java

示例14: setHWCursorVisible

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
private void setHWCursorVisible(boolean visible) throws LWJGLException {
	if (Gdx.app.getType() != ApplicationType.Desktop && Gdx.app instanceof LwjglApplication)
		return;
	if (_emptyCursor == null) {
		if (Mouse.isCreated()) {
			int min = org.lwjgl.input.Cursor.getMinCursorSize();
			IntBuffer tmp = BufferUtils.createIntBuffer(min * min);
			_emptyCursor = new org.lwjgl.input.Cursor(min, min, min / 2, min / 2, 1, tmp, null);
		} else {
			throw new LWJGLException(
					"Could not create empty cursor before Mouse object is created");
		}
	}
	if (Mouse.isInsideWindow())
		Mouse.setNativeCursor(visible ? null : _emptyCursor);
}
 
開發者ID:Leopard2A5,項目名稱:XFTL,代碼行數:17,代碼來源:ApplicationAdapter.java

示例15: GLView

import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
public GLView() {
		if(Gdx.app.getType() == ApplicationType.Desktop) {
			setFrameSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
		} else {
			setFrameSize(Gdx.graphics.getDisplayMode().width, Gdx.graphics.getDisplayMode().height);
		}

if(CCMacros.USE_CC_TOUCH_LISTENER) {
		_eventDispatcher = Director.justInstance().getEventDispatcher();
		BaseInput.instance().addInputProcessor(this);
		createPools();
}
		
		CCLog.engine(TAG, "glview init -> size = " + getFrameSize());
	}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:16,代碼來源:GLView.java


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