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


Java OrthographicCamera.update方法代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.OrthographicCamera.update方法的典型用法代码示例。如果您正苦于以下问题:Java OrthographicCamera.update方法的具体用法?Java OrthographicCamera.update怎么用?Java OrthographicCamera.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.graphics.OrthographicCamera的用法示例。


在下文中一共展示了OrthographicCamera.update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEnter

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public void onEnter() {
	super.onEnter();
	
	float w = Gdx.graphics.getWidth();
	float h = Gdx.graphics.getHeight();

	camera = new OrthographicCamera();
	camera.setToOrtho(false, (w / h) * 640, 640);
	camera.update();
	
	map = new TmxMapLoader().load("Resource/tiles.tmx");
	renderer = new OrthogonalTiledMapRenderer(map, 2f);//1f / 32f);
	
	func = CC.Scheduler().renderAfterSchedulePerFrame((t)->{
		camera.position.set(500, 320, 0);
		camera.update();
		renderer.setView(
				camera.combined,
				0, 0, 1000, 500);
		renderer.render();
		return false;
	}, 0, false);
}
 
开发者ID:mingwuyun,项目名称:cocos2d-java,代码行数:24,代码来源:TiledMapTests.java

示例2: createCamera

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
/**
 * Creates a new Orthographic Camera for the Game.
 *
 * @return the created camera.
 */
private OrthographicCamera createCamera() {
    OrthographicCamera camera = new OrthographicCamera(VIEWPORT_WIDTH / PIXEL_TO_METER,
            VIEWPORT_HEIGHT / PIXEL_TO_METER);

    camera.position.set(model.getBallModel().getX() / PIXEL_TO_METER,
            model.getBallModel().getY() / PIXEL_TO_METER, 0);
    camera.update();

    if (DEBUG_PHYSICS) {
        debugRenderer = new Box2DDebugRenderer();
        debugCamera = camera.combined.cpy();
        debugCamera.scl(1 / PIXEL_TO_METER);
    }

    return camera;
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:22,代码来源:GameScreen.java

示例3: MenuScreen

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public MenuScreen() {
    camera = new OrthographicCamera();
    viewport = new FitViewport(Game.WIDTH, Game.HEIGHT, camera);
    viewport.apply();
    camera.position.set(Game.WIDTH / 2, Game.HEIGHT / 2, 0);
    camera.update();
    betaText = new BitmapFont(Gdx.files.internal("score.fnt"), Gdx.files.internal("score.png"), false);
    betaText.getData().setScale(0.35f);
    logo = new Sprite(new Texture("logo.png"));
    Random r = new Random();
    background = new Particle[r.nextInt(55 - 45) + 45];
    for (int i = 0; i < background.length; i++) {
        int size = r.nextInt(4) + 1;
        int x = r.nextInt(Game.WIDTH);
        int y = r.nextInt(Game.HEIGHT);
        background[i] = new Particle(x, y, 0, 0, -1, new Color(207 / 255f, 187 / 255f, 20 / 255f, 1f), size);
    }
    musicMuted = new Sprite(new Texture(Gdx.files.internal("buttons/music_muted.png")));
    musicUnmuted = new Sprite(new Texture(Gdx.files.internal("buttons/music_unmuted.png")));
    play = new CenteredButton(500, "buttons/play.png");
    music = new Button(Game.WIDTH - 130, 15, Game.musicMuted() ? musicMuted : musicUnmuted);
    music.setScale(4f);
}
 
开发者ID:MrGussio,项目名称:EarthInvadersGDX,代码行数:24,代码来源:MenuScreen.java

示例4: initUtils

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
private void initUtils() {
    //init camera & viewport
    camera = new OrthographicCamera();
    viewport = new StretchViewport(Polymorph.WORLD_WIDTH, Polymorph.WORLD_HEIGHT, camera);
    viewport.apply(true);
    camera.update();

    //init sprite batch
    batch = new SpriteBatch();
    batch.setProjectionMatrix(camera.combined);

    //init font
    FreeTypeFontGenerator fontGenerator = polymorph.getAssetManager().get(Polymorph.FONT_BOLD_PATH, FreeTypeFontGenerator.class);
    FreeTypeFontParameter fontSettings = new FreeTypeFontParameter();
    fontSettings.size = 80;
    fontSettings.minFilter = TextureFilter.Linear;
    fontSettings.magFilter = TextureFilter.Linear;
    font = fontGenerator.generateFont(fontSettings);
}
 
开发者ID:DurianHLN,项目名称:Polymorph,代码行数:20,代码来源:GameScreen.java

示例5: read

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
@Override
public OrthographicCamera read(Kryo kryo, Input input, Class<OrthographicCamera> type) {
    OrthographicCamera camera = new OrthographicCamera();
    Vector3 position = kryo.readObject(input, Vector3.class);
    Vector3 direction = kryo.readObject(input, Vector3.class);
    Vector3 up = kryo.readObject(input, Vector3.class);
    camera.position.set(position);
    camera.direction.set(direction);
    camera.up.set(up);
    camera.near = input.readFloat();
    camera.far = input.readFloat();
    camera.viewportWidth = input.readFloat();
    camera.viewportHeight = input.readFloat();
    camera.zoom = input.readFloat();
    camera.update();
    return camera;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:18,代码来源:OrthographicCameraSerializer.java

示例6: create

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
@Override
public void create() {
	if (androidInterface != null)
		androidInterface.tryToStopMusicApp();

	batch = new SpriteBatch();
	sr = new ShapeRenderer();

	camera = new OrthographicCamera();
	viewport = new FitViewport(Configuration.WINDOW_WIDTH, Configuration.WINDOW_HEIGHT, camera);
	camera.position.set(viewport.getWorldWidth() / 2 - (viewport.getWorldWidth() - 500) / 2, viewport.getWorldHeight() / 2 - (viewport.getWorldHeight() - 220) / 2, 0);
	camera.update();

	fade = new Sprite(new Texture("sprites/fade.png"));
	fade.setBounds(0, -100, viewport.getWorldWidth(), viewport.getWorldHeight() - 40);

	font = new BitmapFont(Gdx.files.internal("fonts/amiga4everpro2.fnt"));

	showModernTimesCutscene(); // start the game
}
 
开发者ID:cdetamble,项目名称:nomoore,代码行数:21,代码来源:MyGdxGame.java

示例7: init

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
private void init() {
    batch = new SpriteBatch();
    camera = new OrthographicCamera(Constants.VIEWPORT_WIDTH, Constants.VIEWPORT_HEIGHT);
    camera.position.set(0, 0, 0);
    camera.update();

    cameraGUI = new OrthographicCamera(Constants.VIEWPORT_GUI_WIDTH, Constants.VIEWPORT_GUI_HEIGHT);
    cameraGUI.position.set(0, 0, 0);
    cameraGUI.setToOrtho(true);
    cameraGUI.update();
}
 
开发者ID:davyjoneswang,项目名称:libgdx-learnlib,代码行数:12,代码来源:WorldRenderer.java

示例8: SplashScreen

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public SplashScreen() {
    camera = new OrthographicCamera();
    viewport = new FitViewport(Game.WIDTH, Game.HEIGHT, camera);
    viewport.apply();
    camera.position.set(Game.WIDTH / 2, Game.HEIGHT / 2, 0);
    camera.update();
    logo = new Sprite(new Texture(Gdx.files.internal("gussio.png")));
    initiateTime = System.currentTimeMillis();
}
 
开发者ID:MrGussio,项目名称:EarthInvadersGDX,代码行数:10,代码来源:SplashScreen.java

示例9: copy

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
@Override
public OrthographicCamera copy (Kryo kryo, OrthographicCamera original) {
    OrthographicCamera camera = new OrthographicCamera();
    camera.position.set(original.position);
    camera.direction.set(original.direction);
    camera.up.set(original.up);
    camera.near = original.near;
    camera.far = original.far;
    camera.viewportWidth = original.viewportWidth;
    camera.viewportHeight = original.viewportHeight;
    camera.zoom = original.zoom;
    camera.update();
    return camera;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:15,代码来源:OrthographicCameraSerializer.java

示例10: create

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的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

示例11: create

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
@Override
public void create()
{
	// DisplayMode[] dms = Gdx.graphics.getDisplayModes();
	// Texture.setEnforcePotImages(false);

	bivSettings = new BIVSettings();
	bivSettings.Load();
	float w = fScreenWidth = iScreenWidth = Gdx.graphics.getWidth();
	float h = fScreenHeight = iScreenHeight = Gdx.graphics.getHeight();

	camera = new OrthographicCamera(w, h);
	camera.setToOrtho(false, w, h);
	camera.update();

	batch = new SpriteBatch();

	nightModeManager = new NightModeManager();
	
	Gdx.input.setInputProcessor(myInputProcessor);

	ui = new UI();

	if (bivSettings.restartBorderlessToggle)
	{
		// The restartBorderlessToggle flag should no longer be used.
		bivSettings.restartBorderlessToggle = false;
		bivSettings.Save();
		ui.openWindow(MainOptionsWnd.class);
		ui.openWindow(WindowOptionsWnd.class);
	}

	texLightGray = Create1x1ColorTexture(new Color(0.667f, 0.667f, 0.667f, 0.667f));
	texDarkGreen = Create1x1ColorTexture(new Color(0f, 0.444f, 0f, 0.5f));
	texDarkGray = Create1x1ColorTexture(new Color(0.333f, 0.333f, 0.333f, 0.5f));
	texRed = Create1x1ColorTexture(new Color(1f, 0f, 0f, 0.667f));

	images = new Images();
	images.Initialize();
}
 
开发者ID:bp2008,项目名称:blueirisviewer,代码行数:41,代码来源:BlueIrisViewer.java

示例12: ScreenManager

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public ScreenManager() {
    float width = Gdx.graphics.getWidth();
    float height = Gdx.graphics.getHeight();
    oc = new OrthographicCamera(width * 2, width * 2 * (height / width));
    oc.position.set(oc.viewportWidth / 2f, oc.viewportHeight/2, 0);
    oc.update();
    sb = new SpriteBatch();
}
 
开发者ID:elitej13,项目名称:project-divine-intervention,代码行数:9,代码来源:ScreenManager.java

示例13: applyTo

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public void applyTo(OrthographicCamera camera) {
	camera.position.x = position.x;
	camera.position.y = position.y;
	camera.zoom = zoom;
	camera.update();
}
 
开发者ID:davyjoneswang,项目名称:libgdx-learnlib,代码行数:7,代码来源:CameraHelper.java

示例14: GameScreen

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public GameScreen() {
        entities.clear();
        camera = new OrthographicCamera();
        viewport = new FitViewport(Game.WIDTH, Game.HEIGHT, camera);
        viewport.apply();
        camera.position.set(Game.WIDTH / 2, Game.HEIGHT / 2, 0);
        camera.update();

        earthTexture = new Sprite(new Texture(Gdx.files.internal("world.png")));
        musicMuted = new Sprite(new Texture(Gdx.files.internal("buttons/music_muted.png")));
        musicUnmuted = new Sprite(new Texture(Gdx.files.internal("buttons/music_unmuted.png")));
        earth = new Circle((float) (Game.WIDTH / 2 - Game.HEIGHT * 0.2), (float) (Game.HEIGHT / 2 - Game.HEIGHT * 0.2), (float) (Game.HEIGHT * 0.2));
        this.player = new Player();
        entities.add(player);
//        entities.add(new Sentry());
        Texture full = new Texture(Gdx.files.internal("meteorite.png"));
        meteoriteSprites = new Sprite[4];
        for (int i = 0; i < meteoriteSprites.length; i++) {
            TextureRegion region = new TextureRegion(full, i * 20, 0, 20, 20);
            meteoriteSprites[i] = new Sprite(region);
        }
        Texture full2 = new Texture(Gdx.files.internal("warning.png"));
        warningSprites = new Sprite[2];
        warningSprites[0] = new Sprite(new TextureRegion(full2, 0, 0, 9, 9));
        warningSprites[1] = new Sprite(new TextureRegion(full2, 9, 0, 9, 9));

        shopWindow = new ShopWindow();

        scoreFont = new BitmapFont(Gdx.files.internal("score.fnt"), Gdx.files.internal("score.png"), false);
        scoreFont.getData().setScale(0.8f);

        leftButton = new Button(10, 10, 180, "buttons/control_button.png");
        rightButton = new Button(210, 10, "buttons/control_button.png");
        shopButton = new Button(Game.WIDTH - shopWindow.getShopWidth() - 190, 10, "buttons/shop_button.png");

        leftButton.setScale(1.5f);
        rightButton.setScale(1.5f);
        shopButton.setScale(1.5f);

        exit = new Button(1230, 450, "buttons/exit.png");
        pauseExit = new Button(1230, 450, "buttons/exit.png");
        retry = new Button(500, 450, "buttons/retry.png");
        resume = new Button(500, 450, "buttons/resume.png");
        music = new Button(Game.WIDTH - 130, 15, Game.musicMuted() ? musicMuted : musicUnmuted);
        music.setScale(4f);

        soundtrack = Gdx.audio.newMusic(Gdx.files.internal("sound/soundtrack.wav"));
        meteorDestroySound = Gdx.audio.newSound(Gdx.files.internal("sound/explosion.wav"));
        soundtrack.setLooping(true);
        if (!Game.musicMuted())
            soundtrack.play();
        //generating randomized background
        Random r = new Random();
        background = new Particle[r.nextInt(55 - 45) + 45];
        for (int i = 0; i < background.length; i++) {
            int size = r.nextInt(4) + 1;
            int x = r.nextInt(Game.WIDTH);
            int y = r.nextInt(Game.HEIGHT);
            background[i] = new Particle(x, y, 0, 0, -1, new Color(207 / 255f, 187 / 255f, 20 / 255f, 1f), size);
        }
    }
 
开发者ID:MrGussio,项目名称:EarthInvadersGDX,代码行数:62,代码来源:GameScreen.java

示例15: show

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
@Override
public void show() {
    // ui
    hud = new HudScene(spriteBatch, shapeRenderer, arcRenderer);

    //input
    InputMultiplexer multiplexer = new InputMultiplexer();
    multiplexer.addProcessor(hud.getStage());
    multiplexer.addProcessor(new GestureDetector(new GameGestureProcessor(this)));
    multiplexer.addProcessor(new GameInputProcessor(this));
    Gdx.input.setInputProcessor(multiplexer);

    // map
    map = new TmxMapLoader().load("maps/" + level.getFile());

    mapHeight = map.getProperties().get("height", 40, int.class);
    mapWidth = map.getProperties().get("width", 15, int.class);

    tilewidth = map.getProperties().get("tilewidth", 128, int.class);

    // renderer
    float unitScale = 1 / (float) tilewidth;
    tiledMapRenderer = new OrthogonalTiledMapRenderer(map, unitScale);

    // camera
    camera = new OrthographicCamera();
    camera.setToOrtho(false, mapWidth, mapHeight);
    camera.update();

    // ecs
    engine = new PooledEngine();
    engine.addSystem(new WaveSystem(level));
    engine.addSystem(new SpawnSystem(engine, mapHeight, 5.5f));
    engine.addSystem(turretSystem = new TurretSystem());
    engine.addSystem(pathFindingSystem = new PathFindingSystem(mapHeight, mapWidth, map));
    engine.addSystem(new MoveToSystem());
    engine.addSystem(new MovementSystem());
    engine.addSystem(new RenderSystem(camera, tilewidth));

    loadSprites();
    setupEntities();

    pathFindingSystem.init(new Vector2(39.5f, mapHeight - 10 + 0.5f));
}
 
开发者ID:MiniDigger,项目名称:projecttd,代码行数:45,代码来源:GameScreen.java


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