5

GAME ENVIRONMENT

Golden T Game Engine supports three game environment:

  1. Fullscreen Exclusive Mode
  2. To create a full blown game. (Windows OS only)
  3. Windowed Mode
  4. Generally used only in development stage or to create a simple game.
  5. Applet Mode
  6. Perfect for direct view in your website, usually for demo test.

SETTING UP GAME ENVIRONMENT

All the environments are setup in one step:

   Game.setup (Dimension d, boolean fullscreen);
dimension: size of the game.
fullscreen: true for fullscreen exclusive mode / false for windowed mode.
Note: game environment must be the first to set after Game creation.

Example of setting up game environment (Tutorial2.java):

    import java.awt.*;
    import com.golden.gamedev.*;

    public class Tutorial2 extends Game {

        public void initResources() { }
        public void update() { }
        public void render(Graphics2D g) { }


        public static void main(String[] args) {
            // random windowed/fullscreen mode
            boolean fullscreen = (new java.util.Random()).nextBoolean();

            Game game = new Tutorial2();   // create the game
            game.setup (new Dimension(640, 480), fullscreen);
            game.start();                  // start the game
        }

    }

To run this example java -classpath %CLASSPATH%;golden_0_1_2.jar Tutorial2 (see page 2)
The game will running in random environment, Fullscreen or Windowed mode.
For Applet mode, embed Tutorial2.class into your HTML page (like below), and that what Applet is.

   <html>
   <applet code="Tutorial2.class"
           archive="golden_0_1.jar"
           width="640" height="480">
   </applet>
   </html>

Allright, you should've understand the basic settings
    Now let's see how to create a game along with Game class.....

1 2 3 4 5 6 7
<< Previous Page Next Page >>