org.newdawn.slick.tests
Class TestBox

java.lang.Object
  extended by org.newdawn.slick.BasicGame
      extended by org.newdawn.slick.tests.TestBox
All Implemented Interfaces:
ControlledInputReciever, ControllerListener, Game, InputListener, KeyListener, MouseListener

public class TestBox
extends BasicGame

A test box containing a bunch of tests that can be used for quickly sanity checking tests.

Author:
kevin

Field Summary
 
Fields inherited from class org.newdawn.slick.BasicGame
controllerButton, controllerDown, controllerLeft, controllerRight, controllerUp
 
Constructor Summary
TestBox()
          Create a new box containing all the tests
 
Method Summary
 void addGame(java.lang.Class game)
          Add a game to the box
 void controllerButtonPressed(int controller, int button)
          Notification that a button control has been pressed on the controller.
 void controllerButtonReleased(int controller, int button)
          Notification that a button control has been released on the controller.
 void controllerDownPressed(int controller)
          Notification that the down control has been pressed on the controller.
 void controllerDownReleased(int controller)
          Notification that the down control has been released on the controller.
 void controllerLeftPressed(int controller)
          Notification that the left control has been pressed on the controller.
 void controllerLeftReleased(int controller)
          Notification that the left control has been released on the controller.
 void controllerRightPressed(int controller)
          Notification that the right control has been pressed on the controller.
 void controllerRightReleased(int controller)
          Notification that the right control has been released on the controller.
 void controllerUpPressed(int controller)
          Notification that the up control has been pressed on the controller.
 void controllerUpReleased(int controller)
          Notification that the up control has been released on the controller.
 void init(GameContainer c)
          Initialise the game.
 void keyPressed(int key, char c)
          Notification that a key was pressed
 void keyReleased(int key, char c)
          Notification that a key was released
static void main(java.lang.String[] argv)
          Entry point to our test
 void mouseMoved(int oldx, int oldy, int newx, int newy)
          Notification that mouse cursor was moved
 void mousePressed(int button, int x, int y)
          Notification that a mouse button was pressed
 void mouseReleased(int button, int x, int y)
          Notification that a mouse button was released
 void mouseWheelMoved(int change)
          Notification that the mouse wheel position was updated
 void render(GameContainer container, Graphics g)
          Render the game's screen here.
 void update(GameContainer container, int delta)
          Update the game logic here.
 
Methods inherited from class org.newdawn.slick.BasicGame
closeRequested, getTitle, inputEnded, inputStarted, isAcceptingInput, mouseClicked, mouseDragged, setInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestBox

public TestBox()
Create a new box containing all the tests

Method Detail

addGame

public void addGame(java.lang.Class game)
Add a game to the box

Parameters:
game - The game to add to the test box

init

public void init(GameContainer c)
          throws SlickException
Description copied from interface: Game
Initialise the game. This can be used to load static resources. It's called before the game loop starts

Specified by:
init in interface Game
Specified by:
init in class BasicGame
Parameters:
c - The container holding the game
Throws:
SlickException - Throw to indicate an internal error
See Also:
BasicGame.init(org.newdawn.slick.GameContainer)

update

public void update(GameContainer container,
                   int delta)
            throws SlickException
Description copied from interface: Game
Update the game logic here. No rendering should take place in this method though it won't do any harm.

Specified by:
update in interface Game
Specified by:
update in class BasicGame
Parameters:
container - The container holing this game
delta - The amount of time thats passed since last update in milliseconds
Throws:
SlickException - Throw to indicate an internal error
See Also:
BasicGame.update(org.newdawn.slick.GameContainer, int)

render

public void render(GameContainer container,
                   Graphics g)
            throws SlickException
Description copied from interface: Game
Render the game's screen here.

Parameters:
container - The container holing this game
g - The graphics context that can be used to render. However, normal rendering routines can also be used.
Throws:
SlickException - Throw to indicate a internal error
See Also:
Game.render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)

controllerButtonPressed

public void controllerButtonPressed(int controller,
                                    int button)
Description copied from interface: ControllerListener
Notification that a button control has been pressed on the controller.

Specified by:
controllerButtonPressed in interface ControllerListener
Overrides:
controllerButtonPressed in class BasicGame
Parameters:
controller - The index of the controller on which the control was pressed.
button - The index of the button pressed (starting at 1)
See Also:
BasicGame.controllerButtonPressed(int, int)

controllerButtonReleased

public void controllerButtonReleased(int controller,
                                     int button)
Description copied from interface: ControllerListener
Notification that a button control has been released on the controller.

Specified by:
controllerButtonReleased in interface ControllerListener
Overrides:
controllerButtonReleased in class BasicGame
Parameters:
controller - The index of the controller on which the control was released.
button - The index of the button released (starting at 1)
See Also:
BasicGame.controllerButtonReleased(int, int)

controllerDownPressed

public void controllerDownPressed(int controller)
Description copied from interface: ControllerListener
Notification that the down control has been pressed on the controller.

Specified by:
controllerDownPressed in interface ControllerListener
Overrides:
controllerDownPressed in class BasicGame
Parameters:
controller - The index of the controller on which the control was pressed.
See Also:
BasicGame.controllerDownPressed(int)

controllerDownReleased

public void controllerDownReleased(int controller)
Description copied from interface: ControllerListener
Notification that the down control has been released on the controller.

Specified by:
controllerDownReleased in interface ControllerListener
Overrides:
controllerDownReleased in class BasicGame
Parameters:
controller - The index of the controller on which the control was released.
See Also:
BasicGame.controllerDownReleased(int)

controllerLeftPressed

public void controllerLeftPressed(int controller)
Description copied from interface: ControllerListener
Notification that the left control has been pressed on the controller.

Specified by:
controllerLeftPressed in interface ControllerListener
Overrides:
controllerLeftPressed in class BasicGame
Parameters:
controller - The index of the controller on which the control was pressed.
See Also:
BasicGame.controllerLeftPressed(int)

controllerLeftReleased

public void controllerLeftReleased(int controller)
Description copied from interface: ControllerListener
Notification that the left control has been released on the controller.

Specified by:
controllerLeftReleased in interface ControllerListener
Overrides:
controllerLeftReleased in class BasicGame
Parameters:
controller - The index of the controller on which the control was released.
See Also:
BasicGame.controllerLeftReleased(int)

controllerRightPressed

public void controllerRightPressed(int controller)
Description copied from interface: ControllerListener
Notification that the right control has been pressed on the controller.

Specified by:
controllerRightPressed in interface ControllerListener
Overrides:
controllerRightPressed in class BasicGame
Parameters:
controller - The index of the controller on which the control was pressed.
See Also:
BasicGame.controllerRightPressed(int)

controllerRightReleased

public void controllerRightReleased(int controller)
Description copied from interface: ControllerListener
Notification that the right control has been released on the controller.

Specified by:
controllerRightReleased in interface ControllerListener
Overrides:
controllerRightReleased in class BasicGame
Parameters:
controller - The index of the controller on which the control was released.
See Also:
BasicGame.controllerRightReleased(int)

controllerUpPressed

public void controllerUpPressed(int controller)
Description copied from interface: ControllerListener
Notification that the up control has been pressed on the controller.

Specified by:
controllerUpPressed in interface ControllerListener
Overrides:
controllerUpPressed in class BasicGame
Parameters:
controller - The index of the controller on which the control was pressed.
See Also:
BasicGame.controllerUpPressed(int)

controllerUpReleased

public void controllerUpReleased(int controller)
Description copied from interface: ControllerListener
Notification that the up control has been released on the controller.

Specified by:
controllerUpReleased in interface ControllerListener
Overrides:
controllerUpReleased in class BasicGame
Parameters:
controller - The index of the controller on which the control was released.
See Also:
BasicGame.controllerUpReleased(int)

keyPressed

public void keyPressed(int key,
                       char c)
Description copied from interface: KeyListener
Notification that a key was pressed

Specified by:
keyPressed in interface KeyListener
Overrides:
keyPressed in class BasicGame
Parameters:
key - The key code that was pressed (@see org.newdawn.slick.Input)
c - The character of the key that was pressed
See Also:
BasicGame.keyPressed(int, char)

keyReleased

public void keyReleased(int key,
                        char c)
Description copied from interface: KeyListener
Notification that a key was released

Specified by:
keyReleased in interface KeyListener
Overrides:
keyReleased in class BasicGame
Parameters:
key - The key code that was released (@see org.newdawn.slick.Input)
c - The character of the key that was released
See Also:
BasicGame.keyReleased(int, char)

mouseMoved

public void mouseMoved(int oldx,
                       int oldy,
                       int newx,
                       int newy)
Description copied from interface: MouseListener
Notification that mouse cursor was moved

Specified by:
mouseMoved in interface MouseListener
Overrides:
mouseMoved in class BasicGame
Parameters:
oldx - The old x position of the mouse
oldy - The old y position of the mouse
newx - The new x position of the mouse
newy - The new y position of the mouse
See Also:
BasicGame.mouseMoved(int, int, int, int)

mousePressed

public void mousePressed(int button,
                         int x,
                         int y)
Description copied from interface: MouseListener
Notification that a mouse button was pressed

Specified by:
mousePressed in interface MouseListener
Overrides:
mousePressed in class BasicGame
Parameters:
button - The index of the button (starting at 0)
x - The x position of the mouse when the button was pressed
y - The y position of the mouse when the button was pressed
See Also:
BasicGame.mousePressed(int, int, int)

mouseReleased

public void mouseReleased(int button,
                          int x,
                          int y)
Description copied from interface: MouseListener
Notification that a mouse button was released

Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class BasicGame
Parameters:
button - The index of the button (starting at 0)
x - The x position of the mouse when the button was released
y - The y position of the mouse when the button was released
See Also:
BasicGame.mouseReleased(int, int, int)

mouseWheelMoved

public void mouseWheelMoved(int change)
Description copied from interface: MouseListener
Notification that the mouse wheel position was updated

Specified by:
mouseWheelMoved in interface MouseListener
Overrides:
mouseWheelMoved in class BasicGame
Parameters:
change - The amount of the wheel has moved
See Also:
BasicGame.mouseWheelMoved(int)

main

public static void main(java.lang.String[] argv)
Entry point to our test

Parameters:
argv - The arguments to pass into the test


Copyright © 2006 New Dawn Software. All Rights Reserved.