Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.whynot.stClient.view; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.maps.tiled.TiledMap; import com.badlogic.gdx.maps.tiled.TmxMapLoader; import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; /** * * @author potapov */ public class MainScreen implements com.badlogic.gdx.Screen { TiledMap map; OrthogonalTiledMapRenderer renderer; OrthographicCamera camera; @Override public void render(float f) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); renderer.setView(camera); renderer.render(); } @Override public void resize(int i, int i1) { camera.viewportWidth = i; camera.viewportHeight = i1; camera.update(); } @Override public void show() { TmxMapLoader loader = new TmxMapLoader(); map = loader.load("maps/map_classic.tmx"); renderer = new OrthogonalTiledMapRenderer(map); camera = new OrthographicCamera(); } @Override public void hide() { } @Override public void pause() { } @Override public void resume() { } @Override public void dispose() { } }