-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the PJGL wiki!
Look at Getting Started and enjoy your stay here.
Main api methods are placed in PJGL
class. This class provides you way to configure the library, request some data and run it. There is also class PJGLEvents
which contains events that you can 'listen' to. Upon listening to events you can modify behaviour, register things, and more in the correct time. There are also PJGLRegistries
where you can register object managers or modules.
First you'll start with creating class that extends GameApplication
import com.panjohnny.pjgl.api.GameApplication;
import com.panjohnny.pjgl.api.event.OperationInterceptor;
import com.panjohnny.pjgl.core.rendering.GLFWWindow;
public class HelloWorld extends GameApplication {
/**
* Method where everything should be initialized and your data loaded. Called before {@link #modifyWindow(GLFWWindow)}
*
* @apiNote Beware that you should not do any GL operations here. That includes loading models and shaders!
*/
@Override
public void init() {
System.out.println("Hello PJGL World!");
}
// other methods
...
}
This GameApplication actually hooks you directly into the api. The init function is called before window is visible and graphics are not initialized so it should be used with caution. Now we need to register our application and run the game.
public static void main(String[] args) {
PJGL.registerApplication(new HelloWorld());
PJGL.run();
}
This would hook up our app with the api and run the game. You should see Hello PJGL World
pop up and window open, that means you created your first program.