Java tutorial
/* * Copyright: * This file was created by BinaryTENSHi and distributed * as part of NoPassing. * * NoPassing lies under a license which can be * found in the LICENSE file in the root directory * File created @ [26.12.2013, 19:04:40 CH timezone] */ package com.binarytenshi.nopassing.state; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.InputProcessor; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Rectangle; import com.binarytenshi.nopassing.NoPassing; import com.binarytenshi.nopassing.core.CameraHandler; import com.binarytenshi.nopassing.core.InputHandler; import com.binarytenshi.nopassing.core.MapHandler; import com.binarytenshi.nopassing.core.SplineHandler; public class MainGameScreen implements Screen { private InputProcessor inputHandler; public MainGameScreen() { inputHandler = new InputHandler(); } @Override public void render(float delta) { Camera camera = CameraHandler.getCamera(); SpriteBatch batch = NoPassing.getSpriteBatch(); Rectangle viewport = CameraHandler.getViewport(); camera.update(); camera.apply(Gdx.gl10); Gdx.gl.glClearColor(0, 0, 0, 0); Gdx.gl.glViewport((int) viewport.x, (int) viewport.y, (int) viewport.width, (int) viewport.height); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); batch.setProjectionMatrix(camera.combined); batch.begin(); MapHandler.draw(batch); batch.end(); SplineHandler.drawSplines(); } @Override public void resize(int width, int height) { } @Override public void show() { Gdx.input.setInputProcessor(inputHandler); } @Override public void hide() { } @Override public void pause() { } @Override public void resume() { } @Override public void dispose() { } }