Skip to content

Commit 06989d8

Browse files
committed
feat(): add initial project files
1 parent 78ab2a0 commit 06989d8

File tree

12 files changed

+554
-5
lines changed

12 files changed

+554
-5
lines changed

.gitignore

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,42 @@
1-
# Compiled class file
1+
## Java
22
*.class
3+
*.war
4+
*.ear
5+
hs_err_pid*
6+
7+
## Robovm
8+
/ios/robovm-build/
9+
10+
## GWT
11+
/html/war/
12+
/html/gwt-unitCache/
13+
.apt_generated/
14+
.gwt/
15+
gwt-unitCache/
16+
www-test/
17+
.gwt-tmp/
18+
19+
## Android Studio and Intellij and Android in general
20+
/android/libs/armeabi-v7a/
21+
/android/libs/arm64-v8a/
22+
/android/libs/x86/
23+
/android/libs/x86_64/
24+
/android/gen/
25+
.idea/
26+
*.ipr
27+
*.iws
28+
*.iml
29+
/android/out/
30+
com_crashlytics_export_strings.xml
31+
32+
## Gradle
33+
/local.properties
34+
.gradle/
35+
gradle-app.setting
36+
37+
## OS Specific
38+
.DS_Store
39+
Thumbs.db
340

441
# Log file
542
*.log
@@ -12,13 +49,13 @@
1249

1350
# Package Files #
1451
*.jar
15-
*.war
1652
*.nar
17-
*.ear
1853
*.zip
1954
*.tar.gz
2055
*.rar
2156

2257
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23-
hs_err_pid*
2458
replay_pid*
59+
60+
build/
61+
gradle/

README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/badlogic.jpg

66.9 KB
Loading

build.gradle

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
buildscript {
2+
3+
4+
repositories {
5+
mavenLocal()
6+
mavenCentral()
7+
gradlePluginPortal()
8+
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
9+
google()
10+
}
11+
dependencies {
12+
13+
14+
}
15+
}
16+
17+
allprojects {
18+
apply plugin: "eclipse"
19+
20+
version = '1.0'
21+
ext {
22+
appName = "My GDX Game"
23+
gdxVersion = '1.12.1'
24+
roboVMVersion = '2.3.20'
25+
box2DLightsVersion = '1.5'
26+
ashleyVersion = '1.7.4'
27+
aiVersion = '1.8.2'
28+
gdxControllersVersion = '2.2.1'
29+
}
30+
31+
repositories {
32+
mavenLocal()
33+
mavenCentral()
34+
google()
35+
gradlePluginPortal()
36+
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
37+
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
38+
maven { url "https://jitpack.io" }
39+
}
40+
}
41+
42+
project(":desktop") {
43+
apply plugin: "java-library"
44+
45+
46+
dependencies {
47+
implementation project(":core")
48+
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
49+
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
50+
51+
}
52+
}
53+
54+
project(":core") {
55+
apply plugin: "java-library"
56+
57+
58+
dependencies {
59+
api "com.badlogicgames.gdx:gdx:$gdxVersion"
60+
61+
}
62+
}

core/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sourceCompatibility = 1.8
2+
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
3+
4+
sourceSets.main.java.srcDirs = [ "src/" ]
5+
6+
eclipse.project.name = appName + "-core"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.mygdx.game;
2+
3+
import com.badlogic.gdx.ApplicationAdapter;
4+
import com.badlogic.gdx.graphics.Texture;
5+
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
6+
import com.badlogic.gdx.utils.ScreenUtils;
7+
8+
public class MyGdxGame extends ApplicationAdapter {
9+
SpriteBatch batch;
10+
Texture img;
11+
12+
@Override
13+
public void create () {
14+
batch = new SpriteBatch();
15+
img = new Texture("badlogic.jpg");
16+
}
17+
18+
@Override
19+
public void render () {
20+
ScreenUtils.clear(0, 0, 1, 1);
21+
batch.begin();
22+
batch.draw(img, 0, 0);
23+
batch.end();
24+
}
25+
26+
@Override
27+
public void dispose () {
28+
batch.dispose();
29+
img.dispose();
30+
}
31+
}

desktop/build.gradle

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
sourceCompatibility = 1.8
2+
sourceSets.main.java.srcDirs = [ "src/" ]
3+
sourceSets.main.resources.srcDirs = ["../assets"]
4+
5+
project.ext.mainClassName = "com.mygdx.game.DesktopLauncher"
6+
project.ext.assetsDir = new File("../assets")
7+
8+
import org.gradle.internal.os.OperatingSystem
9+
10+
tasks.register('run', JavaExec) {
11+
dependsOn classes
12+
mainClass = project.mainClassName
13+
classpath = sourceSets.main.runtimeClasspath
14+
standardInput = System.in
15+
workingDir = project.assetsDir
16+
ignoreExitValue = true
17+
18+
if (OperatingSystem.current() == OperatingSystem.MAC_OS) {
19+
// Required to run on macOS
20+
jvmArgs += "-XstartOnFirstThread"
21+
}
22+
}
23+
24+
tasks.register('debug', JavaExec) {
25+
dependsOn classes
26+
mainClass = project.mainClassName
27+
classpath = sourceSets.main.runtimeClasspath
28+
standardInput = System.in
29+
workingDir = project.assetsDir
30+
ignoreExitValue = true
31+
debug = true
32+
}
33+
34+
tasks.register('dist', Jar) {
35+
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
36+
manifest {
37+
attributes 'Main-Class': project.mainClassName
38+
}
39+
dependsOn configurations.runtimeClasspath
40+
from {
41+
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
42+
}
43+
with jar
44+
}
45+
46+
47+
dist.dependsOn classes
48+
49+
eclipse.project.name = appName + "-desktop"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.mygdx.game;
2+
3+
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
4+
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
5+
import com.mygdx.game.MyGdxGame;
6+
7+
// Please note that on macOS your application needs to be started with the -XstartOnFirstThread JVM argument
8+
public class DesktopLauncher {
9+
10+
public static void main (String[] arg) {
11+
12+
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
13+
14+
config.setForegroundFPS(60);
15+
config.setTitle("simple GDX game");
16+
17+
new Lwjgl3Application(new MyGdxGame(), config);
18+
}
19+
}

gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
org.gradle.daemon=true
2+
org.gradle.jvmargs=-Xms128m -Xmx1500m
3+
org.gradle.configureondemand=false
4+
android.enableR8.fullMode=false

0 commit comments

Comments
 (0)