Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.rico.engine.game
Interface GameIface

All Superinterfaces:
  java.util.EventListener, javax.media.opengl.GLEventListener

All Known Implementing Classes:
  AbstractBaseGame, Adventure, WorldEditor

    public interface GameIface

extends javax.media.opengl.GLEventListener

This interface needs to be implemented by any abstract game class which is a base class for a concrete game.

Author:
  Frank Bruns

Method Summary
`void` | `draw(javax.media.opengl.GL gl)` This method is used to draw the scene and its content.
`void` | `enableBackFaceCulling()` Enables back face culling for a (possibly) slight performance boost.
`javax.swing.JFrame` | `getMainFrame()` Returns the main window (main frame) of the game
`javax.media.opengl.GLCanvas` | `getOGLCanvas()` Returns the component that is the OpenGL canvas.
`void` | `initCamera(float camX, float camY, float camZ, float rotX, float rotY, float near, float far)` This method needs to be called before the start() method.
`void` | `initResources(javax.media.opengl.GLDrawable gld, javax.media.opengl.GL gl, int width, int height)` This method is used to initialize all the objects and resources that are neccessary at startup of the game.
`boolean` | `isSetDisplayFPS()` Determines whether or not the framerate is set to be displayed on screen.
`void` | `resetElapsedTime()` Resets the calculation of the elapsed time between two frames.
`void` | `setDisplayFPS(boolean enable)` Sets whethter or not the framerate (frames per second) ought to be displayed.
`void` | `setDisplayMode(EngineDisplayMode mode)` Sets the display mode of the game window.
`void` | `start(GameIface game)` Call this method to start the game after every other method that influences the game startup has been called.
`void` | `stop()` This method is used to savely stop the game.
`void` | `update(long elapsedTime)` This method is used to update the scene and its content.

Methods inherited from interface javax.media.opengl.GLEventListener
`display, displayChanged, init, reshape`

Method Detail

### getOGLCanvas

    javax.media.opengl.GLCanvas getOGLCanvas()

  Returns the component that is the OpenGL canvas. This is the canvas that is rendered to.

  Returns:
    GLCanvas object

### getMainFrame

    javax.swing.JFrame getMainFrame()

  Returns the main window (main frame) of the game

  Returns:
    main frame of the game

### setDisplayMode

    void setDisplayMode(EngineDisplayMode mode)

  Sets the display mode of the game window. You can retrieve the display mode by a call to ScreenResSelector.showSelectionDialog(). A JDialog opens and shows a list of possible display modes. The dialog blocks the application until a mode has been selected and returns the according EngineDisplayMode object.

  Parameters:
    `mode` - display mode

### setDisplayFPS

    void setDisplayFPS(boolean enable)

  Sets whethter or not the framerate (frames per second) ought to be displayed.

  Parameters:
    `enable` - display fps --> true=yes, false=no

### isSetDisplayFPS

    boolean isSetDisplayFPS()

  Determines whether or not the framerate is set to be displayed on screen.

  Returns:
    is framerate being displayed? --> true=yes, false=no

### enableBackFaceCulling

    void enableBackFaceCulling()

  Enables back face culling for a (possibly) slight performance boost.

### initCamera

    void initCamera(float camX,
                    float camY,
                    float camZ,
                    float rotX,
                    float rotY,
                    float near,
                    float far)

  This method needs to be called before the start() method.

  Parameters:
    `camX` - camera's x coordinate
    `camY` - camera's y coordinate
    `camZ` - camera's z coordinate
    `rotX` - camera's rotation around x axis (up/down)
    `rotY` - camera's rotation around y axis (left/right)
    `near` - near clipping plane distance
    `far` - far clipping plane distance

### initResources

    void initResources(javax.media.opengl.GLDrawable gld,
                       javax.media.opengl.GL gl,
                       int width,
                       int height)

  This method is used to initialize all the objects and resources that are neccessary at startup of the game. In your abstract game class you have to make this method abstract and call it in the init() method.

  Parameters:
    `gld` - GLDrawable object
    `gl` - GL object
    `width` - window width (important viewport initialisation)
    `height` - window height (important viewport initialisation)

### update

    void update(long elapsedTime)

  This method is used to update the scene and its content. In your abstract game class you have to make this method abstract and call it within JOGL's display() method. It significant to call this method before the draw() method that is specified in this interface, too to assure correct behaviour of the Monitor and Mirror classes.

  Parameters:
    `elapsedTime` - time between two frames

### draw

    void draw(javax.media.opengl.GL gl)

  This method is used to draw the scene and its content. In your abstract game class you will have to make this method abstract and call it in the display() method (after the update() method).

  Parameters:
    `gl` -

### start

    void start(GameIface game)

  Call this method to start the game after every other method that influences the game startup has been called.

  Parameters:
    `game` - game object

### stop

    void stop()

  This method is used to savely stop the game.

### resetElapsedTime

    void resetElapsedTime()

  Resets the calculation of the elapsed time between two frames.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD