当前位置: 首页>>代码示例>>Java>>正文


Java ExtendViewport类代码示例

本文整理汇总了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;
}
 
开发者ID:udacity,项目名称:ud405,代码行数:26,代码来源:IciclesScreen.java

示例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;


}
 
开发者ID:udacity,项目名称:ud406,代码行数:18,代码来源:Level.java

示例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;
}
 
开发者ID:udacity,项目名称:ud405,代码行数:21,代码来源:IciclesScreen.java

示例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();
//
  }
 
开发者ID:0XDE57,项目名称:SpaceProject,代码行数:22,代码来源:MyScreenAdapter.java

示例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());
    }
 
开发者ID:udacity,项目名称:ud406,代码行数:17,代码来源:GameplayScreen.java

示例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);
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:41,代码来源:LevelScreen.java

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

}
 
开发者ID:ja-brouil,项目名称:StarshipFighters,代码行数:30,代码来源:Game.java

示例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));
}
 
开发者ID:antonioalmeida,项目名称:retro-reversi,代码行数:14,代码来源:Reversi.java

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

}
 
开发者ID:edwardszczepanski,项目名称:QuackHack,代码行数:36,代码来源:PlayScreen.java

示例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);
}
 
开发者ID:edwardszczepanski,项目名称:QuackHack,代码行数:37,代码来源:Hud.java

示例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);
}
 
开发者ID:edwardszczepanski,项目名称:QuackHack,代码行数:35,代码来源:LobbyHUD.java

示例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);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:11,代码来源:UiManager.java

示例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);
}
 
开发者ID:RageGo,项目名称:RageGo,代码行数:13,代码来源:GoGameScreen.java

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

}
 
开发者ID:udacity,项目名称:ud405,代码行数:13,代码来源:IciclesScreen.java

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

}
 
开发者ID:udacity,项目名称:ud405,代码行数:12,代码来源:IciclesScreen.java


注:本文中的com.badlogic.gdx.utils.viewport.ExtendViewport类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。