Skip to content

1 Getting Started

mat boi edited this page Oct 31, 2020 · 1 revision

How to start ?

to start things you must create a variable for the engine:

Engine engine = new Engine("Game Frame Title", 1000, 1000);

The first setting to set is the game frame title, the second and third settings are the width and the height.

Now to create a scene to the program to run on. You must create one variable the scene builder:

SceneBuilder sb = engine.getSceneBuilder();

We get the scene manager and the scene builder from the engine you just created.

Now you have to get the settings of the engine and set the settings for your game:

Parameters param = engine.getParameters();

and now we have a lot of settings that we can change:

param.setLimitFps(true);

active the fps limit that keep fps at the max to 60 fps

param.setLimitOverload(Parameters.RGE_OVERLOAD_MEDIUM);

you can set it to:

  • 'RGE_OVERLOAD_DISABLE': don't limit the cpu usage
  • 'RGE_OVERLOAD_LOW': don't limit a lot the cpu usage
  • 'RGE_OVERLOAD_MEDIUM': limit the cpu usage to a medium rate
  • 'RGE_OVERLOAD_HIGH': limit at the maximum the cpu usage
param.setAntiAliasing(true);

if you active the antiAliasing that smooth the shape of the texture

param.setQualityRendering(true);

if you set it on true the game will have a more advanced quality but a less performance but if you set it to false you will have more performance but you will have a less advanced quality

param.setCursor(Parameters.RGE_CURSOR_DEFAULT);

you can set it to:

  • 'RGE_CURSOR_DEFAULT': you have the OS base mouse cursor
  • 'RGE_HIDE_CURSOR' : will hide the cursor when he is in the frame
param.setClearBufferColor(new Color(69, 184, 198));

this setting set the background color.

Now that we have set the settings of our game you need to create the first scene in the exemple we will create two scene one for the splash screen and one for the game to create a scene you do:

Scene gameScene = sb.setName("game").build();
game.addGameObject(new InformationsPanel(engine), 1000);

so that will create a scene name game and build it into a scene variable and we add to it a info panel that will display the fps, the tick and the memory usage of the game now we will create the splash screen

SplashScreen splashScreen = new SplashScreen(engine, new ImageBuilder("put here the image path from your src folder").build(), Color.BLACK, gameScene);
splashScreen.setSize(512, 512);

this will create a splash screen and set it size to 512*512 and set the next scene after it to gameScene and now we create a scene to the splash screen

Scene splashScreenScene = sb.setName("splashScreen").build();
splashScreenScene.addGameObject(splashScreen, 0);

and with that we create the scene for the splash screen now we must add the scene to the frame of the game

SceneManager.addScene(splashScreenScene);

that will add the scene to the screen and now you just need to init the engine by doing

engine.init();

and that working you have now a basic game

Clone this wiki locally