ch.sahits.game.graphic.display.start
Class StartupView

java.lang.Object
  extended by ch.sahits.game.rendering.AbstractRenderPart
      extended by ch.sahits.game.graphic.display.start.StartupView
All Implemented Interfaces:
ch.sahits.game.event.IEventListener, ch.sahits.game.rendering.Renderable, ch.sahits.game.rendering.RenderablePart

public class StartupView
extends ch.sahits.game.rendering.AbstractRenderPart


Nested Class Summary
private static class StartupView.MouseState
           
private static class StartupView.PageState
           
 
Field Summary
private  int historyIndex
           
private  int historySize
           
private  ArrayList<ch.sahits.game.graphic.image.NamedBufferedImage> images
           
private static String IMS_FILE
           
private  ch.sahits.game.graphic.image.LanguageImageLoader imsLoader
           
private  int initialRenderedImages
          Number of images that are initially drawn
private static String[] names
           
private  HashMap<String,Point> offsets
          Storage of the offsets for each image.
private  OffsetCalculator offsetter
           
private  StartupView.PageState pageState
           
private  TreeMap<Integer,NamedPolygon> polygons
          Store the polygons for checking against clicking them Using a TreeMap so it may be possible do define polygons that cover the same are but in a different z-order.
private  Rectangle size
           
private  StartupView.MouseState state
           
private static int TEXT_BACK_NEXT
           
private static int TEXT_CREDITS
           
private static int TEXT_FOCUS_BACK
           
private static int TEXT_FOCUS_CREDITS
           
private static int TEXT_FOCUS_HISTORY
           
private static int TEXT_FOCUS_LOAD
           
private static int TEXT_FOCUS_NEW
           
private static int TEXT_FOCUS_NEXT
           
private static int TEXT_FOCUS_OPTIONS
           
private static int TEXT_HISTORY
           
private static int TEXT_UNFOCUSED
           
private  int textImageIndex
          Index of the text image in the images List
private  boolean viewChanged
           
 
Fields inherited from class ch.sahits.game.rendering.AbstractRenderPart
rect
 
Constructor Summary
StartupView(Rectangle bounds)
           
 
Method Summary
private  boolean contains(String imageName)
          check if an image is already contained.
private  String findPolygon(int x, int y)
          Find the polygon name that contains the coordinates.
 void gameRender(Graphics gScr)
           
 void gameUpdate(ch.sahits.game.event.Event e, Object notice)
           
private  String getImageName(StartupView.MouseState state)
           
private  void initImages()
          load and initialize the images, and build their 'hot-spots'
private  void initMouseState()
           
protected  void initOffsets()
          Compute the offsets for the images to be drawn onto the panel
private  void initStartPolygons()
          Setting the positions of the polygons on the screen
protected  void insertFirst(String insertImageName)
           
protected  void insertImageBefore(String insertImageName, String imageName)
          Insert the image before another image.
protected  void insertImageLast(ch.sahits.game.graphic.image.NamedBufferedImage img)
           
protected  void insertImageLast(String insertImageName)
          Inserts an image at the last position
protected  void removeImage(String name)
          Remove the image with the name.
private  void returnBackToStartFromHistory()
           
protected  void updateMouseState(String polyName)
           
 
Methods inherited from class ch.sahits.game.rendering.AbstractRenderPart
getBounds, isEnabled, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEXT_UNFOCUSED

private static final int TEXT_UNFOCUSED
See Also:
Constant Field Values

TEXT_FOCUS_NEW

private static final int TEXT_FOCUS_NEW
See Also:
Constant Field Values

TEXT_FOCUS_LOAD

private static final int TEXT_FOCUS_LOAD
See Also:
Constant Field Values

TEXT_FOCUS_OPTIONS

private static final int TEXT_FOCUS_OPTIONS
See Also:
Constant Field Values

TEXT_FOCUS_CREDITS

private static final int TEXT_FOCUS_CREDITS
See Also:
Constant Field Values

TEXT_FOCUS_HISTORY

private static final int TEXT_FOCUS_HISTORY
See Also:
Constant Field Values

TEXT_CREDITS

private static final int TEXT_CREDITS
See Also:
Constant Field Values

TEXT_FOCUS_BACK

private static final int TEXT_FOCUS_BACK
See Also:
Constant Field Values

TEXT_HISTORY

private static final int TEXT_HISTORY
See Also:
Constant Field Values

TEXT_BACK_NEXT

private static final int TEXT_BACK_NEXT
See Also:
Constant Field Values

TEXT_FOCUS_NEXT

private static final int TEXT_FOCUS_NEXT
See Also:
Constant Field Values

names

private static final String[] names

historyIndex

private int historyIndex

historySize

private int historySize

textImageIndex

private int textImageIndex
Index of the text image in the images List


size

private Rectangle size

offsetter

private OffsetCalculator offsetter

polygons

private TreeMap<Integer,NamedPolygon> polygons
Store the polygons for checking against clicking them Using a TreeMap so it may be possible do define polygons that cover the same are but in a different z-order.


offsets

private HashMap<String,Point> offsets
Storage of the offsets for each image.


IMS_FILE

private static final String IMS_FILE
See Also:
Constant Field Values

images

private ArrayList<ch.sahits.game.graphic.image.NamedBufferedImage> images

initialRenderedImages

private final int initialRenderedImages
Number of images that are initially drawn


state

private StartupView.MouseState state

pageState

private StartupView.PageState pageState

imsLoader

private final ch.sahits.game.graphic.image.LanguageImageLoader imsLoader

viewChanged

private volatile boolean viewChanged
Constructor Detail

StartupView

public StartupView(Rectangle bounds)
Method Detail

initMouseState

private void initMouseState()

updateMouseState

protected void updateMouseState(String polyName)

findPolygon

private String findPolygon(int x,
                           int y)
Find the polygon name that contains the coordinates. It is expected that the polygons are not overlapping. Is this not the case the first found polygon name is returned.

Parameters:
x - coordinate
y - coordinate
Returns:
name of the polygon

initStartPolygons

private void initStartPolygons()
Setting the positions of the polygons on the screen


initImages

private void initImages()
load and initialize the images, and build their 'hot-spots'


initOffsets

protected void initOffsets()
Compute the offsets for the images to be drawn onto the panel


removeImage

protected void removeImage(String name)
Remove the image with the name. If the image is not contained it cannot be removed.

Parameters:
name -

insertImageBefore

protected void insertImageBefore(String insertImageName,
                                 String imageName)
Insert the image before another image. If the image is not found, no image will be inserted

Parameters:
insertImageName - Name of the image to be inserted.
imageName - Name of the image before which to insert.

insertFirst

protected final void insertFirst(String insertImageName)

contains

private boolean contains(String imageName)
check if an image is already contained.

Parameters:
imageName -
Returns:

insertImageLast

protected void insertImageLast(String insertImageName)
Inserts an image at the last position

Parameters:
insertImageName -

insertImageLast

protected void insertImageLast(ch.sahits.game.graphic.image.NamedBufferedImage img)

getImageName

private String getImageName(StartupView.MouseState state)

returnBackToStartFromHistory

private void returnBackToStartFromHistory()

gameRender

public void gameRender(Graphics gScr)

gameUpdate

public void gameUpdate(ch.sahits.game.event.Event e,
                       Object notice)


Copyright © 2011 Sahits GmbH. All Rights Reserved.