Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AssetsLoader {
- SpriteBatch batch;
- OrthographicCamera cam;
- Sprite sprite;
- //MAAILMAN LEVEYS 9 YKSIKKÖÄ
- final static float WORLD_WIDTH = 9;
- //MAAILMA KORKEUS 16 YKSIKKÖÄ
- final static float WORLD_HEIGHT = 16;
- Viewport viewport;
- TiledMap map;
- OrthogonalTiledMapRenderer mapRenderer;
- public AssetsLoader() {
- cam = new OrthographicCamera(WORLD_WIDTH, WORLD_HEIGHT);
- float aspectRatio = (float) Gdx.graphics.getWidth() / (float) Gdx.graphics.getHeight();
- sprite = new Sprite(new Texture("kuva.jpg"));
- sprite.setSize(9, 16);
- sprite.setPosition(0, 0);
- batch = new SpriteBatch();
- map = new TmxMapLoader().load("mappi.tmx");
- cam.setToOrtho(false, 9,16);
- mapRenderer = new OrthogonalTiledMapRenderer(map, 1f / 32);
- cam = new OrthographicCamera();
- viewport = new FitViewport(9, 16, cam);
- cam.position.set(WORLD_WIDTH / 2, WORLD_HEIGHT / 2, 0);
- viewport.apply();
- mapRenderer.setView(cam);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement