Package view

Class SceneryView

All Implemented Interfaces:
Configuration

public class SceneryView extends EntityView implements Configuration
The SceneryView class represents an EntityView specifically for scenery. Scenery is defined in this context as background that can scroll laterally. The SceneryView extends EntityView and is the visual representation assumed by SceneryModels. Scenery can be layered by setting a layer value of the SceneryModel that contains this view..
Since:
1.0
Author:
Krish Pillai
  • Constructor Details

    • SceneryView

      public SceneryView(String resource, int width, int height)
      Constructor that takes the resource file name, and the dimensions of the view port. The resource file should be located in the res.drawable package. The resource file contents will be loaded into memory.
      Parameters:
      resource - File located in the res.drawable package
      width - The view port width
      height - The view port height
    • SceneryView

      public SceneryView(String resource, Dimension size)
      Constructor that takes the resource file name, and the dimensions of the view port. Resource file contents are not loaded. The object is not viewable at this point.
      Parameters:
      resource - Image file
      size - Dimensions of the view port.
  • Method Details

    • getViewPortWidth

      public double getViewPortWidth()
      Getter for the width of the view port.
      Returns:
      width
    • getViewPortHeight

      public double getViewPortHeight()
      Getter for the height of the view port.
      Returns:
      height
    • getWidth

      public int getWidth()
      Returns the width of the sprite
      Specified by:
      getWidth in class EntityView
      Returns:
      Scaled width of the sprite
    • getHeight

      public int getHeight()
      Returns the height of the sprite
      Specified by:
      getHeight in class EntityView
      Returns:
      Scaled height of the sprite
    • setScaleFactor

      public void setScaleFactor(float sx, float sy)
      Description copied from class: EntityView
      Sets the x and y scale factors
      Overrides:
      setScaleFactor in class EntityView
      Parameters:
      sx - Scale factor along x axis
      sy - Scale factor along y axis
    • setXDelta

      public void setXDelta(float delta)
      Returns the displacement used to advance the frame for each rendering.
      Parameters:
      delta - The amount to advance