Package ru.vagrant_ai.questionmarkgame.main

Source Code of ru.vagrant_ai.questionmarkgame.main.Game

package ru.vagrant_ai.questionmarkgame.main;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.ScalableGame;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

public class Game extends StateBasedGame {
 
  int stateID = -1;
 
  public static float ver = 0.5f;
  public static String ver_str = "Graphics";
  public final static boolean util_instantswitch = true; //true to turn instaskip to game
 
  public static boolean fullscreen = false;
  public static AppGameContainer app = null;
  public static ScalableGame game = null;
    public static final int MAINMENUSTATE  = 0;
    public static final int GAMEPLAYSTATE  = 1;
    public static final int GAMEOVERSTATE  = 2;
    public static final int GAMEWINSTATE  = 3;
    public static final int LOADINGSTATE  = 4;
  static int app_x = 800;
  static int app_y = 600;
  public static int fps = 60;
 
  public static long loading_time;
 
  public Game()
  {
    super("???");
      this.addState(new LoadingState(LOADINGSTATE));
  }

  public static void main(String[] args) throws SlickException
  {
    game = new ScalableGame(new Game(),app_x,app_y,false);
    app = new AppGameContainer(game);
    loading_time = app.getTime();
    app.setIcon("res/icon.png");
    app.setDisplayMode(app_x, app_y, false);
    app.setTargetFrameRate(fps);
    app.setShowFPS(false);
    app.setVSync(true);
    app.start();
  }

  @Override
  public void initStatesList(GameContainer gc)
  {
    try
    {
      this.getState(LOADINGSTATE).init(gc, this);
    } catch (SlickException e) {}
  }

  public static int getAppX()
  {
    return app_x;
  }
 
  public static int getAppY()
  {
    return app_y;
  }
 
  public static void setFPS(int new_fps)
  {
    app.setTargetFrameRate(new_fps);
  }

}
TOP

Related Classes of ru.vagrant_ai.questionmarkgame.main.Game

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.