com.b3dgs.lionengine.core
Class Screen

java.lang.Object
  extended by com.b3dgs.lionengine.core.Screen

public class Screen
extends java.lang.Object

Representation of the screen device, supporting fullscreen and windowed mode. Screen class uses a double buffer for any rendering. It also includes a mouse and a keyboard listener.

See Also:
Keyboard, Mouse

Field Summary
 java.awt.GraphicsConfiguration conf
          Graphic configuration reference.
 Config config
          Configuration reference.
 java.awt.GraphicsDevice dev
          Graphics device reference.
 Display display
          Display reference.
 java.awt.GraphicsEnvironment env
          Graphic environment reference.
 Initializer init
          Initializer reference.
 
Constructor Summary
Screen(Initializer init, Config config)
          Create a new screen.
 
Method Summary
 void addKeyboard(Keyboard keyboard)
          Link keyboard to the screen (listening to).
 void addMouse(Mouse mouse)
          Link keyboard to the screen (listening to).
 void dispose()
          Close main frame.
 java.awt.image.BufferStrategy getBufferStrategy()
          Get current graphic buffer.
 javax.swing.JFrame getFrame()
          Get frame container reference.
 java.awt.Graphics2D getGraphics2D()
          Get current graphics output (from buffer strategy).
 int getLocationX()
          Get main frame location x.
 int getLocationY()
          Get main frame location y.
 boolean getWide()
          Check wide screen state.
 void hideCursor()
          Hide window mouse pointer.
 void requestFocus()
          Give focus to screen.
 void setIcon(java.lang.String filename)
          Set window icon from file.
 void setLauncher(AbstractLauncher launcher)
          Set launcher reference.
 void showCursor()
          Show window mouse pointer.
 void update()
          Must be called when all rendering are done.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

env

public final java.awt.GraphicsEnvironment env
Graphic environment reference.


dev

public final java.awt.GraphicsDevice dev
Graphics device reference.


conf

public final java.awt.GraphicsConfiguration conf
Graphic configuration reference.


init

public final Initializer init
Initializer reference.


display

public final Display display
Display reference.


config

public final Config config
Configuration reference.

Constructor Detail

Screen

public Screen(Initializer init,
              Config config)
Create a new screen.

Parameters:
init - initializer reference.
config - config reference.
Method Detail

setLauncher

public void setLauncher(AbstractLauncher launcher)
Set launcher reference. Called when frame is closing.

Parameters:
launcher - launcher reference.

update

public void update()
Must be called when all rendering are done. It switchs buffers before rendering.


dispose

public void dispose()
Close main frame. Dispose all graphics ressources.


addKeyboard

public void addKeyboard(Keyboard keyboard)
Link keyboard to the screen (listening to).

Parameters:
keyboard - keyboard reference.

addMouse

public void addMouse(Mouse mouse)
Link keyboard to the screen (listening to).

Parameters:
mouse - mouse reference.

getBufferStrategy

public java.awt.image.BufferStrategy getBufferStrategy()
Get current graphic buffer.

Returns:
graphic buffer reference.

getGraphics2D

public java.awt.Graphics2D getGraphics2D()
Get current graphics output (from buffer strategy).

Returns:
current graphics output (from buffer strategy).

getFrame

public javax.swing.JFrame getFrame()
Get frame container reference.

Returns:
frame reference.

getWide

public boolean getWide()
Check wide screen state.

Returns:
true if screen is wide (16/9, 16/10).

getLocationX

public int getLocationX()
Get main frame location x.

Returns:
main frame location x.

getLocationY

public int getLocationY()
Get main frame location y.

Returns:
main frame location y.

hideCursor

public void hideCursor()
Hide window mouse pointer.


showCursor

public void showCursor()
Show window mouse pointer.


setIcon

public void setIcon(java.lang.String filename)
Set window icon from file.

Parameters:
filename - icon file name.

requestFocus

public void requestFocus()
Give focus to screen.