本文整理汇总了Java中com.badlogic.gdx.utils.viewport.ExtendViewport类的典型用法代码示例。如果您正苦于以下问题:Java ExtendViewport类的具体用法?Java ExtendViewport怎么用?Java ExtendViewport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExtendViewport类属于com.badlogic.gdx.utils.viewport包,在下文中一共展示了ExtendViewport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
@Override
public void show() {
iciclesViewport = new ExtendViewport(Constants.WORLD_SIZE, Constants.WORLD_SIZE);
renderer = new ShapeRenderer();
renderer.setAutoShapeType(true);
// TODO: Initialize the HUD viewport
hudViewport = new ScreenViewport();
// TODO: Initialize the SpriteBatch
batch = new SpriteBatch();
// TODO: Initialize the BitmapFont
font = new BitmapFont();
// TODO: Give the font a linear TextureFilter
font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
player = new Player(iciclesViewport);
icicles = new Icicles(iciclesViewport);
// TODO: Set top score to zero
topScore = 0;
}
示例2: Level
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
public Level() {
viewport = new ExtendViewport(Constants.WORLD_SIZE, Constants.WORLD_SIZE);
gigaGal = new GigaGal(new Vector2(50, 50), this);
platforms = new Array<Platform>();
enemies = new DelayedRemovalArray<Enemy>();
bullets = new DelayedRemovalArray<Bullet>();
explosions = new DelayedRemovalArray<Explosion>();
powerups = new DelayedRemovalArray<Powerup>();
exitPortal = new ExitPortal(new Vector2(200, 200));
gameOver = false;
victory = false;
score = 0;
}
示例3: show
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
@Override
public void show() {
iciclesViewport = new ExtendViewport(Constants.WORLD_SIZE, Constants.WORLD_SIZE);
renderer = new ShapeRenderer();
renderer.setAutoShapeType(true);
hudViewport = new ScreenViewport();
batch = new SpriteBatch();
font = new BitmapFont();
font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
player = new Player(iciclesViewport);
icicles = new Icicles(iciclesViewport, difficulty);
Gdx.input.setInputProcessor(this);
topScore = 0;
}
示例4: MyScreenAdapter
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
public MyScreenAdapter() {
System.out.println("ScreenAdapter Reset.");
cam = new OrthographicCamera();
batch = new SpriteBatch();
shape = new ShapeRenderer();
viewport = new ExtendViewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT, cam);
viewport.apply();
//reset camera
cam.zoom = 1;
setZoomTarget(1);
//set this as input processor for mouse wheel scroll events
Gdx.input.setInputProcessor(this);
//debug
toggleVsync();
//
}
示例5: show
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
@Override
public void show() {
AssetManager am = new AssetManager();
Assets.instance.init(am);
batch = new SpriteBatch();
gameplayViewport = new ExtendViewport(Constants.WORLD_SIZE, Constants.WORLD_SIZE);
// TODO: Comment out the debug level
// level = new Level(gameplayViewport);
// level.initializeDebugLevel();
// TODO: Ask the LevelLoader to load Level1
level = LevelLoader.load("Level1", gameplayViewport);
chaseCam = new ChaseCam(gameplayViewport.getCamera(), level.getGigaGal());
}
示例6: show
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
@Override
public void show() {
if (arcadeWorld == null || reInit) {
AL.getAudioManager().registerSound("sword_1", levelAssets.sword_1);
AL.getAudioManager().registerSound("sword_2", levelAssets.sword_2);
AL.getAudioManager().registerSound("sword_3", levelAssets.sword_3);
AL.getAudioManager().registerSound("sword_4", levelAssets.sword_4);
AL.getAudioManager().registerSound("rocketlauncher", levelAssets.rocketLauncher);
AL.getAudioManager().registerSound("boom", levelAssets.boom);
spriteBatch = new SpriteBatch();
font = new BitmapFont();
camera = new PerspectiveCamera();
camera.far = 1000;
camera.position.set(new Vector3(-.5f, -.5f, 35));
camera.rotateAround(new Vector3(-.5f, -.5f, 0), Vector3.X, rot);
camera.fieldOfView = 15;
camera.update();
viewport = new ExtendViewport(1920, 1080, camera);
viewport.apply();
uiCamera = new OrthographicCamera();
uiViewport = new FitViewport(1920, 1080, uiCamera);
uiStage = new Stage(uiViewport);
map = levelAssets.get(mapName);
arcadeWorld = new ArcadeWorld(map, rot, camera, levelAssets);
initUI();
reInit = false;
playerEnt = -1;
spawnPlayer();
enemies = arcadeWorld.spawnEnemies(playerEnt);
arcadeWorld.setDebug(AL.getMiscellaneousConfig().debug());
}
Gdx.input.setInputProcessor(this);
}
示例7: create
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
@Override
public void create () {
// When game is started
// Graphics
spriteBatch = new SpriteBatch();
// Audio
musicManager = new MusicManager();
soundManager = new SoundManager();
// Setting Cameras to the size of the game window
cam = new OrthographicCamera(WIDTH, HEIGHT);
viewport = new ExtendViewport(WIDTH, HEIGHT, cam);
cam.position.set(cam.viewportWidth / 2f, cam.viewportHeight / 2f, 0);
cam.update(); // commit cam changes from translate
// Start Keyboard Input
input = new GameInputProcessor();
Gdx.input.setInputProcessor(input);
// Start Image Manager
imageManager = new ImageManager();
// Start Game State Manager
gsm = new GameStateManager(this);
}
示例8: create
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
@Override
public void create () {
batch = new SpriteBatch();
assetManager = new AssetManager();
viewport = new ExtendViewport(512, 854);
atlas = new TextureAtlas("retro-normal-font/retro-normal-font.atlas");
skin = new Skin(Gdx.files.internal("retro-normal-font/retro-normal-font.json"), atlas);
loadAssets();
playServices.signIn();
setScreen(new MainMenuView(this));
}
示例9: PlayScreen
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
public PlayScreen(QuackHack game) {
this.game = game;
gamecam = new OrthographicCamera();
gamePort = new ExtendViewport(QuackHack.V_WIDTH * 4 / QuackHack.PPM, QuackHack.V_HEIGHT * 4 / QuackHack.PPM, gamecam);
hud = new Hud(game);
maploader = new TmxMapLoader();
map = maploader.load("Tunnelv0.tmx");
renderer = new OrthogonalTiledMapRenderer(map, 1 / QuackHack.PPM);
gameMusic = Gdx.audio.newMusic(Gdx.files.internal("Airborn.wav"));
gameMusic.setLooping(true);
gameMusic.play();
gamecam.position.set(gamePort.getMinWorldWidth() / 2, gamePort.getMinWorldHeight() / 2, 0);
world = new World(new Vector2(0, -100), true);
//b2dr = new Box2DDebugRenderer();
new B2WorldCreator(world, map, this);
world.setContactListener(new WorldContactListener());
game.getServer().registerNetListener(this);
rayHandler = rayHandlerGenerator();
for(Connection c: game.getServer().getPlayers()) {
System.out.println("New Player! id: "+game.getServer().getPlayerType(c.getID()).toString());
players.put(c.getID(), new Player(c.getID(), world, this, game.getServer().getPlayerType(c.getID())));
}
game.getServer().sendCommand(NetCommand.PLAYER_JOIN);
//http://www.badlogicgames.com/forum/viewtopic.php?f=17&t=1795
rbg = new ParallaxBackground(new ParallaxLayer[]{
new ParallaxLayer(new TextureRegion(new Texture(Gdx.files.internal("blue_grass.png"))),new Vector2(0.5f, 0.5f),new Vector2(0, 300)),
//new ParallaxLayer(atlas.findRegion("bg2"),new Vector2(1.0f,1.0f),new Vector2(0, 500)),
}, 800, 480,new Vector2(150,0));
}
示例10: Hud
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
public Hud(QuackHack game){
this.game = game;
worldTimer = 10;
timeCount = 0;
score = 0;
viewport = new ExtendViewport(960*4, 640*4, new OrthographicCamera());
stage = new Stage(viewport, game.batch);
Table table = new Table();
table.top();
table.setFillParent(true);
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/BEBAS.ttf"));
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
parameter.size = 150*4;
countdownLabel = new Label(String.format("%d", worldTimer), new Label.LabelStyle(generator.generateFont(parameter), Color.WHITE));
parameter.size = 24*4;
timeLabel = new Label("GAME STARTS IN ", new Label.LabelStyle(generator.generateFont(parameter), Color.WHITE));
parameter.size = 80*4;
nameLabel = new Label("GAME FULL OF ANIMALS", new Label.LabelStyle(generator.generateFont(parameter), Color.WHITE));
parameter.size = 30*4;
playerLabel = new Label(String.format("%d ", game.getServer().getPlayers().length) + " PLAYERS WAITING", new Label.LabelStyle(generator.generateFont(parameter), Color.WHITE));
table.add(nameLabel).expandX().padTop(450);
table.row();
table.add(timeLabel).expandX().padTop(55);
table.row();
table.add(countdownLabel).expandX().pad(30);
table.row();
table.add(playerLabel).expandX();
stage.addActor(table);
}
示例11: LobbyHUD
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
public LobbyHUD(QuackHack game){
this.game = game;
this.reset();
viewport = new ExtendViewport(960*4, 640*4, new OrthographicCamera());
stage = new Stage(viewport, game.batch);
Table table = new Table();
table.top();
table.setFillParent(true);
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/BEBAS.ttf"));
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
parameter.size = 150*4;
countdownLabel = new Label(String.format("%d", worldTimer), new Label.LabelStyle(generator.generateFont(parameter), Color.WHITE));
parameter.size = 24*4;
timeLabel = new Label("GAME STARTS IN ", new Label.LabelStyle(generator.generateFont(parameter), Color.WHITE));
parameter.size = 80*4;
nameLabel = new Label("Please wait...", new Label.LabelStyle(generator.generateFont(parameter), Color.WHITE));
parameter.size = 30*4;
playerLabel = new Label(String.format("%d ", game.getServer().getPlayers().length) + " PLAYERS WAITING", new Label.LabelStyle(generator.generateFont(parameter), Color.WHITE));
table.add(nameLabel).expandX().padTop(450);
table.row();
table.add(timeLabel).expandX().padTop(55);
table.row();
table.add(countdownLabel).expandX().pad(30);
table.row();
table.add(playerLabel).expandX();
stage.addActor(table);
}
示例12: createStage
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
private void createStage(final boolean initiallyEmptyStage) {
if (initiallyEmptyStage) {
stage = new Stage();
stage.addActor(stageBuilder.createRootGroup(null));
} else {
stage = stageBuilder.build(fileName, new ExtendViewport(width, height));
}
stage.setDebugAll(true);
}
示例13: setupCamera
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
/**
* Sets up the world camera according to the data computed in setupMapBoundsAndDimensions() method
*/
private void setupCamera() {
//Centers worldCamera on map
worldCamera.translate(mapPartCenter.x, mapPartCenter.y);
//Maximizes the map size on screen
worldCamera.viewportWidth = mapPartPixWidth;
worldCamera.viewportHeight = mapPartPixHeight;
worldViewport = new ExtendViewport(mapPartPixWidth, mapPartPixHeight, worldCamera);
}
示例14: show
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
@Override
public void show() {
iciclesViewport = new ExtendViewport(Constants.WORLD_SIZE, Constants.WORLD_SIZE);
renderer = new ShapeRenderer();
renderer.setAutoShapeType(true);
player = new Player(iciclesViewport);
// TODO: Initialize icicles
icicles = new Icicles(iciclesViewport);
}
示例15: show
import com.badlogic.gdx.utils.viewport.ExtendViewport; //导入依赖的package包/类
@Override
public void show() {
iciclesViewport = new ExtendViewport(Constants.WORLD_SIZE, Constants.WORLD_SIZE);
renderer = new ShapeRenderer();
renderer.setAutoShapeType(true);
player = new Player(iciclesViewport);
icicles = new Icicles(iciclesViewport);
}