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


Java OrthographicCamera.setToOrtho方法代码示例

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


在下文中一共展示了OrthographicCamera.setToOrtho方法的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: create

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
@Override
public void create () {
    camera = new OrthographicCamera();
    camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    stage = new Stage();
    stage.addListener(new InputListener(){
        @Override
        public boolean touchDown (InputEvent event, float x, float y, int pointer, int button){

            stage.getActors().get(counter).addAction(Actions.moveTo(x-50,y-50,1));
            counter++;
            if(counter==stage.getActors().size) {
                counter=0;
            }
            return true;
        }
    });
    Gdx.input.setInputProcessor(stage);
}
 
开发者ID:cpppwner,项目名称:NoRiskNoFun,代码行数:20,代码来源:NoRiskNoFunDrawFigures.java

示例3: GameCenter

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public GameCenter(Chat game){
  this.game = game;

  /*Camera Settings*/
  camera = new OrthographicCamera();
  camera.setToOrtho(false,480,800);
  camera.position.set(480/2,800/2,0);

  /*Button Areas*/
  wordTiles = new Rectangle(480/2-250/2,800/2,250,55);
  Arkanoid = new Rectangle(480/2-250/2,800/2-60,250,55);
  WordCrush = new Rectangle(480/2-250/2,800/2-120,250,55);
  EndlessRoad = new Rectangle(480/2-250/2,800/2-180,250,55);
  bottone4 = new Rectangle(480/2-250/2,800/2-240,250,55);
  buttonTexture = new Texture("green_button00.png");
  touch = new Vector3();
}
 
开发者ID:curiosone-bot,项目名称:curiosone-app,代码行数:18,代码来源:GameCenter.java

示例4: DeathScreen

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public DeathScreen(Polymorph polymorph,int playerscore) {
    AssetManager assetManager = polymorph.getAssetManager();
    TextureAtlas textureAtlas = assetManager.get(Polymorph.MASTER_PATH, TextureAtlas.class);
    this.polymorph = polymorph;
    score=playerscore;

    DeathScreenMusic = assetManager.get(Polymorph.MAIN_MENU_MUSIC_PATH);
    DeathScreenMusic.setLooping(true);

    background = textureAtlas.findRegion("mainmenu"); //TODO make a unique background for the death screen
    screenSize = new Dimension(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    camera = new OrthographicCamera();
    camera.setToOrtho(false, screenSize.width, screenSize.height); //change this
    batch=new SpriteBatch();
    batch.setProjectionMatrix(camera.combined);

    stage = new Stage();
    stage.clear();
    font = new BitmapFont(false);

    textureAtlas = assetManager.get(Polymorph.MASTER_PATH, TextureAtlas.class);
    initButtons(score,textureAtlas);
    Gdx.input.setInputProcessor(stage);

}
 
开发者ID:DurianHLN,项目名称:Polymorph,代码行数:27,代码来源:DeathScreen.java

示例5: GameRenderer

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public GameRenderer(GameWorld world, int gameHeight, int midPointY) {
    myWorld = world;

    this.gameHeight = gameHeight;
    this.midPointY = midPointY;

    cam = new OrthographicCamera();
    cam.setToOrtho(true, 136, gameHeight);

    batcher = new SpriteBatch();
    batcher.setProjectionMatrix(cam.combined);
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setProjectionMatrix(cam.combined);

    // Call helper methods to initialize instance variables.
    initGameObjects();
    initAssets();
}
 
开发者ID:610ksh,项目名称:MyRoom,代码行数:19,代码来源:GameRenderer.java

示例6: resize

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
@Override
public void resize(int width, int height) {

    // Update cameras

    OrthographicCamera worldCam = GameManager.getWorldCamera();
    worldCam.setToOrtho(false);
    worldCam.viewportWidth = Gdx.graphics.getWidth();
    worldCam.viewportHeight = Gdx.graphics.getHeight();

    OrthographicCamera guiCam = GameManager.getGuiCamera();
    guiCam.setToOrtho(false);
    guiCam.viewportWidth = Gdx.graphics.getWidth();
    guiCam.viewportHeight = Gdx.graphics.getHeight();

}
 
开发者ID:Benjozork,项目名称:Onyx,代码行数:17,代码来源:OnyxGame.java

示例7: ThirdScreen

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public ThirdScreen (Game agame) {
    game = agame;
    batch = new SpriteBatch();
    img = new Texture("aklu.jpg");
    shapeRenderer = new ShapeRenderer();
    centerCircle = new Circle();
    leftCircle = new Circle();
    rightCircle = new Circle();
    myTouch = new Circle();
    camera = new OrthographicCamera();
    camera.setToOrtho(false, 800, 400);
    colorChanger = 0;
    counter = 0;
}
 
开发者ID:alaskalinuxuser,项目名称:apps_small,代码行数:15,代码来源:ThirdScreen.java

示例8: secondScreen

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public secondScreen (Game agame) {
    game = agame;
    batch = new SpriteBatch();
    img = new Texture("aklu.jpg");
    shapeRenderer = new ShapeRenderer();
    centerCircle = new Circle();
    leftCircle = new Circle();
    rightCircle = new Circle();
    myTouch = new Circle();
    camera = new OrthographicCamera();
    camera.setToOrtho(false, 800, 400);
    colorChanger = 0;
    counter = 0;

}
 
开发者ID:alaskalinuxuser,项目名称:apps_small,代码行数:16,代码来源:secondScreen.java

示例9: create

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
@Override
public void create () {
	batch = new SpriteBatch();
	img = new Texture("aklu.jpg");
       shapeRenderer = new ShapeRenderer();
       centerCircle = new Circle();
       leftCircle = new Circle();
       rightCircle = new Circle();
       myTouch = new Circle();
       camera = new OrthographicCamera();
       camera.setToOrtho(false, 800, 400);
       colorChanger = 0;
}
 
开发者ID:alaskalinuxuser,项目名称:apps_small,代码行数:14,代码来源:MyGdxGame.java

示例10: 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

示例11: GameScreen

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public GameScreen() {
	game.setGameScreen(this);
	
	createWorld();
	
	camera = new OrthographicCamera();
	camera.setToOrtho(false, GameCore.SCREEN_WIDTH, GameCore.SCREEN_HEIGHT);
	uiCamera = new OrthographicCamera();
	uiCamera.setToOrtho(false, GameCore.SCREEN_WIDTH, GameCore.SCREEN_HEIGHT);
}
 
开发者ID:chrisj42,项目名称:miniventure,代码行数:11,代码来源:GameScreen.java

示例12: init

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
private void init() {

		//初始化世界 初始化重力
		mWorld = new World(new Vector2(0, -9.8f), true);

		//初始化刚体世界相机
		mBox2DCamera = new OrthographicCamera();
		mBox2DCamera.setToOrtho(false, MyGdxGame.VIEW_WIDTH / Constant.RATE, MyGdxGame.VIEW_HEIGHT / Constant.RATE);

		//初始化Box2D渲染器
		mBox2DRender = new Box2DDebugRenderer();

		//初始化蟠桃与蓝瓶
		mTaos = new Array<Tao>();
		mBlues = new Array<Blue>();

		//创建地图
		createMap();

		//创建天兵
		createEnemy();

		//创建Boss
		createBoss(level);

		//创建主角
		createActor();

		//初始化所有控件
		initWidget();

		//初始化孙悟空所有按钮的监听事件
		initListener();

		//注册碰撞监听事件
		mContactListener = new Box2DContactListener();
		mWorld.setContactListener(mContactListener);
	}
 
开发者ID:heyzqt,项目名称:libGdx-xiyou,代码行数:39,代码来源:Play.java

示例13: 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

示例14: MainMenuScreen

import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public MainMenuScreen() {
	camera = new OrthographicCamera();
	camera.setToOrtho(false, GameCore.SCREEN_WIDTH, GameCore.SCREEN_HEIGHT);
}
 
开发者ID:chrisj42,项目名称:miniventure,代码行数:5,代码来源:MainMenuScreen.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.setToOrtho方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。