public static void dispose() { modelBatch.dispose(); spriteBatch.dispose(); frameBuffer.dispose(); tempBuffer.dispose(); shaderProvider.dispose(); for (ShaderProgram s : Bdx.matShaders.values()) { s.dispose(); } }
public void draw( TextureRegion tr, float width, float height, float origX, float origY, float x, float y, float rot, Color tint) { setTint(tint); if (tr instanceof TextureAtlas.AtlasRegion) { myTextureChecker.onReg((TextureAtlas.AtlasRegion) tr); } else { throw new AssertionError("Unexpected texture class"); } mySpriteBatch.draw(tr, x - origX, y - origY, origX, origY, width, height, 1, 1, rot); }
public static void resize(int width, int height) { spriteBatch.getProjectionMatrix().setToOrtho2D(0, 0, width, height); if (frameBuffer != null) frameBuffer.dispose(); if (tempBuffer != null) tempBuffer.dispose(); frameBuffer = new RenderBuffer( spriteBatch); // Have to recreate all render buffers and adjust the projection matrix as // the window size has changed tempBuffer = new RenderBuffer(spriteBatch); for (Scene scene : scenes) { if (scene.lastFrameBuffer != null) scene.lastFrameBuffer.dispose(); scene.lastFrameBuffer = new RenderBuffer(null); } }
public static void init() { time = 0; profiler = new Profiler(); display = new Display(); scenes = new ArrayListScenes(); sounds = new Sounds(); music = new Music(); mouse = new Mouse(); gamepads = new ArrayListNamed<Gamepad>(); for (int i = 0; i < Controllers.getControllers().size; i++) { gamepads.add(new Gamepad(i)); } imaps = new InputMaps(); keyboard = new Keyboard(); fingers = new ArrayList<Finger>(); components = new ArrayList<Component>(); matShaders = new HashMap<String, ShaderProgram>(); allocatedFingers = new ArrayList<Finger>(); for (int i = 0; i < 10; ++i) { allocatedFingers.add(new Finger(i)); } Gdx.input.setInputProcessor(new GdxProcessor(keyboard, mouse, allocatedFingers, gamepads)); com.badlogic.gdx.graphics.glutils.ShaderProgram.pedantic = false; shaderProvider = new BDXShaderProvider(); modelBatch = new ModelBatch(shaderProvider); spriteBatch = new SpriteBatch(); spriteBatch.setBlendFunction(Gdx.gl.GL_SRC_ALPHA, Gdx.gl.GL_ONE_MINUS_SRC_ALPHA); frameBuffer = new RenderBuffer(spriteBatch); tempBuffer = new RenderBuffer(spriteBatch); advancedLightingOn = true; }
private void setTint(Color tint) { mySpriteBatch.setColor(tint); }
public void end() { myTextureChecker.onEnd(); mySpriteBatch.end(); }
public void begin() { mySpriteBatch.begin(); }
public void setMtx(Matrix4 mtx) { mySpriteBatch.setProjectionMatrix(mtx); }
public void setAdditive(boolean additive) { int dstFunc = additive ? GL20.GL_ONE : GL20.GL_ONE_MINUS_SRC_ALPHA; mySpriteBatch.setBlendFunction(GL20.GL_SRC_ALPHA, dstFunc); }
public void dispose() { mySpriteBatch.dispose(); myFont.dispose(); }