mhframework
Class MHDisplayModeChooser

java.lang.Object
  extended by mhframework.MHDisplayModeChooser

public abstract class MHDisplayModeChooser
extends java.lang.Object

Abstract class for switching full-screen display modes and maintaining references to critical singleton objects.

This class iterates through an internal list of recommended display modes and selects the best one supported by the system on which this program is running.

It contains the objects necessary for full-screen rendering along with accessor methods for retrieving references to them. Included classes of particular interest are:


Field Summary
static int DISPLAY_X
          Top-left corner of screen display, to account for insets in windowed mode.
static int DISPLAY_Y
          Top-left corner of screen display, to account for insets in windowed mode.
static int NATIVE_DISPLAY_HEIGHT
           
static int NATIVE_DISPLAY_WIDTH
           
 
Constructor Summary
MHDisplayModeChooser()
           
 
Method Summary
static void changeScreen(boolean fullScreen)
          TODO: Figure out if this method can be fixed.
static void configureGameWindow(javax.swing.JFrame appFrame, MHVideoSettings settings)
          Configures a JFrame object for full-screen or windowed rendering as specified in the MHVideoSettings parameter.
static java.awt.geom.Rectangle2D getBounds()
           
static java.awt.image.BufferStrategy getBufferStrategy()
          Returns the active BufferStrategy object being used with the current display mode.
static java.awt.Canvas getCanvas()
          Returns a reference to the Canvas object which represents the graphics screen.
static javax.swing.JFrame getFrame()
           
static java.awt.Graphics2D getGraphics2D()
           
static java.awt.Dimension getScreenSize()
           
static boolean isFullScreen()
           
 void setCursor(java.lang.String cursorImageFileName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISPLAY_X

public static int DISPLAY_X
Top-left corner of screen display, to account for insets in windowed mode.


DISPLAY_Y

public static int DISPLAY_Y
Top-left corner of screen display, to account for insets in windowed mode.


NATIVE_DISPLAY_WIDTH

public static int NATIVE_DISPLAY_WIDTH

NATIVE_DISPLAY_HEIGHT

public static int NATIVE_DISPLAY_HEIGHT
Constructor Detail

MHDisplayModeChooser

public MHDisplayModeChooser()
Method Detail

getBufferStrategy

public static java.awt.image.BufferStrategy getBufferStrategy()
Returns the active BufferStrategy object being used with the current display mode.

Returns:
The BufferStrategy currently in use.

getCanvas

public static java.awt.Canvas getCanvas()
Returns a reference to the Canvas object which represents the graphics screen.

Returns:
The Canvas object being using in the current display mode.

configureGameWindow

public static void configureGameWindow(javax.swing.JFrame appFrame,
                                       MHVideoSettings settings)
Configures a JFrame object for full-screen or windowed rendering as specified in the MHVideoSettings parameter.

Parameters:
appFrame - The JFrame object to be configured. If null, a new JFrame is created.
settings - A MHVideoSettings object containing guideline parameters to specify details of the video mode to configure. If null, default settings are used to attempt full-screen mode.

getScreenSize

public static java.awt.Dimension getScreenSize()

getFrame

public static javax.swing.JFrame getFrame()
Returns:
the frame

getGraphics2D

public static java.awt.Graphics2D getGraphics2D()
Returns:
the buffer

isFullScreen

public static boolean isFullScreen()

setCursor

public void setCursor(java.lang.String cursorImageFileName)

changeScreen

public static void changeScreen(boolean fullScreen)
TODO: Figure out if this method can be fixed.


getBounds

public static java.awt.geom.Rectangle2D getBounds()