org.jtgl.gaming
Class SurfaceManager

java.lang.Object
  extended by org.jtgl.gaming.SurfaceManager

public class SurfaceManager
extends java.lang.Object

SurfaceManager provides a container of Surfaces API based on J2ME/MIDP 2.0

Author:
Manuel Polo (manuel_polo at yahoo dot es)

Constructor Summary
SurfaceManager()
           
SurfaceManager(int surfaceGrow)
           
 
Method Summary
 void append(Surface s)
           
 void centerView(int vx, int vy, int viewMaxWidth, int viewMaxHeight)
          Centers view window relative to a (vx,vy) point.
 void centerView(Surface surface, int viewMaxWidth, int viewMaxHeight)
          Centers view window relative to a surface.
 void draw(JTGLGraphics g, int x, int y)
           
 int getSize()
           
 Surface getSurfaceAt(int index)
           
 int getViewHeight()
           
 int getViewWidth()
           
 int getViewX()
           
 int getViewY()
           
 void insert(Surface s, int index)
           
 void moveView(int dx, int dy)
           
 void remove(Surface s)
           
 void removeAll()
           
 void setViewLocation(int x, int y)
           
 void setViewWindow(int x, int y, int width, int height)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SurfaceManager

public SurfaceManager()

SurfaceManager

public SurfaceManager(int surfaceGrow)
Method Detail

append

public void append(Surface s)

insert

public void insert(Surface s,
                   int index)

getSurfaceAt

public Surface getSurfaceAt(int index)

getSize

public int getSize()

remove

public void remove(Surface s)

removeAll

public void removeAll()

draw

public void draw(JTGLGraphics g,
                 int x,
                 int y)

setViewWindow

public void setViewWindow(int x,
                          int y,
                          int width,
                          int height)

getViewX

public int getViewX()

getViewY

public int getViewY()

getViewWidth

public int getViewWidth()

getViewHeight

public int getViewHeight()

setViewLocation

public void setViewLocation(int x,
                            int y)

moveView

public void moveView(int dx,
                     int dy)

centerView

public void centerView(Surface surface,
                       int viewMaxWidth,
                       int viewMaxHeight)
Centers view window relative to a surface. This code is usefull to scroll the view following a main surface (eg: Sprite) across its move around a map (TiledSurface).


centerView

public void centerView(int vx,
                       int vy,
                       int viewMaxWidth,
                       int viewMaxHeight)
Centers view window relative to a (vx,vy) point. This code is usefull to scroll the view following a point.