Java Reference
In-Depth Information
// from PlayerListener
public void playerUpdate(Player player, String event, Object eventData) {
try if(event.equals(PlayerListener.END_OF_MEDIA)) {
if(player == backgroundPlayer1) {
activeBackgroundPlayer = backgroundPlayer2;
} else if(player == backgroundPlayer2) {
activeBackgroundPlayer = backgroundPlayer3;
} else if(player == backgroundPlayer3) {
activeBackgroundPlayer = backgroundPlayer1;
} startBackgroundFXTimer();
}
} catch(Exception e) {
e.printStackTrace();
}
}
private void startBackgroundFXTimer() {
stopBackgroundFXTimer();
TimerTask task = new TimerTask() {
public void run() {
playBackgroundMusic();
}
} ;
backgroundTimer = new Timer();
backgroundTimer.schedule(task, musicDelay);
musicDelay = Utilities.random(BACKGROUND_WAIT_MIN,BACKGROUND_WAIT_MAX);
}
8.4.5 Using the Scalable 2D Vector Graphics API (JSR-226)
As explained earlier, this game uses a menu system based on the Scalable
Vector Graphics API, when it is detected on the device. Figure 8.6a shows
the results of a very simple linear menu using scaling and transparency.
The best way to get started using JSR-226 is to read [Nokia 2006e] and
[Powers 2005].
An SVG image is simply an XML document containing a set of
drawing instructions which allows an image to be created using high-
level instructions. You can say, for example, 'draw a circle radius 5 at
point 2,10'. The main benefits you get by using SVG images instead of
traditional raster images is their scalability, ease of manipulation and the
fact that they compress extremely well in a JAR since they are just a text
document.
The full SVG specification defines support for a wide range of features
but not all of these are yet supported on mobile phones. Instead phones
support a subset of the specification called SVG-Tiny also referred to
as SVG-T. The current version of SVG-T is 1.1 and this is the version
currently shipped on Symbian OS 9.x devices. To determine from Java ME
 
Search WWH ::




Custom Search