本文整理汇总了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);
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
示例14: MainMenuScreen
import com.badlogic.gdx.graphics.OrthographicCamera; //导入方法依赖的package包/类
public MainMenuScreen() {
camera = new OrthographicCamera();
camera.setToOrtho(false, GameCore.SCREEN_WIDTH, GameCore.SCREEN_HEIGHT);
}
示例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));
}