Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.pv.game;
- import com.badlogic.gdx.Game;
- import com.badlogic.gdx.Gdx;
- import com.badlogic.gdx.Screen;
- import com.badlogic.gdx.graphics.FPSLogger;
- import com.badlogic.gdx.graphics.GL20;
- import com.badlogic.gdx.graphics.OrthographicCamera;
- import com.badlogic.gdx.graphics.g2d.BitmapFont;
- import com.badlogic.gdx.graphics.g2d.SpriteBatch;
- import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
- import com.badlogic.gdx.maps.tiled.TiledMap;
- import com.badlogic.gdx.maps.tiled.TmxMapLoader;
- import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
- public class GameScreen implements Screen {
- Game game;
- OrthographicCamera camera;
- SpriteBatch batch;
- ShapeRenderer shapeRenderer;
- BitmapFont currentFont;
- FPSLogger fps;
- TiledMap map;
- OrthogonalTiledMapRenderer renderer;
- public GameScreen(Game game) {
- this.game = game;
- camera = new OrthographicCamera(Gdx.graphics.getWidth(),
- Gdx.graphics.getHeight());
- camera.setToOrtho(false, Gdx.graphics.getWidth(),
- Gdx.graphics.getHeight());
- batch = new SpriteBatch();
- shapeRenderer = new ShapeRenderer();
- map = new TmxMapLoader().load("world/1.tmx");
- renderer = new OrthogonalTiledMapRenderer(map, 1 / 16f);
- //Objects
- fps = new FPSLogger();
- }
- public void update(float delta) {
- }
- public void draw(float delta) {
- Gdx.gl.glClearColor(255f, 255f, 255f, 1);
- Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
- batch.begin();
- currentFont.draw(batch, "FPS : +" + Gdx.graphics.getFramesPerSecond(),
- 800, 50);
- batch.end();
- }
- public void render(float delta) {
- update(delta);
- draw(delta);
- renderer.setView(camera);
- renderer.render();
- }
- //BREAK
- public void resize(int width, int height) {
- }
- public void show() {
- }
- public void hide() {
- }
- public void pause() {
- }
- public void resume() {
- }
- public void dispose() {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement