tk.ebenezeredelman.nighthawk.core.NighthawkGame.java Source code

Java tutorial

Introduction

Here is the source code for tk.ebenezeredelman.nighthawk.core.NighthawkGame.java

Source

/**
 * @file
 * @brief Contains the main game class.
 *
 * @section LICENSE
 *
 * Copyright  2013 Nighthawk Authors (see the AUTHORS file).
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software
 * except in compliance with the License. You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package tk.ebenezeredelman.nighthawk.core;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

/**
 * @brief The main game class.
 */
public final class NighthawkGame extends Game {
    SpriteBatch m_spriteBatch;
    Texture m_badlogicTexture;

    @Override
    public void create() {
        m_spriteBatch = new SpriteBatch();
        m_badlogicTexture = new Texture("badlogic.jpg");

        //      try {
        //         new FreeTypeFontGenerator(Gdx.files.internal("test.fnt"));
        //      } catch(Exception e) {
        //         e.printStackTrace();
        //      }
        //
        //      Bullet.init();
    }

    @Override
    public void render() {
        Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

        m_spriteBatch.begin();
        m_spriteBatch.draw(m_badlogicTexture, 0, 0);
        m_spriteBatch.end();
    }
}