Skip to content

Getting Started

Moncef Yabi edited this page Jul 20, 2020 · 23 revisions

Pre-Requirements

  • Java JDK
  • IntelliJ IDEA (community or Ultimate edition)

Project Setup

The easiest way to get started is to download a template project from the Ockero-Samples repository:

  • Download the project source code as a compressed file Ockero-Samples.zip
  • Extract the zip file
  • Open the extracted folder directly in the IntelliJ IDEA
  • Wait until the gradle build is finished

For Mac OS users: Mac OS requires the use of the JVM argument: -XstartOnFirstThread . In your IntelliJ Run/Debug configuration add -XstartOnFirstThread to the VM Options.

If you doesn't have IntelliJ IDEA ore Gradle

  • Do same as above but instead of using the IntelliJ IDEA run gradlew.bat or just gradlew located in the root Ockero folder.

Source folder structure

+- src
    -- main
       -- kotlin
          -- org.kotlin.samples
             -- app        // In the package **app** you can place your code
       -- resources
          -- sounds
          -- levels
          -- textures
    -- test

Dependencies

  • Lwjgl 3
  • JOML
  • Stb
  • JBox2D
  • Klaxon

Gradle configuration file:

You can use the following Gradle build script in your project to set up a Ockero project:

plugins {
    id 'org.jetbrains.kotlin.jvm' version '1.3.72'
}

group 'org.github.Ockerolabs'
version '1.0-SNAPSHOT'
project.ext.lwjglVersion = "3.2.3"
project.ext.jomlVersion = "1.9.24"
project.ext.OckeroVersion = "0.1.1.5"

repositories {
    mavenCentral()
    jcenter()
}

switch (org.gradle.internal.os.OperatingSystem.current()) {
    case org.gradle.internal.os.OperatingSystem.LINUX:
        def osArch = System.getProperty("os.arch")
        project.ext.lwjglNatives = osArch.startsWith("arm") || osArch.startsWith("aarch64")
                ? "natives-linux-${osArch.contains("64") || osArch.startsWith("armv8") ? "arm64" : "arm32"}"
                : "natives-linux"
        break
    case org.gradle.internal.os.OperatingSystem.MAC_OS:
        project.ext.lwjglNatives = "natives-macos"
        break
    case org.gradle.internal.os.OperatingSystem.WINDOWS:
        project.ext.lwjglNatives = System.getProperty("os.arch").contains("64") ? "natives-windows" : "natives-windows-x86"
        break
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"

    //Lwjgl dependencies
    implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")
    implementation "org.lwjgl:lwjgl"
    implementation "org.lwjgl:lwjgl-assimp"
    implementation "org.lwjgl:lwjgl-glfw"
    implementation "org.lwjgl:lwjgl-openal"
    implementation "org.lwjgl:lwjgl-opengl"
    implementation "org.lwjgl:lwjgl-stb"
    runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-assimp::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives"
    implementation "org.joml:joml:${jomlVersion}"

    //Ockero dependencies
    implementation "com.github.Ockerolabs:Ockero-jvm:$OckeroVersion"
    implementation 'org.jbox2d:jbox2d-library:2.2.1.1'


    implementation 'com.beust:klaxon:5.2'
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

Table of Contents

  1. Getting Started
  2. Create a simple game
TODO
Clone this wiki locally