android.gameengine.icadroids.renderer
Class GameView

java.lang.Object
  extended by SurfaceView
      extended by android.gameengine.icadroids.renderer.GameView

public class GameView
extends SurfaceView

Class that correctly renders the game on the screen.
Game programmers will not be accessing this class directly, it is a utility class used by the GameEngine.
Note: javadoc comments not finished

Author:
Edward, Lex, Leon, Roel, Bas

Field Summary
static int BACKGROUND_COLOR
          The background colour of the map
static int MAP_HEIGHT
          The height of the map
static int MAP_WIDTH
          The width of the map
static boolean surfaceLoaded
          Surfaceloaded will be true when the surface has been loaded
 
Constructor Summary
GameView(GameEngine ge, java.lang.Thread gameThread)
          Constructs a new viewport
 
Method Summary
 void drawDebugTiles(Canvas canvas, float left, float top, int tileSize)
           
 Point getViewportLocation()
           
 void onDraw(Canvas canvas)
          This method allows android to draw.
 void setBackgroundFit(boolean backgroundFit)
           
 void setBackgroundImage(java.lang.String backgroundString)
          Sets the background image that will be used in the game.
 void setGameThread(java.lang.Thread gamethread)
           
 void setTileBasedMap(boolean tileBasedMap)
          Sets the boolean for the tileBasedMap
 void setZoomFactor(float zoomFactor)
          Sets the zoomfactor for the current viewport.
 void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
          This method is called immediately after any structural changes (format or size) have been made to the surface.
 void surfaceCreated(SurfaceHolder holder)
          This method is called immediately after the surface is first created and it starts a new thread.
 void surfaceDestroyed(SurfaceHolder holder)
          This method is called immediately before a surface is being destroyed, it Ensures that the thread stops when the gameloop is stopped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

surfaceLoaded

public static boolean surfaceLoaded
Surfaceloaded will be true when the surface has been loaded


MAP_HEIGHT

public static int MAP_HEIGHT
The height of the map


MAP_WIDTH

public static int MAP_WIDTH
The width of the map


BACKGROUND_COLOR

public static int BACKGROUND_COLOR
The background colour of the map

Constructor Detail

GameView

public GameView(GameEngine ge,
                java.lang.Thread gameThread)
Constructs a new viewport

Parameters:
ge - The Game Engine that this GameRenderer is part of.
gameThread - The thread that this renderer will use.
Method Detail

surfaceDestroyed

public void surfaceDestroyed(SurfaceHolder holder)
This method is called immediately before a surface is being destroyed, it Ensures that the thread stops when the gameloop is stopped.


surfaceCreated

public void surfaceCreated(SurfaceHolder holder)
This method is called immediately after the surface is first created and it starts a new thread.


surfaceChanged

public void surfaceChanged(SurfaceHolder holder,
                           int format,
                           int width,
                           int height)
This method is called immediately after any structural changes (format or size) have been made to the surface.


drawDebugTiles

public void drawDebugTiles(Canvas canvas,
                           float left,
                           float top,
                           int tileSize)

setBackgroundImage

public void setBackgroundImage(java.lang.String backgroundString)
Sets the background image that will be used in the game.

Parameters:
backgroundString - The name of the image that will be used as background.

setZoomFactor

public void setZoomFactor(float zoomFactor)
Sets the zoomfactor for the current viewport.

Parameters:
zoomFactor - The amount of zooming

setTileBasedMap

public void setTileBasedMap(boolean tileBasedMap)
Sets the boolean for the tileBasedMap

Parameters:
tileBasedMap - True if a tilebased map is used, otherwise false

setGameThread

public void setGameThread(java.lang.Thread gamethread)

onDraw

public void onDraw(Canvas canvas)
This method allows android to draw.

Parameters:
canvas - The canvas used to draw.

getViewportLocation

public Point getViewportLocation()

setBackgroundFit

public void setBackgroundFit(boolean backgroundFit)