fr.umlv.platform
Class GameScene<S>

java.lang.Object
  extended by fr.umlv.platform.GameScene<S>
Type Parameters:
S - type of the sprites managed in this game.

public class GameScene<S>
extends java.lang.Object

Creates a frame of 320x240 with an average refreshing rates of 50ms. This object calls successively three functions of a GameModel<S> ; namely GameModel.applyParallaxInZone(fr.umlv.platform.Function, int, int, int, int), GameModel.applyPatternsInZone(fr.umlv.platform.Function, int, int, int, int) and GameModel.applyKeyHandledSprites(fr.umlv.platform.Function, long). Each of these methods provides a Function that allows to show out S components by using GameModel.getLocation(S) and GameModel.getImage(S) methods to the associated GameModel. Parallax corresponds to the background that do not scroll at the same speed than the rest. Patterns are items not handled by the KeyHandler while KeyHandledSprites are sprites affected by the KeyHandler.


Constructor Summary
Constructor and Description
GameScene(GameModel<S> model)
          Build a scene with its associated GameModel
 
Method Summary
Modifier and Type Method and Description
 int getHeight()
          Returns the current height of the frame.
 int getOffsetX()
          Returns the current OffsetX.
 int getOffsetY()
          Returns the current OffsetY.
 int getWidth()
          Returns the current width of the frame.
 void incrementHorizontalScroll(int shift)
          Alter the offsetX from shift ; used for deciding which part of the level is drawn.
 void incrementVerticalScroll(int shift)
          Alter the offsetY from shift ; used for deciding which part of the level is drawn If the shift leads to a negative offsetY, the offsetY is set to 0.
 void showFrame(java.lang.String title, KeyHandler keyHandler)
          Draw a frame of 320x240 with a refreshing rates of 50ms
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameScene

public GameScene(GameModel<S> model)
Build a scene with its associated GameModel

Parameters:
model -
Method Detail

incrementHorizontalScroll

public void incrementHorizontalScroll(int shift)
Alter the offsetX from shift ; used for deciding which part of the level is drawn. If the shift leads to a negative offsetX, the offsetX is set to 0.

Parameters:
shift -

incrementVerticalScroll

public void incrementVerticalScroll(int shift)
Alter the offsetY from shift ; used for deciding which part of the level is drawn If the shift leads to a negative offsetY, the offsetY is set to 0.

Parameters:
shift -

showFrame

public void showFrame(java.lang.String title,
                      KeyHandler keyHandler)
Draw a frame of 320x240 with a refreshing rates of 50ms

Parameters:
title - Title of the frame.
keyHandler - The Handler of the KeyHandledSprites.

getOffsetX

public int getOffsetX()
Returns the current OffsetX.

Returns:
int corresponding to the X-axis offset

getOffsetY

public int getOffsetY()
Returns the current OffsetY.

Returns:
int corresponding to the Y-axis offset

getWidth

public int getWidth()
Returns the current width of the frame.

Returns:
int corresponding to the width in pixels of the frame

getHeight

public int getHeight()
Returns the current height of the frame.

Returns:
int corresponding to the height in pixels of the frame