Skip to content

Commit

Permalink
Distributed files into packages.
Browse files Browse the repository at this point in the history
Fixed David's author tag.
  • Loading branch information
obi1kenobi committed Sep 21, 2012
1 parent 4db7e3d commit 07a9494
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Mazebuilder/src/com/mazebuilder/root/GameplayState.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.mazebuilder.root;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

/**
* This is the main gameplay loop - gameboard, player movement, etc, should all be in here.
*
* @author dxiao
*/
public class GameplayState extends BasicGameState {

static public final int ID = 1;

/** Write initialization for the board here */
@Override
public void init(GameContainer container, StateBasedGame game)
throws SlickException {

}

/** Each rendering step, draw the game here */
@Override
public void render(GameContainer container, StateBasedGame game, Graphics g)
throws SlickException {
g.drawString("Hello, Mazebuilder! [Gameplay]", 50, 100);
}

/** Each logic step, poll inputs and compute game logic here */
@Override
public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException {

}

@Override
public int getID() {
return ID;
}

}
47 changes: 47 additions & 0 deletions Mazebuilder/src/com/mazebuilder/root/MainMenuState.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.mazebuilder.root;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

/**
* The main menu loop.
*
* @author dxiao
*/
public class MainMenuState extends BasicGameState {

static public final int ID = 0;

private StateBasedGame game;

@Override
public void init(GameContainer container, StateBasedGame game)
throws SlickException {
this.game = game;
}

@Override
public void render(GameContainer container, StateBasedGame game, Graphics g)
throws SlickException {
g.drawString("Hello, Mazebuilder! [MainMenu]", 50, 100);
}

@Override
public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException {
}

@Override
public void mouseClicked(int button, int x, int y, int clickCount) {
game.enterState(GameplayState.ID);
}

@Override
public int getID() {
// TODO Auto-generated method stub
return 0;
}

}
31 changes: 31 additions & 0 deletions Mazebuilder/src/com/mazebuilder/root/MazebuilderGame.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.mazebuilder.root;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

/**
*
* @author dxiao
*/
public class MazebuilderGame extends StateBasedGame {

public MazebuilderGame() {
super("Mazebuilder v0.0");
}

@Override
public void initStatesList(GameContainer gc) throws SlickException {
addState(new MainMenuState());
addState(new GameplayState());
}

public static void main (String args[]) throws SlickException {
AppGameContainer app = new AppGameContainer(new MazebuilderGame());

app.setDisplayMode(800, 600, false);
//app.setSmoothDeltas(true);

app.start();
}
}
39 changes: 39 additions & 0 deletions Mazebuilder/test/com/mazebuilder/toys/TestSlick.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.mazebuilder.toys;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.AppGameContainer;

/**
*
* @author dxiao
*/
public class TestSlick extends BasicGame {

public TestSlick () {
super("SimpleTest");
}

@Override
public void init(GameContainer container) throws SlickException {}

@Override
public void update(GameContainer container, int delta)
throws SlickException {}

@Override
public void render(GameContainer container, Graphics g)
throws SlickException {
g.drawString("Hello, Slick world!", 0, 100);
}

public static void main(String[] args) {
try {
AppGameContainer app = new AppGameContainer(new TestSlick ());
app.start();
} catch (SlickException e) {
e.printStackTrace();
}
}
}

0 comments on commit 07a9494

Please sign in to comment.