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.jmd.asteroidshooter.screens; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.ScreenAdapter; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.jmd.asteroidshooter.AsteroidShooterGame; /** * * @author jared */ public class MainMenuScreen extends ScreenAdapter { private final OrthographicCamera camera; private final SpriteBatch batch; private final BitmapFont font; private final AsteroidShooterGame game; public MainMenuScreen(AsteroidShooterGame _game) { this.game = _game; camera = new OrthographicCamera(); camera.setToOrtho(false, AsteroidShooter.V_WIDTH, AsteroidShooter.V_HEIGHT); batch = game.getSpriteBatch(); font = new BitmapFont(); } @Override public void render(float deltaTime) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); batch.setProjectionMatrix(camera.combined); batch.begin(); font.draw(batch, "Welcome to RGBAsteroids!", 100, 150); batch.end(); if (Gdx.input.isTouched()) { game.setScreen(new AsteroidShooter()); } } }