bubolo
 All Classes Namespaces Functions Variables Enumerator
Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Package Functions | List of all members
bubolo.graphics.Graphics Class Reference

Public Member Functions

 Graphics (int windowWidth, int windowHeight)
 
void draw (World world)
 
void addCameraController (CameraController controller)
 

Static Public Member Functions

static void dispose ()
 

Static Public Attributes

static final String TEXTURE_PATH = "res/textures/"
 
static final int TICKS_PER_SECOND = 60
 
static final long MILLIS_PER_TICK = 1000 / TICKS_PER_SECOND
 

Static Package Functions

static Graphics getInstance ()
 
static Texture getTexture (String path)
 

Detailed Description

The top-level class for the Graphics system.

Author
BU CS673 - Clone Productions

Definition at line 23 of file Graphics.java.

Constructor & Destructor Documentation

bubolo.graphics.Graphics.Graphics ( int  windowWidth,
int  windowHeight 
)

Creates the graphics system.

Parameters
windowWidththe width of the window, in pixels.
windowHeightthe height of the window, in pixels.

Definition at line 112 of file Graphics.java.

Member Function Documentation

void bubolo.graphics.Graphics.addCameraController ( CameraController  controller)

Adds the specified camera controller.

Parameters
controllera camera controller. The update method will be called once per draw call.

Definition at line 157 of file Graphics.java.

static void bubolo.graphics.Graphics.dispose ( )
static

Destroys all textures.

Definition at line 99 of file Graphics.java.

void bubolo.graphics.Graphics.draw ( World  world)

Draws the entities that are within the camera's clipping boundary.

Parameters
worldreference to the World Model object.

Definition at line 128 of file Graphics.java.

References bubolo.graphics.DrawLayer.OBJECTS, bubolo.graphics.DrawLayer.TANKS, bubolo.graphics.DrawLayer.TERRAIN, and bubolo.graphics.DrawLayer.TERRAIN_MODIFIERS.

static Graphics bubolo.graphics.Graphics.getInstance ( )
staticpackage

Gets a reference to the Graphics system. The Graphics system must be explicitly constructed using the Graphics(width, height) constructor before this is called, or an IllegalStateException will be thrown. This method is package-private, because only objects within the Graphics system should have access to it.

Returns
a reference to the Graphics system.
Exceptions
IllegalStateExceptionwhen the Graphics system has not been explicitly constructed using the Graphics(width, height) constructor.

Definition at line 65 of file Graphics.java.

static Texture bubolo.graphics.Graphics.getTexture ( String  path)
staticpackage

Returns a texture from a path. Ensures that the same texture isn't store multiple times. Will load the file if it has not yet been loaded.

Parameters
paththe path to the texture file.
Returns
the requested texture.
Exceptions
FileNotFoundExceptionif the file is not found on the file system (can only occur if the file has not yet been loaded).

Definition at line 83 of file Graphics.java.

Member Data Documentation

final long bubolo.graphics.Graphics.MILLIS_PER_TICK = 1000 / TICKS_PER_SECOND
static

The number of milliseconds per draw tick.

Definition at line 38 of file Graphics.java.

Referenced by bubolo.BuboloApplication.render().

final String bubolo.graphics.Graphics.TEXTURE_PATH = "res/textures/"
static

File path where textures are stored.

Definition at line 28 of file Graphics.java.

final int bubolo.graphics.Graphics.TICKS_PER_SECOND = 60
static

The target number of draw ticks per second.

Definition at line 33 of file Graphics.java.