org.jrabbit.base.managers.window
Class WindowManager

java.lang.Object
  extended by org.jrabbit.base.managers.window.WindowManager

public class WindowManager
extends java.lang.Object

WindowManager is a static class that handles easy manipulation of the Display. The heavy-duty work is all done via the WindowManager's WindowController, which can be set. All other methods are not really necessary, but are provided to create a unified API.

Author:
Chris Molini

Field Summary
private static WindowController controller
          The current WindowController.
private static java.util.LinkedList<WindowListener> listeners
          All currently active WindowListeners.
 
Constructor Summary
WindowManager()
           
 
Method Summary
static void alertWindowChange(int changeType)
          Alerts all current WindowListeners that a change has occurred in the Display and Scene settings.
static WindowController controller()
          Accesses the current WindowController.
static int displayHeight()
          Accesses the Display's dimensions.
static int displayWidth()
          Accesses the Display's dimensions.
static java.util.LinkedList<WindowListener> listeners()
          Accesses the list of WindowListeners.
static int screenHeight()
          Accesses the desktop's dimensions.
static int screenWidth()
          Accesses the desktop's dimensions.
static void setController(WindowController wC)
          Sets the WindowController to use to manage the Display.
static void setIcon(java.lang.String filepath)
          Loads the image at the indicated location and sets it as the game's icon.
static void setTitle(java.lang.String title)
          Defines the title of the window.
static java.lang.String title()
          Accesses the current title.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

controller

private static WindowController controller
The current WindowController. This should be set at startup and not changed.


listeners

private static java.util.LinkedList<WindowListener> listeners
All currently active WindowListeners.

Constructor Detail

WindowManager

public WindowManager()
Method Detail

controller

public static WindowController controller()
Accesses the current WindowController.

Returns:
The WindowController used to handle window and scene settings.

setController

public static void setController(WindowController wC)
Sets the WindowController to use to manage the Display. This should only be used at startup.

Parameters:
wC - The new WindowController.

listeners

public static java.util.LinkedList<WindowListener> listeners()
Accesses the list of WindowListeners. NOTE: To add or remove listeners, simply add them to the list retrieved by this method.

Returns:
A LinkedList of all currently active WindowListeners.

alertWindowChange

public static void alertWindowChange(int changeType)
Alerts all current WindowListeners that a change has occurred in the Display and Scene settings.

Parameters:
changeType - The ID of the change that has occurred.

setTitle

public static void setTitle(java.lang.String title)
Defines the title of the window.

Parameters:
title - The new title for the game.

title

public static java.lang.String title()
Accesses the current title.

Returns:
The title of the Display containing the game.

setIcon

public static void setIcon(java.lang.String filepath)
Loads the image at the indicated location and sets it as the game's icon.

Parameters:
filepath - The file location of the icon image.

screenWidth

public static int screenWidth()
Accesses the desktop's dimensions.

Returns:
The width of the entire desktop, in pixels.

screenHeight

public static int screenHeight()
Accesses the desktop's dimensions.

Returns:
The height of the entire desktop, in pixels.

displayWidth

public static int displayWidth()
Accesses the Display's dimensions.

Returns:
The width of the Display, in pixels.

displayHeight

public static int displayHeight()
Accesses the Display's dimensions.

Returns:
The height of the Display, in pixels.