|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.newdawn.slick.BasicGame
public abstract class BasicGame
A basic implementation of a game to take out the boring bits
Field Summary | |
---|---|
protected boolean[][] |
controllerButton
The state of the button controlls |
protected boolean[] |
controllerDown
The state of the down control |
protected boolean[] |
controllerLeft
The state of the left control |
protected boolean[] |
controllerRight
The state of the right control |
protected boolean[] |
controllerUp
The state of the up control |
Constructor Summary | |
---|---|
BasicGame(java.lang.String title)
Create a new basic game |
Method Summary | |
---|---|
boolean |
closeRequested()
Notification that a game close has been requested |
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. |
java.lang.String |
getTitle()
Get the title of this game |
abstract void |
init(GameContainer container)
Initialise the game. |
void |
inputEnded()
Notification that all input events have been sent for this frame |
void |
inputStarted()
Notification that input is about to be processed |
boolean |
isAcceptingInput()
Check if this input listener is accepting input |
void |
keyPressed(int key,
char c)
Notification that a key was pressed |
void |
keyReleased(int key,
char c)
Notification that a key was released |
void |
mouseClicked(int button,
int x,
int y,
int clickCount)
Notification that a mouse button was clicked. |
void |
mouseDragged(int oldx,
int oldy,
int newx,
int newy)
Notification that mouse cursor was dragged |
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 |
setInput(Input input)
Set the input that events are being sent from |
abstract void |
update(GameContainer container,
int delta)
Update the game logic here. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.newdawn.slick.Game |
---|
render |
Field Detail |
---|
protected boolean[] controllerLeft
protected boolean[] controllerRight
protected boolean[] controllerUp
protected boolean[] controllerDown
protected boolean[][] controllerButton
Constructor Detail |
---|
public BasicGame(java.lang.String title)
title
- The title for the gameMethod Detail |
---|
public void setInput(Input input)
ControlledInputReciever
setInput
in interface ControlledInputReciever
input
- The input instance sending eventsControlledInputReciever.setInput(org.newdawn.slick.Input)
public boolean closeRequested()
Game
closeRequested
in interface Game
Game.closeRequested()
public java.lang.String getTitle()
Game
getTitle
in interface Game
Game.getTitle()
public abstract void init(GameContainer container) throws SlickException
Game
init
in interface Game
container
- The container holding the game
SlickException
- Throw to indicate an internal errorGame.init(org.newdawn.slick.GameContainer)
public void keyPressed(int key, char c)
KeyListener
keyPressed
in interface KeyListener
key
- The key code that was pressed (@see org.newdawn.slick.Input)c
- The character of the key that was pressedKeyListener.keyPressed(int, char)
public void keyReleased(int key, char c)
KeyListener
keyReleased
in interface KeyListener
key
- The key code that was released (@see org.newdawn.slick.Input)c
- The character of the key that was releasedKeyListener.keyReleased(int, char)
public void mouseMoved(int oldx, int oldy, int newx, int newy)
MouseListener
mouseMoved
in interface MouseListener
oldx
- The old x position of the mouseoldy
- The old y position of the mousenewx
- The new x position of the mousenewy
- The new y position of the mouseMouseListener.mouseMoved(int, int, int, int)
public void mouseDragged(int oldx, int oldy, int newx, int newy)
MouseListener
mouseDragged
in interface MouseListener
oldx
- The old x position of the mouseoldy
- The old y position of the mousenewx
- The new x position of the mousenewy
- The new y position of the mouseMouseListener.mouseDragged(int, int, int, int)
public void mouseClicked(int button, int x, int y, int clickCount)
MouseListener
mouseClicked
in interface MouseListener
button
- The index of the button (starting at 0)x
- The x position of the mouse when the button was pressedy
- The y position of the mouse when the button was pressedclickCount
- The number of times the button was clickedMouseListener.mouseClicked(int, int, int, int)
public void mousePressed(int button, int x, int y)
MouseListener
mousePressed
in interface MouseListener
button
- The index of the button (starting at 0)x
- The x position of the mouse when the button was pressedy
- The y position of the mouse when the button was pressedMouseListener.mousePressed(int, int, int)
public void controllerButtonPressed(int controller, int button)
ControllerListener
controllerButtonPressed
in interface ControllerListener
controller
- The index of the controller on which the control
was pressed.button
- The index of the button pressed (starting at 1)ControllerListener.controllerButtonPressed(int, int)
public void controllerButtonReleased(int controller, int button)
ControllerListener
controllerButtonReleased
in interface ControllerListener
controller
- The index of the controller on which the control
was released.button
- The index of the button released (starting at 1)ControllerListener.controllerButtonReleased(int, int)
public void controllerDownPressed(int controller)
ControllerListener
controllerDownPressed
in interface ControllerListener
controller
- The index of the controller on which the control
was pressed.ControllerListener.controllerDownPressed(int)
public void controllerDownReleased(int controller)
ControllerListener
controllerDownReleased
in interface ControllerListener
controller
- The index of the controller on which the control
was released.ControllerListener.controllerDownReleased(int)
public void controllerLeftPressed(int controller)
ControllerListener
controllerLeftPressed
in interface ControllerListener
controller
- The index of the controller on which the control
was pressed.ControllerListener.controllerLeftPressed(int)
public void controllerLeftReleased(int controller)
ControllerListener
controllerLeftReleased
in interface ControllerListener
controller
- The index of the controller on which the control
was released.ControllerListener.controllerLeftReleased(int)
public void controllerRightPressed(int controller)
ControllerListener
controllerRightPressed
in interface ControllerListener
controller
- The index of the controller on which the control
was pressed.ControllerListener.controllerRightPressed(int)
public void controllerRightReleased(int controller)
ControllerListener
controllerRightReleased
in interface ControllerListener
controller
- The index of the controller on which the control
was released.ControllerListener.controllerRightReleased(int)
public void controllerUpPressed(int controller)
ControllerListener
controllerUpPressed
in interface ControllerListener
controller
- The index of the controller on which the control
was pressed.ControllerListener.controllerUpPressed(int)
public void controllerUpReleased(int controller)
ControllerListener
controllerUpReleased
in interface ControllerListener
controller
- The index of the controller on which the control
was released.ControllerListener.controllerUpReleased(int)
public void mouseReleased(int button, int x, int y)
MouseListener
mouseReleased
in interface MouseListener
button
- The index of the button (starting at 0)x
- The x position of the mouse when the button was releasedy
- The y position of the mouse when the button was releasedMouseListener.mouseReleased(int, int, int)
public abstract void update(GameContainer container, int delta) throws SlickException
Game
update
in interface Game
container
- The container holing this gamedelta
- The amount of time thats passed since last update in milliseconds
SlickException
- Throw to indicate an internal errorGame.update(org.newdawn.slick.GameContainer, int)
public void mouseWheelMoved(int change)
MouseListener
mouseWheelMoved
in interface MouseListener
change
- The amount of the wheel has movedMouseListener.mouseWheelMoved(int)
public boolean isAcceptingInput()
ControlledInputReciever
isAcceptingInput
in interface ControlledInputReciever
ControlledInputReciever.isAcceptingInput()
public void inputEnded()
ControlledInputReciever
inputEnded
in interface ControlledInputReciever
ControlledInputReciever.inputEnded()
public void inputStarted()
ControlledInputReciever
inputStarted
in interface ControlledInputReciever
ControlledInputReciever.inputStarted()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |