本文整理匯總了Java中com.badlogic.gdx.Application.ApplicationType.iOS方法的典型用法代碼示例。如果您正苦於以下問題:Java ApplicationType.iOS方法的具體用法?Java ApplicationType.iOS怎麽用?Java ApplicationType.iOS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.Application.ApplicationType
的用法示例。
在下文中一共展示了ApplicationType.iOS方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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();
}
}
示例2: consumeCustomData
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
@Override
public void consumeCustomData (int target) {
if (!Gdx.graphics.supportsExtension("texture_float"))
throw new GdxRuntimeException("Extension OES_TEXTURE_FLOAT not supported!");
// this is a const from GL 3.0, used only on desktops
final int GL_RGBA32F = 34836;
// GLES and WebGL defines texture format by 3rd and 8th argument,
// so to get a float texture one needs to supply GL_RGBA and GL_FLOAT there.
if (Gdx.app.getType() == ApplicationType.Android || Gdx.app.getType() == ApplicationType.iOS
|| Gdx.app.getType() == ApplicationType.WebGL) {
Gdx.gl.glTexImage2D(target, 0, GL20.GL_RGBA, width, height, 0, GL20.GL_RGBA, GL20.GL_FLOAT, buffer);
} else {
// in desktop OpenGL the texture format is defined only by the third argument,
// hence we need to use GL_RGBA32F there (this constant is unavailable in GLES/WebGL)
Gdx.gl.glTexImage2D(target, 0, GL_RGBA32F, width, height, 0, GL20.GL_RGBA, GL20.GL_FLOAT, buffer);
}
}
示例3: keyUp
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
@Override
public boolean keyUp(int keycode) {
if(keycode==Keys.ESCAPE)
{
Gdx.app.log("MainMenu", "quit");
if(Gdx.app.getType()!=ApplicationType.iOS)
Gdx.app.exit();
return true;
}
return false;
}
示例4: UserInterface
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
public UserInterface(){
logger = new Logger("UserInterface",LOG_LEVEL);
logger.debug("initializing");
stage = new Stage();
isTouchScreen = (Gdx.app.getType() == ApplicationType.Android ||
Gdx.app.getType() == ApplicationType.iOS);
if (isTouchScreen) {
logger.info("Touchscreen detected");
createTouchControls();
}
}
示例5: getPlatform
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
public static String getPlatform() {
ApplicationType type = Gdx.app.getType();
if (type == ApplicationType.Desktop)
return "desktop";
if (type == ApplicationType.Android)
return "android";
if (type == ApplicationType.iOS)
return "ios";
if (type == ApplicationType.Applet)
return "applet";
if (type == ApplicationType.WebGL)
return "web";
return "desktop";
}
示例6: platform
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
public static String platform() {
ApplicationType type = Gdx.app.getType();
if (type == ApplicationType.Desktop)
return "desktop";
if (type == ApplicationType.Android)
return "android";
if (type == ApplicationType.iOS)
return "ios";
if (type == ApplicationType.Applet)
return "applet";
if (type == ApplicationType.WebGL)
return "web";
return "desktop";
}
示例7: generateMipMap
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
/** Sets the image data of the {@link Texture} based on the {@link Pixmap}. The texture must be bound for this to work. If
* <code>disposePixmap</code> is true, the pixmap will be disposed at the end of the method. */
public static void generateMipMap (int target, Pixmap pixmap, int textureWidth, int textureHeight) {
if (!useHWMipMap) {
generateMipMapCPU(target, pixmap, textureWidth, textureHeight);
return;
}
if (Gdx.app.getType() == ApplicationType.Android || Gdx.app.getType() == ApplicationType.WebGL
|| Gdx.app.getType() == ApplicationType.iOS) {
generateMipMapGLES20(target, pixmap);
} else {
generateMipMapDesktop(target, pixmap, textureWidth, textureHeight);
}
}
示例8: updateRunning
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
private void updateRunning (float deltaTime) {
if (Gdx.input.justTouched()) {
guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));
if (OverlapTester.pointInRectangle(pauseBounds, touchPoint.x, touchPoint.y)) {
Assets.playSound(Assets.clickSound);
state = GAME_PAUSED;
return;
}
}
ApplicationType appType = Gdx.app.getType();
// should work also with Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer)
if (appType == ApplicationType.Android || appType == ApplicationType.iOS) {
world.update(deltaTime, Gdx.input.getAccelerometerX());
} else {
float accel = 0;
if (Gdx.input.isKeyPressed(Keys.DPAD_LEFT)) accel = 5f;
if (Gdx.input.isKeyPressed(Keys.DPAD_RIGHT)) accel = -5f;
world.update(deltaTime, accel);
}
if (world.score != lastScore) {
lastScore = world.score;
scoreString = "SCORE: " + lastScore;
}
if (world.state == World.WORLD_STATE_NEXT_LEVEL) {
state = GAME_LEVEL_END;
}
if (world.state == World.WORLD_STATE_GAME_OVER) {
state = GAME_OVER;
if (lastScore >= Settings.highscores[4])
scoreString = "NEW HIGHSCORE: " + lastScore;
else
scoreString = "SCORE: " + lastScore;
Settings.addScore(lastScore);
Settings.save();
}
}
示例9: create
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
/**
* First of all, load resources.
* When resource loading was finished,
* we will enter the game initialization operation.
*/
@Override
public final void create() {
try {
this.shapeRenderer = new ShapeRenderer();
//set up the FPS
if (engineConfig.debug) this.fps = new C2dFps();
if (engineConfig.catchBackKey) Gdx.input.setCatchBackKey(true);
//set up the TweenEngine
this.setupTweenEngine();
//set up the camera
this.setupCamera();
//the resource manager
this.assetManager = new AssetManager();
this.assetManager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
this.aliasResourceManager = new AliasResourceManager<String>();
this.soundManager = new SoundManager();
this.musicManager = new MusicManager();
this.languagesManager = new LanguagesManager();
//the event manager
this.eventManager = new EventManagerImpl();
//set up the sprite batch
this.spriteBatch = new SpriteBatch();
//set up the default font
if (Gdx.app.getType() == ApplicationType.WebGL || Gdx.app.getType() == ApplicationType.iOS) {
this.defaultFont = new BitmapFont(Gdx.files.internal("data/font-c2d.fnt"), false);
} else {
this.defaultFont = new BitmapFont();
}
//set up the default preferences
this.preferences = Gdx.app.getPreferences(engineConfig.configFile);
if (null != engineCallback) {
engineCallback.preLoad(Gdx.graphics.getDisplayMode(), engineConfig.assets);
}
//loading screen
this.setupLoading();
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例10: updateRunning
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
private void updateRunning (float deltaTime) {
if (Gdx.input.justTouched()) {
guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));
if (OverlapTester.pointInRectangle(pauseBounds, touchPoint.x, touchPoint.y)) {
Assets.playSound(Assets.clickSound);
state = GAME_PAUSED;
return;
}
}
ApplicationType appType = Gdx.app.getType();
// should work also with Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer)
if (appType == ApplicationType.Android || appType == ApplicationType.iOS) {
world.update(deltaTime, Gdx.input.getAccelerometerX());
} else {
float accel = 0;
if (Gdx.input.isKeyPressed(Keys.DPAD_LEFT)) accel = 5f;
if (Gdx.input.isKeyPressed(Keys.DPAD_RIGHT)) accel = -5f;
world.update(deltaTime, accel);
}
if (world.score != lastScore) {
lastScore = world.score;
scoreString = "SCORE: " + lastScore;
}
if (world.state == World.WORLD_STATE_NEXT_LEVEL) {
state = GAME_LEVEL_END;
}
if (world.state == World.WORLD_STATE_GAME_OVER) {
state = GAME_OVER;
if (lastScore >= Settings.highscores[4])
scoreString = "NEW HIGHSCORE: " + lastScore;
else
scoreString = "SCORE: " + lastScore;
Settings.addScore(lastScore);
Settings.save();
}
}
示例11: isIOS
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
public static boolean isIOS() {
return Gdx.app.getType() == ApplicationType.iOS;
}
示例12: isRunningOnIOS
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
public static boolean isRunningOnIOS() {
return Gdx.app.getType() == ApplicationType.iOS;
}
示例13: isTouchScreen
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
@Override
public boolean isTouchScreen() {
return appType == ApplicationType.Android || appType == ApplicationType.iOS;
}
示例14: initSpace
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
private void initSpace(LandConfig landCFG) {
System.out.println("==========SPACE==========");
GameScreen.landCFG = landCFG;
inSpace = true;
// engine to handle all entities and components
engine = new Engine();
//===============ENTITIES===============
//test ships
engine.addEntity(EntityFactory.createShip3(-100, 400));
engine.addEntity(EntityFactory.createShip3(-200, 400));
engine.addEntity(EntityFactory.createShip3(-300, 400));
engine.addEntity(EntityFactory.createShip3(-400, 400));
Entity aiTest = EntityFactory.createCharacterAI(0, 400);
//aiTest.add(new CameraFocusComponent());
engine.addEntity(aiTest);
//add player
Entity ship = landCFG.ship;
ship.add(new CameraFocusComponent());
ship.add(new ControlFocusComponent());
ship.getComponent(TransformComponent.class).pos.x = landCFG.position.x;
ship.getComponent(TransformComponent.class).pos.y = landCFG.position.y;
engine.addEntity(ship);
//System.out.println("ship: " + String.format("%X", ship.hashCode()));
//===============SYSTEMS===============
//input
if (Gdx.app.getType() == ApplicationType.Android || Gdx.app.getType() == ApplicationType.iOS) {
engine.addSystem(new MobileInputSystem());
} else {
engine.addSystem(new DesktopInputSystem());
}
engine.addSystem(new AISystem());
//loading
engine.addSystem(new SpaceLoadingSystem());
engine.addSystem(new SpaceParallaxSystem());
//Ai...
//logic
engine.addSystem(new ScreenTransitionSystem());
engine.addSystem(new ControlSystem());
engine.addSystem(new ExpireSystem(1));
engine.addSystem(new OrbitSystem());
engine.addSystem(new MovementSystem());
engine.addSystem(new BoundsSystem());
engine.addSystem(new CollisionSystem());
//rendering
engine.addSystem(new CameraSystem());
engine.addSystem(new SpaceRenderingSystem());
engine.addSystem(new HUDSystem());
engine.addSystem(new DebugUISystem());
//DebugUISystem.printEntities(engine);
//DebugUISystem.printSystems(engine);
}
示例15: initWorld
import com.badlogic.gdx.Application.ApplicationType; //導入方法依賴的package包/類
private void initWorld(LandConfig landCFG) {
System.out.println("==========WORLD==========");
DebugUISystem.printObjectFields(landCFG.planet);
GameScreen.landCFG = landCFG;
inSpace = false;
// engine to handle all entities and components
engine = new Engine();
// ===============ENTITIES===============
// add player
Entity ship = landCFG.ship;
int position = landCFG.planet.mapSize * SpaceProject.tileSize / 2;//set position to middle of planet
ship.getComponent(TransformComponent.class).pos.x = position;
ship.getComponent(TransformComponent.class).pos.y = position;
//ship.add(new ControllableComponent());
//ship.add(new CameraFocusComponent());
ship.add(new ControlFocusComponent());
engine.addEntity(ship);
//System.out.println("ship: " + String.format("%X", ship.hashCode()));
// test ships near player
engine.addEntity(EntityFactory.createShip3(position + 100, position + 300));
engine.addEntity(EntityFactory.createShip3(position - 100, position + 300));
Entity aiTest = EntityFactory.createCharacterAI(position, position + 50);
//aiTest.add(new CameraFocusComponent());
engine.addEntity(aiTest);
// ===============SYSTEMS===============
// input
if (Gdx.app.getType() == ApplicationType.Android || Gdx.app.getType() == ApplicationType.iOS) {
engine.addSystem(new MobileInputSystem());
} else {
engine.addSystem(new DesktopInputSystem());
}
engine.addSystem(new AISystem());
// loading
// logic
engine.addSystem(new ScreenTransitionSystem());
engine.addSystem(new ControlSystem());
engine.addSystem(new ExpireSystem(1));
engine.addSystem(new MovementSystem());
engine.addSystem(new WorldWrapSystem(landCFG.planet.mapSize));
engine.addSystem(new BoundsSystem());
engine.addSystem(new CollisionSystem());
// rendering
engine.addSystem(new CameraSystem());
engine.addSystem(new WorldRenderingSystem(landCFG.planet));
engine.addSystem(new HUDSystem());
engine.addSystem(new DebugUISystem());
//DebugUISystem.printEntities(engine);
//DebugUISystem.printSystems(engine);
}