本文整理汇总了Java中com.badlogic.gdx.Application.ApplicationType类的典型用法代码示例。如果您正苦于以下问题:Java ApplicationType类的具体用法?Java ApplicationType怎么用?Java ApplicationType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationType类属于com.badlogic.gdx.Application包,在下文中一共展示了ApplicationType类的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;
}
示例2: startCubes
import com.badlogic.gdx.Application.ApplicationType; //导入依赖的package包/类
public void startCubes() {
compatibility = this;
Thread.setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler.instance);
Thread.currentThread().setUncaughtExceptionHandler(UncaughtExceptionHandler.instance);
try {
if (applicationType == ApplicationType.HeadlessDesktop) {
run(new ServerAdapter());
} else {
run(new ClientAdapter());
}
} catch (Exception e) {
try {
Log.error("Failed to start", CubesException.get(e));
} catch (Exception ex) {
if (ex instanceof CubesException) {
throw (CubesException) ex;
} else {
throw CubesException.get(e);
}
}
}
}
示例3: 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));
}
}
示例4: create
import com.badlogic.gdx.Application.ApplicationType; //导入依赖的package包/类
/**
* Method called once when the application is created.
*/
@Override
public void create()
{
//Load all textures
TextureManager.load();
AudioManager.load();
this.setScreen(new StartScreen(this, client, server));
if(Constants.TINYWINDOWS)
{
Gdx.graphics.setWindowedMode(Constants.SCREENWIDTH / 2, Constants.SCREENHEIGHT/ 2);
}
if(Gdx.app.getType().equals(ApplicationType.Android))
{
Constants.ISRUNNINGONSMARTPHONE = true;
}
}
示例5: pause
import com.badlogic.gdx.Application.ApplicationType; //导入依赖的package包/类
@Override
public void pause() {
if (!Gdx.app.getType().equals(ApplicationType.Desktop)) {
systemPaused = true;
}
log("Pause");
Gdx.input.setInputProcessor(null);
if (music != null) {
if (!Gdx.app.getType().equals(ApplicationType.Desktop)) {
wasMusicPlaying = music.isPlaying();
music.pause();
}
} else {
wasMusicPlaying = false;
}
}
示例6: 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)
{
}
}
示例7: draw
import com.badlogic.gdx.Application.ApplicationType; //导入依赖的package包/类
@Override
public void draw (float delta) {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
viewMatrix.setToOrtho2D(0, 0, 480, 320);
spriteBatch.setProjectionMatrix(viewMatrix);
spriteBatch.setTransformMatrix(transformMatrix);
spriteBatch.begin();
spriteBatch.disableBlending();
spriteBatch.setColor(Color.WHITE);
spriteBatch.draw(background, 0, 0, 480, 320, 0, 0, 512, 512, false, false);
spriteBatch.enableBlending();
spriteBatch.draw(logo, 0, 320 - 128, 480, 128, 0, 0, 512, 256, false, false);
spriteBatch.setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);
glyphLayout.setText(font, "Touch screen to start!");
font.draw(spriteBatch, glyphLayout, 240 - glyphLayout.width / 2, 128);
if (Gdx.app.getType() == ApplicationType.WebGL) {
glyphLayout.setText(font, "Press Enter for Fullscreen Mode");
font.draw(spriteBatch, glyphLayout, 240 - glyphLayout.width / 2, 128 - font.getLineHeight());
}
spriteBatch.end();
}
示例8: create
import com.badlogic.gdx.Application.ApplicationType; //导入依赖的package包/类
@Override
public void create () {
Array<Controller> controllers = Controllers.getControllers();
if (controllers.size > 0) {
controller = controllers.first();
}
Controllers.addListener(controllerListener);
setScreen(new MainMenu(this));
music = Gdx.audio.newMusic(Gdx.files.getFileHandle("data/8.12.mp3", FileType.Internal));
music.setLooping(true);
music.play();
Gdx.input.setInputProcessor(new InputAdapter() {
@Override
public boolean keyUp (int keycode) {
if (keycode == Keys.ENTER && Gdx.app.getType() == ApplicationType.WebGL) {
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
}
return true;
}
});
fps = new FPSLogger();
}
示例9: show
import com.badlogic.gdx.Application.ApplicationType; //导入依赖的package包/类
@Override
public void show () {
font = new BitmapFont(Gdx.files.internal("fonts/font.fnt"));
cache = font.getCache();
if (Gdx.app.getType() == ApplicationType.Android)
font.getData().setScale(2);
polygonBatch = new PolygonSpriteBatch();
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
Pixmap pixMap = new Pixmap(1, 1, Format.RGB565);
pixMap.setColor(Color.WHITE);
pixMap.fill();
emptyTexture = new Texture(pixMap);
pixMap.dispose();
}
示例10: 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");
*/
}
}
示例11: 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();
}
}
示例12: tryLoadHTMLTwitterAPI
import com.badlogic.gdx.Application.ApplicationType; //导入依赖的package包/类
private void tryLoadHTMLTwitterAPI() {
if (Gdx.app.getType() != ApplicationType.WebGL) {
Gdx.app.debug(TAG, "Skip loading gdx-twitter for HTML. Not running HTML. \n");
return;
}
try {
final Class<?> twitterClazz = ClassReflection.forName("de.tomgrill.gdxtwitter.html.HTMLTwitterAPI");
Object twitter = ClassReflection.getConstructor(twitterClazz, TwitterConfig.class).newInstance(config);
twitterAPI = (TwitterAPI) twitter;
Gdx.app.debug(TAG, "gdx-twitter for HTML loaded successfully.");
} catch (ReflectionException e) {
Gdx.app.debug(TAG, "Error creating gdx-twitter for HTML (are the gdx-twitter **.jar files installed?). \n");
e.printStackTrace();
}
}
示例13: tryLoadIOSTWitterAPI
import com.badlogic.gdx.Application.ApplicationType; //导入依赖的package包/类
private void tryLoadIOSTWitterAPI() {
if (Gdx.app.getType() != ApplicationType.iOS) {
Gdx.app.debug(TAG, "Skip loading gdx-twitter for iOS. Not running iOS. \n");
return;
}
try {
// Class<?> activityClazz =
// ClassReflection.forName("com.badlogic.gdx.backends.iosrobovm.IOSApplication");
final Class<?> twitterClazz = ClassReflection.forName("de.tomgrill.gdxtwitter.ios.IOSTwitterAPI");
Object twitter = ClassReflection.getConstructor(twitterClazz, TwitterConfig.class).newInstance(config);
twitterAPI = (TwitterAPI) twitter;
Gdx.app.debug(TAG, "gdx-twitter for iOS loaded successfully.");
} catch (ReflectionException e) {
Gdx.app.debug(TAG, "Error creating gdx-twitter for iOS (are the gdx-twitter **.jar files installed?). \n");
e.printStackTrace();
}
}
示例14: FinishScene
import com.badlogic.gdx.Application.ApplicationType; //导入依赖的package包/类
public FinishScene(Application app) {
setFillParent(true);
Label label = new Label("You have beaten this level!", app.getGuiSkin());
add(label);
row().padTop(175.f);
Label label1;
Label label2;
if (Gdx.app.getType() != ApplicationType.Android) {
label1 = new Label("Press Space or click left to go to the next level", app.getGuiSkin());
label2 = new Label("Press Escape to go back to menu", app.getGuiSkin());
} else {
label1 = new Label("Touch the screen to go to the next level", app.getGuiSkin());
label2 = new Label("Press the back button to go back to the menu", app.getGuiSkin());
}
add(label1);
row().padTop(75.f);
add(label2);
pack();
setColor(1, 1, 1, 0);
}
示例15: PauseScene
import com.badlogic.gdx.Application.ApplicationType; //导入依赖的package包/类
public PauseScene(Application app) {
setFillParent(true);
Label label1;
Label label2;
if (Gdx.app.getType() != ApplicationType.Android) {
label1 = new Label("Press Space or press Left to resume the game", app.getGuiSkin());
label2 = new Label("Press Escape to go back to the menu", app.getGuiSkin());
} else {
label1 = new Label("Touch the screen to resume the game", app.getGuiSkin());
label2 = new Label("Press the back button to go back to the menu", app.getGuiSkin());
}
add(new Label("Game paused", app.getGuiSkin()));
row().padTop(150.f);
add(label1);
row().padTop(75.f);
add(label2);
pack();
setColor(1, 1, 1, 0);
}