Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package user;
- import java.util.ArrayList;
- import java.util.logging.Logger;
- import main.Grid;
- import main.Level;
- import main.Map;
- import main.PrimsAlg;
- import main.RecursiveBacktracking;
- import main.RecursiveDivision;
- import org.newdawn.slick.*;
- import org.newdawn.slick.state.*;
- public class Main extends StateBasedGame {
- private static Main instance = null;
- public static AppGameContainer app;
- private static final String name = "GAME";
- public static final int map = 10;
- public static final int recBack = 0;
- public static final int recDiv = 1;
- public static final int Prim = 2;
- private int currentState;
- private ArrayList<Grid> grid = new ArrayList<>();
- public Main(String name) {
- super(name);
- }
- public String getName() {
- return name;
- }
- public static void main(String[] args) {
- try {
- app = new AppGameContainer(getInstance());
- app.setDisplayMode(800, 800, false);
- app.setTargetFrameRate(60);
- app.start();
- } catch (SlickException ex) {
- Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- }
- @Override
- public void initStatesList(GameContainer gc) throws SlickException {
- this.addState(new Level(recBack, new RecursiveBacktracking()));
- this.addState(new Level(recDiv, new RecursiveDivision()));
- this.addState(new Level(Prim, new PrimsAlg()));
- this.addState(new Map(map));
- this.enterState(recBack);
- // this.getState(recBack).init(gc, this);
- // this.getState(recDiv).init(gc, this);
- // this.getState(Prim).init(gc, this);
- // this.getState(map).init(gc, this);
- //
- // this.enterState(recBack);
- }
- public Grid getGrid() {
- if(grid.size() <= currentState){
- grid.add(currentState, new Grid(currentState + 2, 3));
- }
- return grid.get(currentState);
- }
- public void setCurrentState(int id){
- currentState = id;
- }
- public int getmyOwnCurrentState(){
- return currentState;
- }
- public static Main getInstance() {
- if (instance == null) {
- instance = new Main(name);
- }
- return instance;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement