Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.
/ GIGHM Public archive

A Java game engine built using GLFW that supports both 2D and 3D rendering.

License

Notifications You must be signed in to change notification settings

Kale-Ko/GIGHM

Repository files navigation

GIGHM

GIGHM is a Java game engine built using GLFW that supports both 2D and 3D rendering.

Features

  • Rendering scenes that contain game objects with custom transforms, meshes, and textures.
  • Loading custom meshes and textures from file and creating custom skyboxes.
  • An event system that can catch keys and button presses, render events, and an input system that supports getting mouse position and keys down.
  • An extendable component system for more easily writing custom logic for game objects with full documentation.

Setup

To get started you just need to add GIGHM as a dependency to your project.

Gradle

repositories {
    maven { url "https://jitpack.io" }
}
dependencies {
    implementation "com.github.Kale-Ko:GIGHM:VERSION"
}

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.github.Kale-Ko</groupId>
    <artifactId>GIGHM</artifactId>
    <version>VERSION</version>
</dependency>

Usage

To create a simple scene you only need a few lines.

Scene scene = new Scene("Main"); // Create the main scene

GameObject cameraObject = new GameObject("Camera"); // Create the camera object
Camera camera = Camera.createOrthographic(width, height, farPlane); // Create the 2D camera component
// OR createPerspective(fov, (float) width / (float) height, nearPlane, farPlane) for 3D;
cameraObject.addComponent(camera); // Add the camera component to the camera object
scene.addObject(cameraObject); // Add the camera object into the scene

Shader shader = ShaderLoader.loadDefault(); // Load the default shader
Renderer renderer = new Renderer(scene, camera, shader, new Color(50, 50, 200)); // Create the renderer with the scene, camera, shader, and a sky color

Window window = new Window(renderer, "GIGHM - Simple Demo", width, height); // Create the window with the render

window.setTitle("Demo!"); // Change the window title once it is created

For the complete example see here.

For a simple game example see here.

For more info on the usage of the api see the Javadocs.