org.newdawn.slick.tests
Class MusicListenerTest

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

public class MusicListenerTest
extends BasicGame
implements MusicListener

A test for music listeners which notify you when the music has eneded

Author:
kevin

Field Summary
 
Fields inherited from class org.newdawn.slick.BasicGame
controllerButton, controllerDown, controllerLeft, controllerRight, controllerUp
 
Constructor Summary
MusicListenerTest()
          Create a new test
 
Method Summary
 void init(GameContainer container)
          Initialise the game.
 void keyPressed(int key, char c)
          Notification that a key was pressed
static void main(java.lang.String[] argv)
          Entry point to the sound test
 void musicEnded(Music music)
          Notification that a piece of music finished playing
 void musicSwapped(Music music, Music newMusic)
          Notification that a piece of music has been swapped for another.
 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, controllerButtonPressed, controllerButtonReleased, controllerDownPressed, controllerDownReleased, controllerLeftPressed, controllerLeftReleased, controllerRightPressed, controllerRightReleased, controllerUpPressed, controllerUpReleased, getTitle, inputEnded, inputStarted, isAcceptingInput, keyReleased, mouseClicked, mouseDragged, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, setInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MusicListenerTest

public MusicListenerTest()
Create a new 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)

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)

musicEnded

public void musicEnded(Music music)
Description copied from interface: MusicListener
Notification that a piece of music finished playing

Specified by:
musicEnded in interface MusicListener
Parameters:
music - The music that finished playing
See Also:
MusicListener.musicEnded(org.newdawn.slick.Music)

musicSwapped

public void musicSwapped(Music music,
                         Music newMusic)
Description copied from interface: MusicListener
Notification that a piece of music has been swapped for another.

Specified by:
musicSwapped in interface MusicListener
Parameters:
music - The music that has been swapped out
newMusic - The new music we're playing
See Also:
MusicListener.musicSwapped(org.newdawn.slick.Music, org.newdawn.slick.Music)

render

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

Specified by:
render in interface Game
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)

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)

main

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

Parameters:
argv - The arguments provided to the test


Copyright © 2006 New Dawn Software. All Rights Reserved.