当前位置: 首页>>代码示例>>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;未经允许,请勿转载。