Skip to content

Commit f29ddc7

Browse files
authored
Merge pull request #17964 from Michaelin007/libgdx
https://jira.baeldung.com/browse/BAEL-8594
2 parents 4f24d34 + 4f31d4b commit f29ddc7

File tree

21 files changed

+1012
-0
lines changed

21 files changed

+1012
-0
lines changed
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.{java,scala,groovy,kt,kts}]
12+
indent_size = 4
13+
14+
[*.gradle]
15+
indent_size = 2
16+
17+
[*.md]
18+
trim_trailing_whitespace = false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* text=auto eol=lf
2+
*.bat text=auto eol=crlf
+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
## Gradle:
2+
.gradle/
3+
gradle-app.setting
4+
/gradle/gradle-daemon-jvm.properties
5+
/build/
6+
/android/build/
7+
/core/build/
8+
/lwjgl2/build/
9+
/lwjgl3/build/
10+
/html/build/
11+
/teavm/build/
12+
/ios/build/
13+
/ios-moe/build/
14+
/headless/build/
15+
/server/build/
16+
/shared/build/
17+
18+
## Java:
19+
*.class
20+
*.war
21+
*.ear
22+
hs_err_pid*
23+
.attach_pid*
24+
25+
## Android:
26+
/android/libs/armeabi-v7a/
27+
/android/libs/arm64-v8a/
28+
/android/libs/x86/
29+
/android/libs/x86_64/
30+
/android/gen/
31+
/android/out/
32+
local.properties
33+
com_crashlytics_export_strings.xml
34+
35+
## Robovm:
36+
/ios/robovm-build/
37+
38+
## iOS:
39+
/ios/xcode/*.xcodeproj/*
40+
!/ios/xcode/*.xcodeproj/xcshareddata
41+
!/ios/xcode/*.xcodeproj/project.pbxproj
42+
/ios/xcode/native/
43+
/ios/IOSLauncher.app
44+
/ios/IOSLauncher.app.dSYM
45+
46+
## GWT:
47+
/html/war/
48+
/html/gwt-unitCache/
49+
.apt_generated/
50+
/html/war/WEB-INF/deploy/
51+
/html/war/WEB-INF/classes/
52+
.gwt/
53+
gwt-unitCache/
54+
www-test/
55+
.gwt-tmp/
56+
57+
## TeaVM:
58+
# Not sure yet...
59+
60+
## IntelliJ, Android Studio:
61+
.idea/
62+
*.ipr
63+
*.iws
64+
*.iml
65+
66+
## Eclipse:
67+
.classpath
68+
.project
69+
.metadata/
70+
/android/bin/
71+
/core/bin/
72+
/lwjgl2/bin/
73+
/lwjgl3/bin/
74+
/html/bin/
75+
/teavm/bin/
76+
/ios/bin/
77+
/ios-moe/bin/
78+
/headless/bin/
79+
/server/bin/
80+
/shared/bin/
81+
*.tmp
82+
*.bak
83+
*.swp
84+
*~.nib
85+
.settings/
86+
.loadpath
87+
.externalToolBuilders/
88+
*.launch
89+
90+
91+
## NetBeans:
92+
93+
/nbproject/private/
94+
/android/nbproject/private/
95+
/core/nbproject/private/
96+
/lwjgl2/nbproject/private/
97+
/lwjgl3/nbproject/private/
98+
/html/nbproject/private/
99+
/teavm/nbproject/private/
100+
/ios/nbproject/private/
101+
/ios-moe/nbproject/private/
102+
/headless/nbproject/private/
103+
/server/nbproject/private/
104+
/shared/nbproject/private/
105+
106+
/nbbuild/
107+
/android/nbbuild/
108+
/core/nbbuild/
109+
/lwjgl2/nbbuild/
110+
/lwjgl3/nbbuild/
111+
/html/nbbuild/
112+
/teavm/nbbuild/
113+
/ios/nbbuild/
114+
/ios-moe/nbbuild/
115+
/headless/nbbuild/
116+
/server/nbbuild/
117+
/shared/nbbuild/
118+
119+
/dist/
120+
/android/dist/
121+
/core/dist/
122+
/lwjgl2/dist/
123+
/lwjgl3/dist/
124+
/html/dist/
125+
/teavm/dist/
126+
/ios/dist/
127+
/ios-moe/dist/
128+
/headless/dist/
129+
/server/dist/
130+
/shared/dist/
131+
132+
/nbdist/
133+
/android/nbdist/
134+
/core/nbdist/
135+
/lwjgl2/nbdist/
136+
/lwjgl3/nbdist/
137+
/html/nbdist/
138+
/teavm/nbdist/
139+
/ios/nbdist/
140+
/ios-moe/nbdist/
141+
/headless/nbdist/
142+
/server/nbdist/
143+
/shared/nbdist/
144+
145+
nbactions.xml
146+
nb-configuration.xml
147+
148+
## OS-Specific:
149+
.DS_Store
150+
Thumbs.db
151+
152+
## Miscellaneous:
153+
*~
154+
*.*#
155+
*#*#
156+
/.kotlin/
157+
/assets/assets.txt
158+
159+
## Special cases:
160+
161+
## There is a resource-config.json file generated by nativeimage.gradle if you use Graal Native Image.
162+
## Some usage may need extra resource configuration in a different file with the same name.
163+
## You could also add that configuration to the text in nativeimage.gradle .
164+
## You should delete or comment out the next line if you have configuration in a different resource-config.json .
165+
**/resource-config.json
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# baeldung
2+
3+
A [libGDX](https://libgdx.com/) project generated with [gdx-liftoff](https://github.com/libgdx/gdx-liftoff).
4+
5+
This project was generated with a template including simple application launchers and an `ApplicationAdapter` extension that draws libGDX logo.
6+
7+
## Platforms
8+
9+
- `core`: Main module with the application logic shared by all platforms.
10+
- `html`: Web platform using GWT and WebGL. Supports only Java projects.
11+
12+
## Gradle
13+
14+
This project uses [Gradle](https://gradle.org/) to manage dependencies.
15+
The Gradle wrapper was included, so you can run Gradle tasks using `gradlew.bat` or `./gradlew` commands.
16+
Useful Gradle tasks and flags:
17+
18+
- `--continue`: when using this flag, errors will not stop the tasks from running.
19+
- `--daemon`: thanks to this flag, Gradle daemon will be used to run chosen tasks.
20+
- `--offline`: when using this flag, cached dependency archives will be used.
21+
- `--refresh-dependencies`: this flag forces validation of all dependencies. Useful for snapshot versions.
22+
- `build`: builds sources and archives of every project.
23+
- `cleanEclipse`: removes Eclipse project data.
24+
- `cleanIdea`: removes IntelliJ project data.
25+
- `clean`: removes `build` folders, which store compiled classes and built archives.
26+
- `eclipse`: generates Eclipse project data.
27+
- `html:dist`: compiles GWT sources. The compiled application can be found at `html/build/dist`: you can use any HTTP server to deploy it.
28+
- `html:superDev`: compiles GWT sources and runs the application in SuperDev mode. It will be available at [localhost:8080/html](http://localhost:8080/html). Use only during development.
29+
- `idea`: generates IntelliJ project data.
30+
- `test`: runs unit tests (if any).
31+
32+
Note that most tasks that are not specific to a single project can be run with `name:` prefix, where the `name` should be replaced with the ID of a specific project.
33+
For example, `core:clean` removes `build` folder only from the `core` project.
2.4 KB
Loading
+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
maven { url 'https://s01.oss.sonatype.org' }
5+
gradlePluginPortal()
6+
mavenLocal()
7+
google()
8+
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
9+
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
10+
}
11+
dependencies {
12+
13+
14+
}
15+
}
16+
17+
allprojects {
18+
apply plugin: 'eclipse'
19+
apply plugin: 'idea'
20+
21+
// This allows you to "Build and run using IntelliJ IDEA", an option in IDEA's Settings.
22+
idea {
23+
module {
24+
outputDir file('build/classes/java/main')
25+
testOutputDir file('build/classes/java/test')
26+
}
27+
}
28+
}
29+
30+
configure(subprojects) {
31+
apply plugin: 'java-library'
32+
sourceCompatibility = 11
33+
34+
// From https://lyze.dev/2021/04/29/libGDX-Internal-Assets-List/
35+
// The article can be helpful when using assets.txt in your project.
36+
tasks.register('generateAssetList') {
37+
inputs.dir("${project.rootDir}/assets/")
38+
// projectFolder/assets
39+
File assetsFolder = new File("${project.rootDir}/assets/")
40+
// projectFolder/assets/assets.txt
41+
File assetsFile = new File(assetsFolder, "assets.txt")
42+
// delete that file in case we've already created it
43+
assetsFile.delete()
44+
45+
// iterate through all files inside that folder
46+
// convert it to a relative path
47+
// and append it to the file assets.txt
48+
fileTree(assetsFolder).collect { assetsFolder.relativePath(it) }.sort().each {
49+
assetsFile.append(it + "\n")
50+
}
51+
}
52+
processResources.dependsOn 'generateAssetList'
53+
54+
compileJava {
55+
options.incremental = true
56+
}
57+
}
58+
59+
subprojects {
60+
version = '$projectVersion'
61+
ext.appName = 'baeldung'
62+
repositories {
63+
mavenCentral()
64+
maven { url 'https://s01.oss.sonatype.org' }
65+
// You may want to remove the following line if you have errors downloading dependencies.
66+
mavenLocal()
67+
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
68+
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
69+
maven { url 'https://jitpack.io' }
70+
}
71+
}
72+
73+
eclipse.project.name = 'baeldung' + '-parent'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
2+
eclipse.project.name = appName + '-core'
3+
4+
def enableGraalNative = project.hasProperty('enableGraalNative') ? project.property('enableGraalNative') : 'false'
5+
6+
dependencies {
7+
api "com.badlogicgames.gdx:gdx:$gdxVersion"
8+
9+
if(enableGraalNative == 'true') {
10+
implementation "io.github.berstanio:gdx-svmhelper-annotations:$graalHelperVersion"
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.11.0//EN" "https://www.gwtproject.org/doctype/2.11.0/gwt-module.dtd">
3+
<module>
4+
<!-- Paths to source are relative to this file and separated by slashes ('/'). -->
5+
<source path="" />
6+
<!-- Reflection includes may be needed for your code or library code. Each value is separated by periods ('.'). -->
7+
<!-- You can include a full package by not including the name of a type at the end. -->
8+
9+
</module>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.baeldung.game;
2+
3+
import com.badlogic.gdx.ApplicationAdapter;
4+
import com.badlogic.gdx.Gdx;
5+
import com.badlogic.gdx.graphics.GL20;
6+
import com.badlogic.gdx.graphics.Texture;
7+
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
8+
import com.badlogic.gdx.utils.ScreenUtils;
9+
10+
/** {@link com.badlogic.gdx.ApplicationListener} implementation shared by all platforms. */
11+
public class Main extends ApplicationAdapter {
12+
private SpriteBatch batch;
13+
private Texture image;
14+
15+
@Override
16+
public void create() {
17+
batch = new SpriteBatch();
18+
image = new Texture("libgdx.png");
19+
}
20+
21+
@Override
22+
public void render() {
23+
ScreenUtils.clear(0.15f, 0.15f, 0.2f, 1f);
24+
batch.begin();
25+
batch.draw(image, 140, 210);
26+
batch.end();
27+
}
28+
29+
@Override
30+
public void dispose() {
31+
batch.dispose();
32+
image.dispose();
33+
}
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
org.gradle.daemon=false
2+
org.gradle.jvmargs=-Xms512M -Xmx1G -Dfile.encoding=UTF-8 -Dconsole.encoding=UTF-8
3+
org.gradle.configureondemand=false
4+
gwtFrameworkVersion=2.11.0
5+
gwtPluginVersion=1.1.29
6+
gdxVersion=1.12.1
7+
projectVersion=1.0.0

0 commit comments

Comments
 (0)