org.newdawn.slick.tests
Class InputTest

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

public class InputTest
extends BasicGame

A test for input

Author:
kevin

Field Summary
 
Fields inherited from class org.newdawn.slick.BasicGame
controllerButton, controllerDown, controllerLeft, controllerRight, controllerUp
 
Constructor Summary
InputTest()
          Create a new input test
 
Method Summary
 void controllerButtonPressed(int controller, int button)
          Notification that a button control has been pressed on the controller.
 void init(GameContainer container)
          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 mouseClicked(int button, int x, int y, int clickCount)
          Notification that a mouse button was clicked.
 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, controllerButtonReleased, controllerDownPressed, controllerDownReleased, controllerLeftPressed, controllerLeftReleased, controllerRightPressed, controllerRightReleased, controllerUpPressed, controllerUpReleased, getTitle, inputEnded, inputStarted, isAcceptingInput, mouseDragged, setInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputTest

public InputTest()
Create a new input test

Method Detail

init

public void init(GameContainer container)
          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:
container - The container holding the game
Throws:
SlickException - Throw to indicate an internal error
See Also:
BasicGame.init(org.newdawn.slick.GameContainer)

render

public void render(GameContainer container,
                   Graphics g)
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.
See Also:
Game.render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)

update

public void update(GameContainer container,
                   int delta)
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
See Also:
BasicGame.update(org.newdawn.slick.GameContainer, 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)

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)

mouseClicked

public void mouseClicked(int button,
                         int x,
                         int y,
                         int clickCount)
Description copied from interface: MouseListener
Notification that a mouse button was clicked. Due to double click handling the single click may be delayed slightly. For absolute notification of single clicks use mousePressed(). To be absolute this method should only be used when considering double clicks

Specified by:
mouseClicked in interface MouseListener
Overrides:
mouseClicked 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
clickCount - The number of times the button was clicked
See Also:
BasicGame.mouseClicked(int, 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)

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)

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)

main

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

Parameters:
argv - The arguments passed into our test


Copyright © 2006 New Dawn Software. All Rights Reserved.