Android Open Source - Sneik Game Screen






From Project

Back to project page Sneik.

License

The source code is released under:

Apache License

If you think the Android project Sneik listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.plastboks.screens;
//ww  w  .  ja  v a 2  s  .  co m
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import net.plastboks.gameworld.GameRenderer;
import net.plastboks.gameworld.GameWorld;
import net.plastboks.sneikhelpers.InputHandler;

/**
 * Created by alex on 12/12/14.
 */
public class GameScreen implements Screen {

    private GameWorld world;
    private GameRenderer renderer;
    private float runTime = 0;

    public static final int GAME_WIDTH = 136;
    public static final int GAME_HEIGHT = 204;

    public GameScreen() {

        int midPointY = (int) (getHeight() / 2);

        world = new GameWorld(midPointY);
        renderer = new GameRenderer(world);
        Gdx.input.setInputProcessor(new InputHandler(world, renderer));
    }

    @Override
    public void render(float delta) {
        runTime += delta;
        world.update(delta);
        renderer.render(runTime);
    }

    @Override
    public void resize(int width, int height) { }
    @Override
    public void show() { }
    @Override
    public void hide() { }
    @Override
    public void pause() { }
    @Override
    public void resume() { }
    @Override
    public void dispose() { }

    public static int getHeight() {
        float screenWidth = Gdx.graphics.getWidth();
        float screenHeight = Gdx.graphics.getHeight();
        float gameHeight = screenHeight / (screenWidth / GAME_WIDTH);
        return (int) gameHeight;
    }
}




Java Source Code List

net.plastboks.gameobjects.Artificial.java
net.plastboks.gameobjects.Autonomous.java
net.plastboks.gameobjects.Bird.java
net.plastboks.gameobjects.Creature.java
net.plastboks.gameobjects.Mouse.java
net.plastboks.gameobjects.Node.java
net.plastboks.gameobjects.Snake.java
net.plastboks.gameworld.GamePlay.java
net.plastboks.gameworld.GameRenderer.java
net.plastboks.gameworld.GameWorld.java
net.plastboks.screens.GameScreen.java
net.plastboks.shared.Directions.java
net.plastboks.sneik.IOSLauncher.java
net.plastboks.sneik.SneikGame.java
net.plastboks.sneik.android.AndroidLauncher.java
net.plastboks.sneik.client.HtmlLauncher.java
net.plastboks.sneik.desktop.DesktopLauncher.java
net.plastboks.sneikhelpers.AssetLoader.java
net.plastboks.sneikhelpers.InputHandler.java