gives me error
Exception in thread "LWJGL Application" java.nio.BufferOverflowException
at java.nio.DirectFloatBufferU.put(Unknown Source)
at com.badlogic.gdx.graphics.g2d.SpriteCache.add(SpriteCache.java:259)
at com.badlogic.gdx.maps.tiled.renderers.OrthoCachedTiledMapRenderer.renderTileLayer(OrthoCachedTiledMapRenderer.java:347)
at com.badlogic.gdx.maps.tiled.renderers.OrthoCachedTiledMapRenderer.render(OrthoCachedTiledMapRenderer.java:132)
at com.idt.game.essentials.GameWorld.render(GameWorld.java:57)
at com.idt.game.essentials.Universe.render(Universe.java:22)
at com.idt.gamestates.PlayState.render(PlayState.java:45)
at com.badlogic.gdx.Game.render(Game.java:46)
at com.idt.game.Main.render(Main.java:20)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:223)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:124)
GameWorld
package com.idt.game.essentials;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
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.OrthoCachedTiledMapRenderer;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Box2D;
import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer;
import com.badlogic.gdx.physics.box2d.World;
public class GameWorld {
//TileMap
private TiledMap map;
private OrthoCachedTiledMapRenderer renderer;
private World world;
private Player player;
private Box2DDebugRenderer debugRenderer;
private SpriteBatch batch;
public GameWorld() {
}
public void init() {
map = new TmxMapLoader().load("GameMap.tmx");
renderer = new OrthoCachedTiledMapRenderer(map);
batch = new SpriteBatch();
Box2D.init();
debugRenderer = new Box2DDebugRenderer();
world = new World(new Vector2(0, -10), false);
player = new Player(this);
player.init();
}
public void tick(){
world.step(1/60f, 6, 2);
player.tick();
}
public void render(float delta){
Gdx.gl.glClearColor(0, 0.3f, 0.4f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
renderer.setView(player.getCamera());
renderer.render();
player.render(delta);
batch.begin();
debugRenderer.render(world, player.getCamera().combined);
batch.end();
}
public void dispose() {
}
}