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


Java ApplicationType類代碼示例

本文整理匯總了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;
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:21,代碼來源:Engine.java

示例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);
      }
    }
  }
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:25,代碼來源:Compatibility.java

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

示例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;
    }
}
 
開發者ID:Aeo-Informatik,項目名稱:Space-Bombs,代碼行數:23,代碼來源:Main.java

示例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;
	}
}
 
開發者ID:CherokeeLanguage,項目名稱:cll1-gdx,代碼行數:17,代碼來源:AbstractScreen.java

示例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)
    {
    }
}
 
開發者ID:ncguy2,項目名稱:Argent,代碼行數:27,代碼來源:ScreenshotFactory.java

示例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();
}
 
開發者ID:Motsai,項目名稱:neblina-libgdx3d,代碼行數:23,代碼來源:MainMenu.java

示例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();
}
 
開發者ID:Motsai,項目名稱:neblina-libgdx3d,代碼行數:25,代碼來源:Invaders.java

示例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();
}
 
開發者ID:Quexten,項目名稱:RavTech,代碼行數:17,代碼來源:RemoteEditLoadingScreen.java

示例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");
		 */
	}
}
 
開發者ID:Quexten,項目名稱:RavTech,代碼行數:25,代碼來源:ShaderManager.java

示例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();
	}

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

示例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();
	}

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

示例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();
		}

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

示例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);
}
 
開發者ID:AlexAUT,項目名稱:Kroniax,代碼行數:27,代碼來源:FinishScene.java

示例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);
}
 
開發者ID:AlexAUT,項目名稱:Kroniax,代碼行數:26,代碼來源:PauseScene.java


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