org.newdawn.slick
Class AppletGameContainer.Container

java.lang.Object
  extended by org.newdawn.slick.GameContainer
      extended by org.newdawn.slick.AppletGameContainer.Container
All Implemented Interfaces:
GUIContext
Enclosing class:
AppletGameContainer

public class AppletGameContainer.Container
extends GameContainer

A game container to provide the applet context

Author:
kevin

Field Summary
 
Fields inherited from class org.newdawn.slick.GameContainer
alwaysRender, clearEachFrame, forceExit, fps, game, GL, height, input, lastFPS, lastFrame, lastGame, maximumLogicInterval, minimumLogicInterval, paused, recordedFPS, running, samples, SHARED_DRAWABLE, smoothDeltas, stencil, storedDelta, supportsMultiSample, targetFPS, vsync, width
 
Constructor Summary
AppletGameContainer.Container(Game game)
          Create a new container wrapped round the game
 
Method Summary
 java.applet.Applet getApplet()
          Returns the Applet Object
 int getScreenHeight()
          Get the height of the standard screen resolution
 int getScreenWidth()
          Get the width of the standard screen resolution
 boolean hasFocus()
          Check if the game currently has focus
 void initApplet()
          Initiliase based on Applet init
 boolean isFullscreen()
          Check if the display is in fullscreen mode
 boolean isMouseGrabbed()
          Check if the mouse cursor is current grabbed.
 boolean isRunning()
          Check if the applet is currently running
 void runloop()
          The running game loop
 void setDefaultMouseCursor()
          Set the default mouse cursor - i.e.
 void setFullscreen(boolean fullscreen)
          Indicate whether we want to be in fullscreen mode.
 void setIcon(java.lang.String ref)
          Set the icon to be displayed if possible in this type of container
 void setIcons(java.lang.String[] refs)
          Set the icons to be used for this application.
 void setMouseCursor(org.lwjgl.input.Cursor cursor, int hotSpotX, int hotSpotY)
          Set the mouse cursor to be displayed - this is a hardware cursor and hence shouldn't have any impact on FPS.
 void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY)
          Set the mouse cursor to be displayed - this is a hardware cursor and hence shouldn't have any impact on FPS.
 void setMouseCursor(Image image, int hotSpotX, int hotSpotY)
          Set the mouse cursor based on the contents of the image.
 void setMouseCursor(java.lang.String ref, int hotSpotX, int hotSpotY)
          Set the mouse cursor to be displayed - this is a hardware cursor and hence shouldn't have any impact on FPS.
 void setMouseGrabbed(boolean grabbed)
          Indicate whether mouse cursor should be grabbed or not
 void stopApplet()
          Stop the applet play back
 boolean supportsAlphaInBackBuffer()
          Check if the display created supported alpha in the back buffer
 
Methods inherited from class org.newdawn.slick.GameContainer
enableSharedContext, enableStencil, enterOrtho, enterOrtho, exit, getAlwaysRender, getAspectRatio, getBuildVersion, getDefaultFont, getDelta, getFPS, getGraphics, getHeight, getInput, getMusicVolume, getSamples, getSharedContext, getSoundVolume, getTime, getWidth, initGL, initSystem, isMusicOn, isPaused, isShowingFPS, isSoundOn, isUpdatingOnlyWhenVisible, isVSyncRequested, pause, reinit, resume, running, setAlwaysRender, setAnimatedMouseCursor, setClearEachFrame, setDefaultFont, setForceExit, setMaximumLogicUpdateInterval, setMinimumLogicUpdateInterval, setMultiSample, setMusicOn, setMusicVolume, setPaused, setShowFPS, setSmoothDeltas, setSoundOn, setSoundVolume, setTargetFrameRate, setUpdateOnlyWhenVisible, setVerbose, setVSync, sleep, supportsMultiSample, updateAndRender, updateFPS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppletGameContainer.Container

public AppletGameContainer.Container(Game game)
Create a new container wrapped round the game

Parameters:
game - The game to be held in this container
Method Detail

initApplet

public void initApplet()
                throws SlickException
Initiliase based on Applet init

Throws:
SlickException - Indicates a failure to inialise the basic framework

isRunning

public boolean isRunning()
Check if the applet is currently running

Returns:
True if the applet is running

stopApplet

public void stopApplet()
Stop the applet play back


getScreenHeight

public int getScreenHeight()
Description copied from class: GameContainer
Get the height of the standard screen resolution

Specified by:
getScreenHeight in interface GUIContext
Specified by:
getScreenHeight in class GameContainer
Returns:
The screen height
See Also:
GameContainer.getScreenHeight()

getScreenWidth

public int getScreenWidth()
Description copied from class: GameContainer
Get the width of the standard screen resolution

Specified by:
getScreenWidth in interface GUIContext
Specified by:
getScreenWidth in class GameContainer
Returns:
The screen width
See Also:
GameContainer.getScreenWidth()

supportsAlphaInBackBuffer

public boolean supportsAlphaInBackBuffer()
Check if the display created supported alpha in the back buffer

Returns:
True if the back buffer supported alpha

hasFocus

public boolean hasFocus()
Description copied from class: GameContainer
Check if the game currently has focus

Specified by:
hasFocus in class GameContainer
Returns:
True if the game currently has focus
See Also:
GameContainer.hasFocus()

getApplet

public java.applet.Applet getApplet()
Returns the Applet Object

Returns:
Applet Object

setIcon

public void setIcon(java.lang.String ref)
             throws SlickException
Description copied from class: GameContainer
Set the icon to be displayed if possible in this type of container

Specified by:
setIcon in class GameContainer
Parameters:
ref - The reference to the icon to be displayed
Throws:
SlickException - Indicates a failure to load the icon
See Also:
GameContainer.setIcon(java.lang.String)

setMouseGrabbed

public void setMouseGrabbed(boolean grabbed)
Description copied from class: GameContainer
Indicate whether mouse cursor should be grabbed or not

Specified by:
setMouseGrabbed in class GameContainer
Parameters:
grabbed - True if mouse cursor should be grabbed
See Also:
GameContainer.setMouseGrabbed(boolean)

isMouseGrabbed

public boolean isMouseGrabbed()
Description copied from class: GameContainer
Check if the mouse cursor is current grabbed. This will cause it not to be seen.

Specified by:
isMouseGrabbed in class GameContainer
Returns:
True if the mouse is currently grabbed
See Also:
GameContainer.isMouseGrabbed()

setMouseCursor

public void setMouseCursor(java.lang.String ref,
                           int hotSpotX,
                           int hotSpotY)
                    throws SlickException
Description copied from class: GameContainer
Set the mouse cursor to be displayed - this is a hardware cursor and hence shouldn't have any impact on FPS.

Specified by:
setMouseCursor in interface GUIContext
Specified by:
setMouseCursor in class GameContainer
Parameters:
ref - The location of the image to be loaded for the cursor
hotSpotX - The x coordinate of the hotspot within the cursor image
hotSpotY - The y coordinate of the hotspot within the cursor image
Throws:
SlickException - Indicates a failure to load the cursor image or create the hardware cursor
See Also:
GameContainer.setMouseCursor(java.lang.String, int, int)

setMouseCursor

public void setMouseCursor(Image image,
                           int hotSpotX,
                           int hotSpotY)
                    throws SlickException
Set the mouse cursor based on the contents of the image. Note that this will not take account of render state type changes to images (rotation and such). If these effects are required it is recommended that an offscreen buffer be used to produce an appropriate image. An offscreen buffer will always be used to produce the new cursor and as such this operation an be very expensive

Specified by:
setMouseCursor in class GameContainer
Parameters:
image - The image to use as the cursor
hotSpotX - The x coordinate of the hotspot within the cursor image
hotSpotY - The y coordinate of the hotspot within the cursor image
Throws:
SlickException - Indicates a failure to load the cursor image or create the hardware cursor

setIcons

public void setIcons(java.lang.String[] refs)
              throws SlickException
Description copied from class: GameContainer
Set the icons to be used for this application. Note that the size of the icon defines how it will be used. Important ones to note Windows window icon must be 16x16 Windows alt-tab icon must be 24x24 or 32x32 depending on Windows version (XP=32)

Specified by:
setIcons in class GameContainer
Parameters:
refs - The reference to the icon to be displayed
Throws:
SlickException - Indicates a failure to load the icon
See Also:
GameContainer.setIcons(java.lang.String[])

setMouseCursor

public void setMouseCursor(ImageData data,
                           int hotSpotX,
                           int hotSpotY)
                    throws SlickException
Description copied from class: GameContainer
Set the mouse cursor to be displayed - this is a hardware cursor and hence shouldn't have any impact on FPS.

Specified by:
setMouseCursor in interface GUIContext
Specified by:
setMouseCursor in class GameContainer
Parameters:
data - The image data from which the cursor can be construted
hotSpotX - The x coordinate of the hotspot within the cursor image
hotSpotY - The y coordinate of the hotspot within the cursor image
Throws:
SlickException - Indicates a failure to load the cursor image or create the hardware cursor
See Also:
GameContainer.setMouseCursor(org.newdawn.slick.opengl.ImageData, int, int)

setMouseCursor

public void setMouseCursor(org.lwjgl.input.Cursor cursor,
                           int hotSpotX,
                           int hotSpotY)
                    throws SlickException
Description copied from class: GameContainer
Set the mouse cursor to be displayed - this is a hardware cursor and hence shouldn't have any impact on FPS.

Specified by:
setMouseCursor in interface GUIContext
Specified by:
setMouseCursor in class GameContainer
Parameters:
cursor - The cursor to use
hotSpotX - The x coordinate of the hotspot within the cursor image
hotSpotY - The y coordinate of the hotspot within the cursor image
Throws:
SlickException - Indicates a failure to load the cursor image or create the hardware cursor
See Also:
GameContainer.setMouseCursor(org.lwjgl.input.Cursor, int, int)

setDefaultMouseCursor

public void setDefaultMouseCursor()
Description copied from class: GameContainer
Set the default mouse cursor - i.e. the original cursor before any native cursor was set

Specified by:
setDefaultMouseCursor in interface GUIContext
Specified by:
setDefaultMouseCursor in class GameContainer
See Also:
GameContainer.setDefaultMouseCursor()

isFullscreen

public boolean isFullscreen()
Description copied from class: GameContainer
Check if the display is in fullscreen mode

Overrides:
isFullscreen in class GameContainer
Returns:
True if the display is in fullscreen mode

setFullscreen

public void setFullscreen(boolean fullscreen)
                   throws SlickException
Description copied from class: GameContainer
Indicate whether we want to be in fullscreen mode. Note that the current display mode must be valid as a fullscreen mode for this to work

Overrides:
setFullscreen in class GameContainer
Parameters:
fullscreen - True if we want to be in fullscreen mode
Throws:
SlickException - Indicates we failed to change the display mode

runloop

public void runloop()
             throws java.lang.Exception
The running game loop

Throws:
java.lang.Exception - Indicates a failure within the game's loop rather than the framework


Copyright © 2006 New Dawn Software. All Rights Reserved.