consolidate all repos to one for archive

This commit is contained in:
2025-01-28 13:46:42 +01:00
commit a6610fbc7a
5350 changed files with 2705721 additions and 0 deletions

View File

@@ -0,0 +1,109 @@
## Java
*.class
*.war
*.ear
hs_err_pid*
## Robovm
/ios/robovm-build/
## GWT
/html/war/
/html/gwt-unitCache/
.apt_generated/
.gwt/
gwt-unitCache/
www-test/
.gwt-tmp/
## Android Studio and Intellij and Android in general
/android/libs/armeabi-v7a/
/android/libs/arm64-v8a/
/android/libs/x86/
/android/libs/x86_64/
/android/gen/
.idea/
*.ipr
*.iws
*.iml
/android/out/
com_crashlytics_export_strings.xml
## Eclipse
.classpath
.project
.metadata/
/android/bin/
/core/bin/
/desktop/bin/
/html/bin/
/ios/bin/
*.tmp
*.bak
*.swp
*~.nib
.settings/
.loadpath
.externalToolBuilders/
*.launch
## NetBeans
/nbproject/private/
/android/nbproject/private/
/core/nbproject/private/
/desktop/nbproject/private/
/html/nbproject/private/
/ios/nbproject/private/
/build/
/android/build/
/core/build/
/desktop/build/
/html/build/
/ios/build/
/nbbuild/
/android/nbbuild/
/core/nbbuild/
/desktop/nbbuild/
/html/nbbuild/
/ios/nbbuild/
/dist/
/android/dist/
/core/dist/
/desktop/dist/
/html/dist/
/ios/dist/
/nbdist/
/android/nbdist/
/core/nbdist/
/desktop/nbdist/
/html/nbdist/
/ios/nbdist/
nbactions.xml
nb-configuration.xml
## Gradle
/local.properties
.gradle/
gradle-app.setting
## OS Specific
.DS_Store
Thumbs.db
## iOS
/ios/xcode/*.xcodeproj/*
!/ios/xcode/*.xcodeproj/xcshareddata
!/ios/xcode/*.xcodeproj/project.pbxproj
/ios/xcode/native/
/ios/IOSLauncher.app
/ios/IOSLauncher.app.dSYM

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:isGame="true"
android:appCategory="game"
android:label="@string/app_name"
android:theme="@style/AppTheme"
tools:ignore="UnusedAttribute">
<activity
android:name="com.mygdx.game.AndroidLauncher"
android:screenOrientation="landscape"
android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize|screenLayout"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,95 @@
android {
namespace "com.mygdx.game"
buildToolsVersion "34.0.0"
compileSdkVersion 34
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['../assets']
jniLibs.srcDirs = ['libs']
}
}
packagingOptions {
resources {
excludes += ['META-INF/robovm/ios/robovm.xml']
}
}
defaultConfig {
applicationId "com.mygdx.game"
minSdkVersion 14
targetSdkVersion 34
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
renderScript true
aidl true
}
}
// called every time gradle gets executed, takes the native dependencies of
// the natives configuration, and extracts them to the proper libs/ folders
// so they get packed with the APK.
tasks.register('copyAndroidNatives') {
doFirst {
file("libs/armeabi-v7a/").mkdirs()
file("libs/arm64-v8a/").mkdirs()
file("libs/x86_64/").mkdirs()
file("libs/x86/").mkdirs()
configurations.natives.copy().files.each { jar ->
def outputDir = null
if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
if (jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")
if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
if (outputDir != null) {
copy {
from zipTree(jar)
into outputDir
include "*.so"
}
}
}
}
}
tasks.matching { it.name.contains("merge") && it.name.contains("JniLibFolders") }.configureEach { packageTask ->
packageTask.dependsOn 'copyAndroidNatives'
}
tasks.register('run', Exec) {
def path
def localProperties = project.file("../local.properties")
if (localProperties.exists()) {
Properties properties = new Properties()
localProperties.withInputStream { instr ->
properties.load(instr)
}
def sdkDir = properties.getProperty('sdk.dir')
if (sdkDir) {
path = sdkDir
} else {
path = "$System.env.ANDROID_HOME"
}
} else {
path = "$System.env.ANDROID_HOME"
}
def adb = path + "/platform-tools/adb"
commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.mygdx.game/com.mygdx.game.AndroidLauncher'
}
eclipse.project.name = appName + "-android"

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,38 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-verbose
-dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication
# Required if using Gdx-Controllers extension
-keep class com.badlogic.gdx.controllers.android.AndroidControllers
# Required if using Box2D extension
-keepclassmembers class com.badlogic.gdx.physics.box2d.World {
boolean contactFilter(long, long);
void beginContact(long);
void endContact(long);
void preSolve(long, long);
void postSolve(long, long);
boolean reportFixture(long);
float reportRayFixture(long, float, float, float, float, float);
}

View File

@@ -0,0 +1,9 @@
# This file is used by the Eclipse ADT plugin. It is unnecessary for IDEA and Android Studio projects, which
# configure Proguard and the Android target via the build.gradle file.
# To enable ProGuard to work with Eclipse ADT, uncomment this (available properties: sdk.dir, user.home)
# and ensure proguard.jar in the Android SDK is up to date (or alternately reduce the android target to 23 or lower):
# proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-rules.pro
# Project target.
target=android-19

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon
xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_background_color"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -0,0 +1,40 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:pathData="M22,48.667l2.987,0l0,10.667l-2.987,0z"
android:fillColor="#000000"
android:strokeColor="#00000000"
android:fillAlpha="1"/>
<path
android:pathData="M26.907,52.72l2.987,0l0,6.613l-2.987,0z"
android:fillColor="#000000"
android:strokeColor="#00000000"
android:fillAlpha="1"/>
<path
android:pathData="M26.907,48.667l2.987,0l0,2.56l-2.987,0z"
android:fillColor="#000000"
android:strokeColor="#00000000"
android:fillAlpha="1"/>
<path
android:pathData="M31.813,48.667L31.813,52.72 31.813,55.067 31.813,56.767 31.813,59.333l2.992,0 2.117,0c1.654,0 2.998,-1.481 2.998,-3.307 0,-1.826 -1.344,-3.307 -2.998,-3.307l-2.117,0L34.805,48.667ZM34.805,55.067l1.269,0c0.469,0 0.848,0.384 0.848,0.853 0,0.469 -0.379,0.847 -0.848,0.847l-1.269,0z"
android:fillColor="#000000"
android:strokeColor="#00000000"
android:fillAlpha="1"/>
<path
android:pathData="m44.192,48.667c-1.65,0 -2.992,1.481 -2.992,3.307 0,0.023 -0,0.044 0,0.067 0,0.004 -0,0.009 0,0.013l0,3.893c-0.001,0.027 0,0.053 0,0.08 0,1.826 1.341,3.307 2.992,3.307l2.112,0 0.247,0 2.739,0 0.247,0 2.112,0c1.651,0 2.992,-1.481 2.992,-3.307 0,-1.826 -1.341,-3.307 -2.992,-3.307l-1.199,0 -0.48,0 -2.372,0l0,2.347l2.372,0 0.48,0 0.353,0c0.468,0 0.846,0.384 0.846,0.853 0,0.469 -0.378,0.847 -0.846,0.847l-0.833,0 -0.433,0 -0.247,0 -2.739,0 -0.247,0 -0.433,0 -0.833,0c-0.459,0 -0.832,-0.363 -0.846,-0.82l0,-3.893 0,-0.013c0.021,-0.45 0.391,-0.807 0.846,-0.807l0.833,0 0.433,0 1.293,0l0,0.007L54.207,51.24L54.207,48.667l-4.917,0 -1.692,0 -1.293,0 -2.112,0z"
android:fillColor="#e74a45"
android:strokeColor="#00000000"
android:fillAlpha="1"/>
<path
android:pathData="M56.133,48.667L56.133,51.238l5.406,0 1.859,0 1.105,0 0.43,0 0.827,0c0.452,0 0.82,0.356 0.84,0.806l0,0.013 0,3.891c-0.014,0.456 -0.384,0.819 -0.84,0.819l-0.827,0 -0.43,0 -1.899,0 -1.065,0 -2.442,0L59.098,52.724L56.133,52.724l0,4.044 0,1.752 0,0.813l5.406,0 1.065,0 1.899,0 2.098,0c1.639,0 2.971,-1.48 2.971,-3.305 0,-0.027 0.001,-0.053 0,-0.08L69.573,52.058c0,-0.004 -0,-0.009 0,-0.013 0,-0.022 0,-0.044 0,-0.067 0,-1.825 -1.332,-3.305 -2.971,-3.305l-2.098,0 -1.105,0l0,-0.007L56.133,48.667Z"
android:fillColor="#e74a45"
android:strokeColor="#00000000"
android:fillAlpha="1"/>
<path
android:pathData="M69.572,48.667L73.72,48.667L77.787,52.733 81.853,48.667l4.147,0l-5.333,5.333 5.333,5.333L81.853,59.333L77.787,55.267 73.72,59.333l-4.147,0l5.333,-5.333z"
android:fillColor="#e74a45"
android:strokeColor="#00000000"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen">
<item name="android:colorBackground">@color/ic_background_color</item>
</style>
</resources>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_background_color">#FFFFFFFF</color>
</resources>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">My GDX Game</string>
</resources>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar.Fullscreen">
<item name="android:windowBackground">@color/ic_background_color</item>
</style>
</resources>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!--
TODO: Use <include> and <exclude> to control what is backed up.
The domain can be file, database, sharedpref, external or root.
Examples:
<include domain="file" path="file_to_include"/>
<exclude domain="file" path="file_to_exclude"/>
<include domain="file" path="include_folder"/>
<exclude domain="file" path="include_folder/file_to_exclude"/>
<exclude domain="file" path="exclude_folder"/>
<include domain="file" path="exclude_folder/file_to_include"/>
<include domain="sharedpref" path="include_shared_pref1.xml"/>
<include domain="database" path="db_name/file_to_include"/>
<exclude domain="database" path="db_name/include_folder/file_to_exclude"/>
<include domain="external" path="file_to_include"/>
<exclude domain="external" path="file_to_exclude"/>
<include domain="root" path="file_to_include"/>
<exclude domain="root" path="file_to_exclude"/>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

View File

@@ -0,0 +1,15 @@
package com.mygdx.game;
import android.os.Bundle;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
public class AndroidLauncher extends AndroidApplication {
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
initialize(new MyGame(), config);
}
}

View File

@@ -0,0 +1,90 @@
chess.png
size: 1024, 64
format: RGBA8888
filter: Nearest, Nearest
repeat: none
bishop_b
rotate: false
xy: 2, 2
size: 45, 45
orig: 45, 45
offset: 0, 0
index: -1
bishop_w
rotate: false
xy: 49, 2
size: 45, 45
orig: 45, 45
offset: 0, 0
index: -1
king_b
rotate: false
xy: 96, 2
size: 45, 45
orig: 45, 45
offset: 0, 0
index: -1
king_w
rotate: false
xy: 143, 2
size: 45, 45
orig: 45, 45
offset: 0, 0
index: -1
knight_b
rotate: false
xy: 190, 2
size: 45, 45
orig: 45, 45
offset: 0, 0
index: -1
knight_w
rotate: false
xy: 237, 2
size: 45, 45
orig: 45, 45
offset: 0, 0
index: -1
pawn_b
rotate: false
xy: 284, 2
size: 45, 45
orig: 45, 45
offset: 0, 0
index: -1
pawn_w
rotate: false
xy: 331, 2
size: 45, 45
orig: 45, 45
offset: 0, 0
index: -1
queen_b
rotate: false
xy: 378, 2
size: 45, 45
orig: 45, 45
offset: 0, 0
index: -1
queen_w
rotate: false
xy: 425, 2
size: 45, 45
orig: 45, 45
offset: 0, 0
index: -1
rook_b
rotate: false
xy: 472, 2
size: 45, 45
orig: 45, 45
offset: 0, 0
index: -1
rook_w
rotate: false
xy: 519, 2
size: 45, 45
orig: 45, 45
offset: 0, 0
index: -1

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -0,0 +1,101 @@
info face="Commodore 64 Pixelized" size=20 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=1,1,1,1 spacing=-2,-2
common lineHeight=20 base=18 scaleW=512 scaleH=64 pages=1 packed=0
page id=0 file="commodore-64.png"
chars count=96
char id=10 x=0 y=0 width=0 height=0 xoffset=0 yoffset=0 xadvance=0 page=0 chnl=0
char id=32 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=17 xadvance=16 page=0 chnl=0
char id=33 x=502 y=0 width=6 height=16 xoffset=5 yoffset=3 xadvance=16 page=0 chnl=0
char id=34 x=188 y=34 width=14 height=6 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=35 x=248 y=18 width=18 height=16 xoffset=-1 yoffset=3 xadvance=16 page=0 chnl=0
char id=36 x=220 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=37 x=234 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=38 x=266 y=18 width=16 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=39 x=142 y=34 width=10 height=8 xoffset=5 yoffset=3 xadvance=16 page=0 chnl=0
char id=40 x=90 y=18 width=10 height=16 xoffset=3 yoffset=3 xadvance=16 page=0 chnl=0
char id=41 x=100 y=18 width=10 height=16 xoffset=3 yoffset=3 xadvance=16 page=0 chnl=0
char id=42 x=114 y=34 width=18 height=12 xoffset=-1 yoffset=5 xadvance=16 page=0 chnl=0
char id=43 x=100 y=34 width=14 height=12 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0
char id=44 x=152 y=34 width=8 height=8 xoffset=3 yoffset=13 xadvance=16 page=0 chnl=0
char id=45 x=208 y=34 width=14 height=4 xoffset=1 yoffset=9 xadvance=16 page=0 chnl=0
char id=46 x=202 y=34 width=6 height=6 xoffset=5 yoffset=13 xadvance=16 page=0 chnl=0
char id=47 x=392 y=18 width=16 height=14 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0
char id=48 x=56 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=49 x=430 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=50 x=444 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=51 x=458 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=52 x=472 y=0 width=16 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=53 x=488 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=54 x=0 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=55 x=14 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=56 x=28 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=57 x=42 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=58 x=84 y=18 width=6 height=16 xoffset=5 yoffset=3 xadvance=16 page=0 chnl=0
char id=59 x=0 y=0 width=8 height=18 xoffset=3 yoffset=3 xadvance=16 page=0 chnl=0
char id=60 x=158 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=61 x=160 y=34 width=14 height=8 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=62 x=172 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=63 x=70 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=64 x=192 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=65 x=8 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=66 x=22 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=67 x=36 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=68 x=50 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=69 x=64 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=0
char id=70 x=78 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=0
char id=71 x=92 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=72 x=106 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=73 x=120 y=0 width=10 height=16 xoffset=3 yoffset=3 xadvance=16 page=0 chnl=0
char id=74 x=130 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=75 x=144 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=76 x=158 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=15 page=0 chnl=0
char id=77 x=172 y=0 width=16 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=78 x=188 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=79 x=202 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=80 x=216 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=81 x=230 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=82 x=244 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=83 x=258 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=84 x=272 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=85 x=286 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=86 x=300 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=87 x=314 y=0 width=16 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=88 x=330 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=89 x=344 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=90 x=358 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=91 x=110 y=18 width=10 height=16 xoffset=3 yoffset=3 xadvance=16 page=0 chnl=0
char id=92 x=408 y=18 width=16 height=14 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0
char id=93 x=120 y=18 width=10 height=16 xoffset=3 yoffset=3 xadvance=16 page=0 chnl=0
char id=94 x=206 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=95 x=222 y=34 width=18 height=4 xoffset=-1 yoffset=15 xadvance=16 page=0 chnl=0
char id=96 x=132 y=34 width=10 height=8 xoffset=5 yoffset=3 xadvance=16 page=0 chnl=0
char id=97 x=424 y=18 width=14 height=12 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=98 x=282 y=18 width=14 height=14 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0
char id=99 x=438 y=18 width=12 height=12 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=100 x=296 y=18 width=14 height=14 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0
char id=101 x=450 y=18 width=14 height=12 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=102 x=310 y=18 width=12 height=14 xoffset=3 yoffset=5 xadvance=16 page=0 chnl=0
char id=103 x=322 y=18 width=14 height=14 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=104 x=372 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=105 x=386 y=0 width=10 height=16 xoffset=3 yoffset=3 xadvance=16 page=0 chnl=0
char id=106 x=396 y=0 width=10 height=16 xoffset=3 yoffset=5 xadvance=16 page=0 chnl=0
char id=107 x=406 y=0 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=108 x=420 y=0 width=10 height=16 xoffset=3 yoffset=3 xadvance=16 page=0 chnl=0
char id=109 x=464 y=18 width=16 height=12 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=110 x=480 y=18 width=14 height=12 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=111 x=494 y=18 width=14 height=12 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=112 x=336 y=18 width=14 height=14 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=113 x=350 y=18 width=14 height=14 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=114 x=0 y=34 width=14 height=12 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=115 x=14 y=34 width=14 height=12 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=116 x=364 y=18 width=14 height=14 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0
char id=117 x=28 y=34 width=14 height=12 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=118 x=42 y=34 width=14 height=12 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=119 x=56 y=34 width=16 height=12 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=120 x=72 y=34 width=14 height=12 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=121 x=378 y=18 width=14 height=14 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=122 x=86 y=34 width=14 height=12 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0
char id=123 x=130 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=124 x=186 y=18 width=6 height=16 xoffset=5 yoffset=3 xadvance=16 page=0 chnl=0
char id=125 x=144 y=18 width=14 height=16 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
char id=126 x=174 y=34 width=14 height=8 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0
kernings count=0

View File

@@ -0,0 +1,274 @@
uiskin.png
size: 860,229
format: RGBA8888
filter: Nearest,Nearest
repeat: none
blue
rotate: false
xy: 106, 137
size: 2, 2
orig: 2, 2
offset: 0, 0
index: -1
button
rotate: false
xy: 715, 139
size: 36, 24
split: 18, 17, 11, 12
pad: 14, 14, 4, 4
orig: 36, 24
offset: 0, 0
index: -1
button-down
rotate: false
xy: 106, 140
size: 36, 24
split: 18, 17, 12, 11
pad: 14, 14, 4, 4
orig: 36, 24
offset: 0, 0
index: -1
check-box
rotate: false
xy: 162, 152
size: 12, 12
orig: 12, 12
offset: 0, 0
index: -1
check-box-off
rotate: false
xy: 715, 109
size: 12, 12
orig: 12, 12
offset: 0, 0
index: -1
commodore-64
rotate: false
xy: 1, 165
size: 512, 64
orig: 512, 64
offset: 0, 0
index: -1
cursor
rotate: false
xy: 143, 148
size: 18, 16
split: 9, 8, 7, 8
pad: 2, 0, 0, 0
orig: 18, 16
offset: 0, 0
index: -1
cursor-black
rotate: false
xy: 1, 14
size: 18, 16
split: 9, 8, 7, 8
pad: 2, 0, 0, 0
orig: 18, 16
offset: 0, 0
index: -1
dialog
rotate: false
xy: 1, 31
size: 38, 38
split: 19, 18, 18, 19
pad: 13, 13, 24, 13
orig: 38, 38
offset: 0, 0
index: -1
grey
rotate: false
xy: 752, 161
size: 2, 2
orig: 2, 2
offset: 0, 0
index: -1
horizontal-split-pane
rotate: false
xy: 732, 128
size: 14, 10
split: 6, 6, 0, 0
pad: 0, 0, 0, 0
orig: 14, 10
offset: 0, 0
index: -1
light-blue
rotate: false
xy: 143, 145
size: 2, 2
orig: 2, 2
offset: 0, 0
index: -1
list
rotate: false
xy: 821, 215
size: 22, 14
split: 0, 21, 0, 13
pad: 0, 17, 0, 2
orig: 22, 14
offset: 0, 0
index: -1
minus
rotate: false
xy: 78, 117
size: 14, 14
orig: 14, 14
offset: 0, 0
index: -1
music
rotate: false
xy: 715, 164
size: 46, 32
orig: 46, 32
offset: 0, 0
index: -1
music-off
rotate: false
xy: 774, 197
size: 46, 32
orig: 46, 32
offset: 0, 0
index: -1
plus
rotate: false
xy: 821, 200
size: 14, 14
orig: 14, 14
offset: 0, 0
index: -1
progress-bar
rotate: false
xy: 777, 180
size: 16, 16
split: 7, 8, 7, 8
pad: 2, 2, 2, 2
orig: 16, 16
offset: 0, 0
index: -1
progress-bar-knob
rotate: false
xy: 715, 122
size: 16, 16
split: 4, 4, 4, 4
pad: 0, 0, 0, 0
orig: 16, 16
offset: 0, 0
index: -1
radio-button
rotate: false
xy: 844, 217
size: 16, 12
orig: 16, 12
offset: 0, 0
index: -1
radio-button
rotate: false
xy: 844, 217
size: 16, 12
split: 14, 0, 5, 5
pad: 13, 0, 0, 0
orig: 16, 12
offset: 0, 0
index: -1
radio-button-off
rotate: false
xy: 1, 1
size: 16, 12
orig: 16, 12
offset: 0, 0
index: -1
scroll-bar
rotate: false
xy: 20, 16
size: 14, 14
split: 6, 6, 6, 6
pad: 0, 0, 0, 0
orig: 14, 14
offset: 0, 0
index: -1
scroll-bar-horizontal-knob
rotate: false
xy: 47, 117
size: 30, 14
split: 15, 14, 7, 6
pad: 0, 0, 0, 0
orig: 30, 14
offset: 0, 0
index: -1
scroll-bar-vertical-knob
rotate: false
xy: 762, 166
size: 14, 30
split: 7, 6, 16, 13
pad: 0, 0, 0, 0
orig: 14, 30
offset: 0, 0
index: -1
slider
rotate: false
xy: 40, 65
size: 4, 4
orig: 4, 4
offset: 0, 0
index: -1
slider-knob
rotate: false
xy: 777, 167
size: 10, 12
orig: 10, 12
offset: 0, 0
index: -1
sound
rotate: false
xy: 715, 197
size: 58, 32
orig: 58, 32
offset: 0, 0
index: -1
sound-off
rotate: false
xy: 47, 132
size: 58, 32
orig: 58, 32
offset: 0, 0
index: -1
touchpad
rotate: false
xy: 514, 29
size: 200, 200
orig: 200, 200
offset: 0, 0
index: -1
touchpad-knob
rotate: false
xy: 1, 70
size: 44, 44
orig: 44, 44
offset: 0, 0
index: -1
vertical-split-pane
rotate: false
xy: 794, 182
size: 10, 14
split: 0, 0, 6, 6
pad: 0, 1, 0, 0
orig: 10, 14
offset: 0, 0
index: -1
white
rotate: false
xy: 93, 129
size: 2, 2
orig: 2, 2
offset: 0, 0
index: -1
window
rotate: false
xy: 1, 115
size: 45, 49
split: 20, 20, 22, 22
pad: 22, 22, 24, 24
orig: 45, 49
offset: 0, 0
index: -1

View File

@@ -0,0 +1,172 @@
{
"com.badlogic.gdx.graphics.Color": {
"green": { "g": 1, "a": 1 },
"light_grey": { "r": 0.8, "g": 0.8, "b": 0.8, "a": 1 },
"white": { "r": 1, "g": 1, "b": 1, "a": 1 },
"red": { "r": 1, "a": 1 },
"light_blue": { "r": 0.64705884, "g": 0.64705884, "b": 1, "a": 1 },
"grey": { "r": 0.7, "g": 0.7, "b": 0.7, "a": 1 },
"dark_grey": { "r": 0.4, "g": 0.4, "b": 0.4, "a": 1 },
"blue": { "r": 0.25882354, "g": 0.25882354, "b": 0.90588236, "a": 1 },
"black": { "a": 1 }
},
"com.badlogic.gdx.graphics.g2d.BitmapFont": {
"commodore-64": { "file": "commodore-64.fnt" }
},
"com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable": {
"dialogDim": {
"name": "white",
"color": { "a": 1, "b": 0.2, "g": 0.2, "r": 0.2 }
}
},
"com.badlogic.gdx.scenes.scene2d.ui.ProgressBar$ProgressBarStyle": {
"default-horizontal": { "background": "progress-bar", "knobBefore": "progress-bar-knob" },
"default-vertical": { "background": "progress-bar", "knobBefore": "progress-bar-knob" }
},
"com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": {
"default": {
"font": "commodore-64",
"fontColor": { "a": 1, "b": 1, "g": 0.64705884, "r": 0.64705884 },
"downFontColor": { "a": 1, "b": 0.90588236, "g": 0.25882354, "r": 0.25882354 },
"disabledFontColor": { "a": 1, "b": 0.8, "g": 0.8, "r": 0.8 },
"up": "button",
"down": "button-down"
},
"toggle": {
"font": "commodore-64",
"fontColor": { "a": 1, "b": 1, "g": 0.64705884, "r": 0.64705884 },
"downFontColor": { "a": 1, "b": 0.90588236, "g": 0.25882354, "r": 0.25882354 },
"checkedFontColor": { "a": 1, "b": 0.90588236, "g": 0.25882354, "r": 0.25882354 },
"up": "button",
"down": "button-down",
"checked": "button-down"
}
},
"com.badlogic.gdx.scenes.scene2d.ui.ImageButton$ImageButtonStyle": {
"default": { "up": "button", "down": "button-down" }
},
"com.badlogic.gdx.scenes.scene2d.ui.SplitPane$SplitPaneStyle": {
"default-vertical": { "handle": "vertical-split-pane" },
"default-horizontal": { "handle": "horizontal-split-pane" }
},
"com.badlogic.gdx.scenes.scene2d.ui.Touchpad$TouchpadStyle": {
"default": { "background": "touchpad", "knob": "touchpad-knob" }
},
"com.badlogic.gdx.scenes.scene2d.ui.Button$ButtonStyle": {
"default": { "up": "button", "down": "button-down" },
"music": { "up": "music-off", "down": "music", "checked": "music" },
"sound": { "up": "sound-off", "down": "sound", "checked": "sound" },
"toggle": { "up": "button", "down": "button-down", "checked": "button-down" }
},
"com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle": {
"default": {
"background": "window",
"titleFont": "commodore-64",
"titleFontColor": { "a": 1, "b": 1, "g": 0.64705884, "r": 0.64705884 }
},
"dialog": {
"background": "dialog",
"titleFont": "commodore-64",
"titleFontColor": { "a": 1, "b": 1, "g": 0.64705884, "r": 0.64705884 }
},
"dialog-modal": {
"background": "dialog",
"titleFont": "commodore-64",
"titleFontColor": { "a": 1, "b": 1, "g": 1, "r": 1 },
"stageBackground": "blue"
}
},
"com.badlogic.gdx.scenes.scene2d.ui.TextField$TextFieldStyle": {
"default": {
"font": "commodore-64",
"fontColor": { "a": 1 },
"background": "white",
"cursor": "cursor-black",
"selection": "light-blue",
"messageFont": "commodore-64",
"messageFontColor": { "a": 1, "b": 0.8, "g": 0.8, "r": 0.8 }
},
"nobg": {
"font": "commodore-64",
"fontColor": { "a": 1, "b": 1, "g": 0.64705884, "r": 0.64705884 },
"cursor": "cursor",
"selection": "white",
"messageFont": "commodore-64",
"messageFontColor": { "a": 1, "b": 0.8, "g": 0.8, "r": 0.8 }
}
},
"com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle": {
"default": {
"background": "blue",
"hScroll": "scroll-bar",
"hScrollKnob": "scroll-bar-horizontal-knob",
"vScroll": "scroll-bar",
"vScrollKnob": "scroll-bar-vertical-knob"
}
},
"com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle": {
"optional": {
"font": "commodore-64",
"fontColor": { "a": 1, "b": 1, "g": 1, "r": 1 }
},
"default": {
"font": "commodore-64",
"fontColor": { "a": 1, "b": 1, "g": 0.64705884, "r": 0.64705884 }
},
"error": {
"font": "commodore-64",
"fontColor": { "a": 1, "b": 0.4, "g": 0.4, "r": 0.4 }
},
"title": {
"font": "commodore-64",
"fontColor": { "a": 1, "b": 1, "g": 0.64705884, "r": 0.64705884 },
"background": "button"
}
},
"com.badlogic.gdx.scenes.scene2d.ui.List$ListStyle": {
"default": {
"font": "commodore-64",
"fontColorSelected": { "a": 1, "b": 0.90588236, "g": 0.25882354, "r": 0.25882354 },
"fontColorUnselected": { "a": 1, "b": 1, "g": 0.64705884, "r": 0.64705884 },
"selection": "white"
},
"dimmed": {
"font": "commodore-64",
"fontColorSelected": { "a": 1, "b": 0.90588236, "g": 0.25882354, "r": 0.25882354 },
"fontColorUnselected": { "a": 1, "b": 0.90588236, "g": 0.25882354, "r": 0.25882354 },
"selection": "light-blue",
"background": "white"
}
},
"com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle": {
"default": {
"checkboxOn": "check-box",
"checkboxOff": "check-box-off",
"font": "commodore-64",
"fontColor": { "a": 1, "b": 1, "g": 0.64705884, "r": 0.64705884 }
},
"radio": {
"checkboxOn": "radio-button",
"checkboxOff": "radio-button-off",
"font": "commodore-64",
"fontColor": { "a": 1, "b": 1, "g": 0.64705884, "r": 0.64705884 },
"checkedFontColor": { "a": 1, "b": 1, "g": 1, "r": 1 }
}
},
"com.badlogic.gdx.scenes.scene2d.ui.Tree$TreeStyle": {
"default": { "plus": "plus", "minus": "minus", "selection": "progress-bar" }
},
"com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle": {
"default-vertical": { "background": "slider", "knob": "slider-knob" },
"default-horizontal": { "background": "slider", "knob": "slider-knob" }
},
"com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle": {
"default": {
"font": "commodore-64",
"fontColor": { "a": 1, "b": 1, "g": 0.64705884, "r": 0.64705884 },
"background": "list",
"scrollStyle": "default",
"listStyle": "dimmed"
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -0,0 +1,92 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.4'
}
}
allprojects {
apply plugin: "eclipse"
version = '1.0'
ext {
appName = "My GDX Game"
gdxVersion = '1.12.0'
roboVMVersion = '2.3.20'
box2DLightsVersion = '1.5'
ashleyVersion = '1.7.4'
aiVersion = '1.8.2'
gdxControllersVersion = '2.2.1'
}
repositories {
mavenLocal()
mavenCentral()
google()
gradlePluginPortal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
maven { url "https://jitpack.io" }
}
}
project(":desktop") {
apply plugin: "java-library"
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
api "com.github.bhlangonijr:chesslib:1.3.3"
}
}
project(":core") {
apply plugin: "java-library"
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
api "com.badlogicgames.ashley:ashley:$ashleyVersion"
api "com.github.bhlangonijr:chesslib:1.3.3"
}
}
project(":android") {
apply plugin: "com.android.application"
configurations { natives }
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
api "com.badlogicgames.ashley:ashley:$ashleyVersion"
}
}

View File

@@ -0,0 +1,6 @@
sourceCompatibility = 1.7
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.java.srcDirs = [ "src/" ]
eclipse.project.name = appName + "-core"

View File

@@ -0,0 +1,13 @@
package com.mygdx.game;
import com.badlogic.gdx.graphics.Color;
public class GameConfig {
public static final float WIDTH = 600f; // pixels
public static final float HEIGHT = 600f; // pixels
public static final Color background = new Color(66 / 255f, 66 / 255f, 231 / 255f, 0f);
public static final Color brown = new Color(159 / 255f, 80 / 255f, 50 / 255f, 0f);
public static final Color white = new Color(228 / 255f, 191 / 255f, 147 / 255f, 0f);
public static final Color green = new Color(50 / 255f, 160 / 255f, 50 / 255f, 0f);
}

View File

@@ -0,0 +1,93 @@
package com.mygdx.game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.utils.Array;
import java.util.Comparator;
public class GameManager {
public static GameManager I = new GameManager();
String s_e_k = "sound_effect";
public boolean soundEffect = true;
String s_p_k = "single_player";
public boolean singlePlayer = false;
String menu_vol_key = "menu_volume";
public float menuVolume = 1f;
String game_vol_key = "game_volume";
public float gameVolume = 1f;
private final Preferences PREFS;
public static class Player{
public String name;
public int score;
public Player(String n, int s){
name = n;
score = s;
}
}
String player_score = "player_score_";
String player_name = "player_name_";
public Array<Player> scores = new Array<>();
private GameManager() {
PREFS = Gdx.app.getPreferences(MyGame.class.getSimpleName());
}
public void addToScore(String name, int score){
scores.add(new Player(name, score));
scores.sort(new Comparator<Player>() {
@Override
public int compare(Player player, Player t1) {
return player.score - t1.score;
}
}
);
scores.removeIndex(scores.size - 1);
}
public void clearScores(){
for (Player e: scores ) {
e.name = "EMPTY";
e.score = 300;
}
}
void loadPref(){
menuVolume = PREFS.getFloat(menu_vol_key, 1f);
gameVolume = PREFS.getFloat(game_vol_key, 1f);
soundEffect = PREFS.getBoolean(s_e_k, true);
singlePlayer = PREFS.getBoolean(s_p_k, false);
for (int i = 0; i < 5; i ++){
Player p = new Player( PREFS.getString(player_name + i, ""),
PREFS.getInteger(player_score + i, 0));
scores.add(p);
}
}
void savePref(){
int start = scores.size - 5;
if(start < 0) start = 0;
int savepoint = 0;
for (int i = start; i < scores.size; i ++){
Player s = scores.get(i);
PREFS.putString(player_name + savepoint, s.name);
PREFS.putInteger(player_score + savepoint, s.score);
savepoint++;
}
PREFS.putFloat(menu_vol_key, menuVolume);
PREFS.putFloat(game_vol_key, gameVolume);
PREFS.putBoolean(s_e_k, soundEffect);
PREFS.putBoolean(s_p_k, singlePlayer);
PREFS.flush();
}
}

View File

@@ -0,0 +1,54 @@
package com.mygdx.game;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.mygdx.game.assets.AssetDescriptors;
import com.mygdx.game.screens.IntroScreen;
public class MyGame extends Game {
public SpriteBatch batch;
public AssetManager assetManager;
public Music menuMusic;
public Music gameMusic;
@Override
public void create () {
Gdx.app.setLogLevel(Application.LOG_DEBUG);
batch = new SpriteBatch();
assetManager = new AssetManager();
loadAssets();
GameManager.I.loadPref();
menuMusic = assetManager.get(AssetDescriptors.MENU_MUSIC);
menuMusic.setLooping(true);
menuMusic.setVolume(GameManager.I.menuVolume);
menuMusic.play();
gameMusic = assetManager.get(AssetDescriptors.GAME_MUSIC);
gameMusic.setLooping(true);
gameMusic.setVolume(GameManager.I.gameVolume);
setScreen(new IntroScreen(this));
}
void loadAssets(){
assetManager.load(AssetDescriptors.UI_SKIN);
assetManager.load(AssetDescriptors.CHESS);
assetManager.load(AssetDescriptors.MENU_MUSIC);
assetManager.load(AssetDescriptors.GAME_MUSIC);
assetManager.load(AssetDescriptors.SOUND_EFFECT);
assetManager.finishLoading(); // blocks until all assets are loaded
}
@Override
public void dispose () {
GameManager.I.savePref();
batch.dispose();
assetManager.dispose();
}
}

View File

@@ -0,0 +1,34 @@
package com.mygdx.game;
import com.github.bhlangonijr.chesslib.File;
import com.github.bhlangonijr.chesslib.Rank;
public class Utils {
public static int fileToInt(File f){
switch (f){
case FILE_A: return 0;
case FILE_B: return 1;
case FILE_C: return 2;
case FILE_D: return 3;
case FILE_E: return 4;
case FILE_F: return 5;
case FILE_G: return 6;
case FILE_H: return 7;
}
return 0;
}
public static int rankToInt(Rank f){
switch (f){
case RANK_1: return 0;
case RANK_2: return 1;
case RANK_3: return 2;
case RANK_4: return 3;
case RANK_5: return 4;
case RANK_6: return 5;
case RANK_7: return 6;
case RANK_8: return 7;
}
return 0;
}
}

View File

@@ -0,0 +1,27 @@
package com.mygdx.game.assets;
import com.badlogic.gdx.assets.AssetDescriptor;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
public class AssetDescriptors {
public static final AssetDescriptor<Skin> UI_SKIN =
new AssetDescriptor<>(AssetPaths.UI_SKIN, Skin.class);
public static final AssetDescriptor<TextureAtlas> CHESS =
new AssetDescriptor<>(AssetPaths.CHESS, TextureAtlas.class);
public static final AssetDescriptor<Music> MENU_MUSIC =
new AssetDescriptor<>(AssetPaths.MENU_MUSIC, Music.class);
public static final AssetDescriptor<Music> GAME_MUSIC =
new AssetDescriptor<>(AssetPaths.GAME_MUSIC, Music.class);
public static final AssetDescriptor<Sound> SOUND_EFFECT =
new AssetDescriptor<>(AssetPaths.SOUND_EFFECT, Sound.class);
private AssetDescriptors() {
}
}

View File

@@ -0,0 +1,15 @@
package com.mygdx.game.assets;
public class AssetPaths {
public static final String UI_SKIN = "ui/uiskin.json";
// public static final String GAMEPLAY = "gameplay/gameplay.atlas";
public static final String CHESS = "chess/chess.atlas";
public static final String MENU_MUSIC = "sound/Science_Documentary.mp3";
public static final String GAME_MUSIC = "sound/the-best-jazz-club-in-new-orleans.mp3";
public static final String SOUND_EFFECT = "sound/move-self.mp3";
private AssetPaths() {
}
}

View File

@@ -0,0 +1,20 @@
package com.mygdx.game.assets;
public class RegionNames {
public static final String bishop_b = "bishop_b";
public static final String bishop_w = "bishop_w";
public static final String king_b = "king_b";
public static final String king_w = "king_w";
public static final String knight_b = "knight_b";
public static final String knight_w = "knight_w";
public static final String pawn_b = "pawn_b";
public static final String pawn_w = "pawn_w";
public static final String queen_b = "queen_b";
public static final String queen_w = "queen_w";
public static final String rook_b = "rook_b";
public static final String rook_w = "rook_w";
private RegionNames() {
}
}

View File

@@ -0,0 +1,307 @@
package com.mygdx.game.screens;
import static com.badlogic.gdx.math.MathUtils.random;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.Widget;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Logger;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.github.bhlangonijr.chesslib.Board;
import com.github.bhlangonijr.chesslib.Piece;
import com.github.bhlangonijr.chesslib.Side;
import com.github.bhlangonijr.chesslib.Square;
import com.github.bhlangonijr.chesslib.move.Move;
import com.mygdx.game.MyGame;
import com.mygdx.game.*;
import com.mygdx.game.assets.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
public class GameScreen extends ScreenAdapter {
private static final Logger log = new Logger(GameScreen.class.getSimpleName(), Logger.DEBUG);
private final MyGame game;
private ShapeRenderer shapeRenderer;
private Viewport viewport;
private Viewport hudViewport;
private Stage gameplayStage;
private Stage hudStage;
private Skin skin;
private Label turnLabel;
private Sound soundEffect;
public GameScreen(MyGame game) {
this.game = game;
game.menuMusic.pause();
game.gameMusic.play();
}
Map<Piece, TextureAtlas.AtlasRegion> regionMap;
Board board = new Board();
List<Move> moves;
void loadRegionMap(){
TextureAtlas atlas = game.assetManager.get(AssetDescriptors.CHESS);
regionMap.put(Piece.WHITE_PAWN, atlas.findRegion(RegionNames.pawn_w));
regionMap.put(Piece.WHITE_KNIGHT, atlas.findRegion(RegionNames.knight_w));
regionMap.put(Piece.WHITE_BISHOP, atlas.findRegion(RegionNames.bishop_w));
regionMap.put(Piece.WHITE_ROOK, atlas.findRegion(RegionNames.rook_w));
regionMap.put(Piece.WHITE_QUEEN, atlas.findRegion(RegionNames.queen_w));
regionMap.put(Piece.WHITE_KING, atlas.findRegion(RegionNames.king_w));
regionMap.put(Piece.BLACK_PAWN, atlas.findRegion(RegionNames.pawn_b));
regionMap.put(Piece.BLACK_KNIGHT, atlas.findRegion(RegionNames.knight_b));
regionMap.put(Piece.BLACK_BISHOP, atlas.findRegion(RegionNames.bishop_b));
regionMap.put(Piece.BLACK_ROOK, atlas.findRegion(RegionNames.rook_b));
regionMap.put(Piece.BLACK_QUEEN, atlas.findRegion(RegionNames.queen_b));
regionMap.put(Piece.BLACK_KING, atlas.findRegion(RegionNames.king_b));
}
@Override
public void show() {
viewport = new FitViewport(80f, 80f);
hudViewport = new FitViewport(GameConfig.WIDTH, GameConfig.HEIGHT);
gameplayStage = new Stage(viewport, game.batch);
hudStage = new Stage(hudViewport, game.batch);
skin = game.assetManager.get(AssetDescriptors.UI_SKIN);
soundEffect = game.assetManager.get(AssetDescriptors.SOUND_EFFECT);
shapeRenderer = new ShapeRenderer();
regionMap = new HashMap<>();
loadRegionMap();
moves = board.legalMoves();
gameplayStage.addActor(createGrid());
hudStage.addActor(createInfo());
hudStage.addActor(createBackButton());
Gdx.input.setInputProcessor(new InputMultiplexer(gameplayStage, hudStage));
}
@Override
public void resize(int width, int height) {
viewport.update(width, height, true);
hudViewport.update(width, height, true);
}
Vector<Integer> poss_int = new Vector<>();
Vector<Move> poss_mv = new Vector<>();
void clickGrid(int index){
Square clickedSq = Square.squareAt(index);
for (Move m: poss_mv) {
if(m.getTo() == clickedSq){
board.doMove(m);
boolean isMate = board.isMated();
boolean isDraw = board.isDraw();
if( isMate || isDraw ){
if(isMate){
turnLabel.setText("MATE");
}
if(isDraw){
turnLabel.setText("DRAW");
}
if(GameManager.I.singlePlayer){
if(board.getSideToMove() == Side.BLACK){
game.setScreen(new LeaderboardScreen(game, board.getMoveCounter()));
return;
}
}
}
turnLabel.setText(board.getSideToMove().toString());
moves = board.legalMoves();
poss_mv.clear();
poss_int.clear();
if(GameManager.I.soundEffect)
soundEffect.play();
if(GameManager.I.singlePlayer){
int moveC = moves.size();
float rand = random.nextFloat();
int mov = (int) (rand * moveC);
board.doMove(moves.get(mov));
moves = board.legalMoves();
}
return;
}
}
poss_mv.clear();
poss_int.clear();
for (Move m : moves) {
if (m.getFrom() == clickedSq)
{
int rank = Utils.rankToInt(m.getTo().getRank());
int file = Utils.fileToInt(m.getTo().getFile());
int in = rank * 8 + file;
poss_int.add(in);
poss_mv.add(m);
}
}
}
void drawGrid(){
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
if( ( (i * 8) + j + i) % 2 == 0)
shapeRenderer.setColor(GameConfig.brown);
else
shapeRenderer.setColor(GameConfig.white);
shapeRenderer.rect(8+j * 8, 8+i*8, 8,8);
}
}
}
void drawPossibility(){
shapeRenderer.setColor(GameConfig.green);
for (Integer i : poss_int) {
int x = i % 8;
int y = i / 8;
shapeRenderer.rect(9 + x * 8, 9 + y * 8, 6,6);
}
}
void drawFigures(){
Piece[] pieces = board.boardToArray();
for (int i = 0; i < pieces.length; i++) {
if(pieces[i] == Piece.NONE) continue;
int x = i % 8;
int y = i / 8;
game.batch.draw(regionMap.get(pieces[i]), 8 + x * 8 , 8 + y * 8, 8,8);
}
}
@Override
public void render(float delta) {
ScreenUtils.clear(GameConfig.background);
shapeRenderer.setProjectionMatrix(viewport.getCamera().combined);
shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
drawGrid();
drawPossibility();
shapeRenderer.end();
game.batch.setProjectionMatrix(viewport.getCamera().combined);
game.batch.begin();
drawFigures();
game.batch.end();
// update
gameplayStage.act(delta);
hudStage.act(delta);
// draw
gameplayStage.draw();
hudStage.draw();
}
@Override
public void hide() {
dispose();
}
@Override
public void dispose() {
gameplayStage.dispose();
hudStage.dispose();
}
static class Cell extends Widget{
public int pos;
Cell(int p){
pos = p;
}
}
private Actor createGrid() {
final Table table = new Table();
table.setDebug(false); // turn on all debug lines (table, cell, and widget)
Table grid = new Table();
grid.defaults().size(8f); // all cells will be the same size
grid.setDebug(false);
for (int row = 0; row < 8; row++) {
for (int column = 0; column < 8; column++) {
int y = 8 - row - 1;
final Cell widget = new Cell(y * 8 + column);
widget.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
final Cell clickedCell = (Cell) event.getTarget(); // it will be an image for sure :-)
clickGrid(clickedCell.pos);
}
});
grid.add(widget);
}
grid.row();
}
table.add(grid).row();
table.center();
table.setFillParent(true);
table.pack();
return table;
}
private Actor createBackButton() {
final TextButton backButton = new TextButton("Back", skin);
backButton.setWidth(100);
backButton.setPosition(GameConfig.WIDTH / 2f - backButton.getWidth() / 2f, 20f);
backButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
game.setScreen(new MenuScreen(game));
}
});
return backButton;
}
private Actor createInfo() {
final Table table = new Table();
turnLabel = new Label(board.getSideToMove().toString(), skin);
table.add(turnLabel).row();
table.center();
table.pack();
table.setPosition(
GameConfig.WIDTH / 2f - table.getWidth() / 2f,
GameConfig.HEIGHT - table.getHeight() - 20f
);
return table;
}
}

View File

@@ -0,0 +1,122 @@
package com.mygdx.game.screens;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.mygdx.game.MyGame;
import com.mygdx.game.*;
import com.mygdx.game.assets.*;
public class IntroScreen extends ScreenAdapter {
public static final float INTRO_DURATION_IN_SEC = 8f; // duration of the (intro) animation
private final MyGame game;
private Viewport viewport;
private TextureAtlas gameplayAtlas;
private float duration = 0f;
private Stage stage;
public IntroScreen(MyGame game) {
this.game = game;
}
@Override
public void show() {
viewport = new FitViewport(GameConfig.WIDTH, GameConfig.HEIGHT);
stage = new Stage(viewport, game.batch);
gameplayAtlas = game.assetManager.get(AssetDescriptors.CHESS);
for (int i = 0; i < 8; i++) {
stage.addActor(createPawnB(i));
stage.addActor(createPawnW(i));
}
}
@Override
public void resize(int width, int height) {
viewport.update(width, height, true);
}
@Override
public void render(float delta) {
ScreenUtils.clear(GameConfig.background);
duration += delta;
// go to the MenuScreen after INTRO_DURATION_IN_SEC seconds
if (duration > INTRO_DURATION_IN_SEC) {
game.setScreen(new MenuScreen(game));
}
stage.act(delta);
stage.draw();
}
@Override
public void hide() {
dispose();
}
@Override
public void dispose() {
stage.dispose();
}
private Actor createPawnB(int num) {
Image pawn = new Image(gameplayAtlas.findRegion(RegionNames.pawn_b));
// set positions x, y to center the image to the center of the window
float posX = (viewport.getWorldWidth() / 2f) - pawn.getWidth() * num + pawn.getWidth() * 3;
float posY = (viewport.getWorldHeight() / 2f) - pawn.getHeight();
pawn.setOrigin(Align.center);
pawn.addAction(
Actions.sequence(
Actions.delay(0.5f * num),
Actions.moveTo(0, posY, 1.5f),
Actions.moveTo(posX, posY, 1.5f) // // move image to the center of the window
)
);
return pawn;
}
private Actor createPawnW(int num) {
Image pawn = new Image(gameplayAtlas.findRegion(RegionNames.pawn_w));
// set positions x, y to center the image to the center of the window
float posX = (viewport.getWorldWidth() / 2f) - pawn.getWidth() * num + pawn.getWidth() * 3;
float posY = (viewport.getWorldHeight() / 2f);
pawn.setOrigin(Align.center);
pawn.addAction(
Actions.sequence(
Actions.delay(0.5f * num),
Actions.moveTo(0, posY, 1.5f),
Actions.moveTo(posX, posY, 1.5f) // // move image to the center of the window
)
);
return pawn;
}
}

View File

@@ -0,0 +1,132 @@
package com.mygdx.game.screens;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.mygdx.game.GameConfig;
import com.mygdx.game.GameManager;
import com.mygdx.game.MyGame;
import com.mygdx.game.assets.AssetDescriptors;
public class LeaderboardScreen extends ScreenAdapter {
private final MyGame game;
private final AssetManager assetManager;
private Viewport viewport;
private Stage stage;
int score = 0;
public LeaderboardScreen(MyGame game) {
this.game = game;
assetManager = game.assetManager;
}
public LeaderboardScreen(MyGame game, int score){
this.game = game;
assetManager = game.assetManager;
this.score = score;
}
@Override
public void show() {
viewport = new FitViewport(GameConfig.WIDTH, GameConfig.HEIGHT);
stage = new Stage(viewport, game.batch);
stage.addActor(createUi());
Gdx.input.setInputProcessor(stage);
}
@Override
public void resize(int width, int height) {
viewport.update(width, height, true);
}
@Override
public void render(float delta) {
ScreenUtils.clear(GameConfig.background);
stage.act(delta);
stage.draw();
}
@Override
public void hide() {
dispose();
}
@Override
public void dispose() {
stage.dispose();
}
private Actor createUi() {
Table table = new Table();
table.defaults().pad(20);
final Skin uiSkin = assetManager.get(AssetDescriptors.UI_SKIN);
final Table contentTable = new Table(uiSkin);
contentTable.add(new Label("Leaderboard", uiSkin)).padBottom(50).row();
final TextButton backButton = new TextButton("Back", uiSkin);
backButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
game.setScreen(new MenuScreen(game));
}
});
if(score > 0) {
final TextField textField = new TextField("Name", uiSkin);
textField.addListener(new InputListener() {
@Override
public boolean keyTyped(InputEvent event, char character) {
if(character == '\r' || character == '\n') {
String name = textField.getText();
GameManager.I.addToScore(name, score);
contentTable.clear();
contentTable.add(new Label("Leaderboard", uiSkin)).padBottom(50).row();
for (GameManager.Player p: GameManager.I.scores) {
contentTable.add(new Label(p.name, uiSkin));
contentTable.add(new Label(String.valueOf(p.score), uiSkin)).row();
}
contentTable.add(backButton).width(100).padTop(50).colspan(2).padBottom(50);
}
return false;
}
});
contentTable.add(textField).padBottom(50).row();
}
for (GameManager.Player p: GameManager.I.scores) {
contentTable.add(new Label(p.name, uiSkin));
contentTable.add(new Label(String.valueOf(p.score), uiSkin)).row();
}
contentTable.add(backButton).width(100).padTop(50).colspan(2).padBottom(50);
table.add(contentTable);
table.center();
table.setFillParent(true);
table.pack();
return table;
}
}

View File

@@ -0,0 +1,127 @@
package com.mygdx.game.screens;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.mygdx.game.MyGame;
import com.mygdx.game.*;
import com.mygdx.game.assets.*;
public class MenuScreen extends ScreenAdapter {
private final MyGame game;
private final AssetManager assetManager;
private Viewport viewport;
private Stage stage;
private Skin skin;
public MenuScreen(MyGame game) {
this.game = game;
assetManager = game.assetManager;
}
@Override
public void show() {
viewport = new FitViewport(GameConfig.WIDTH, GameConfig.HEIGHT);
stage = new Stage(viewport, game.batch);
skin = assetManager.get(AssetDescriptors.UI_SKIN);
stage.addActor(createUi());
Gdx.input.setInputProcessor(stage);
game.menuMusic.play();
game.gameMusic.pause();
}
@Override
public void resize(int width, int height) {
viewport.update(width, height, true);
}
@Override
public void render(float delta) {
ScreenUtils.clear(GameConfig.background);
stage.act(delta);
stage.draw();
}
@Override
public void hide() {
dispose();
}
@Override
public void dispose() {
stage.dispose();
}
private Actor createUi() {
Table table = new Table();
table.defaults().pad(20);
TextButton playButton = new TextButton("Play", skin);
playButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
game.setScreen(new GameScreen(game));
}
});
TextButton leaderboardButton = new TextButton("Leaderboard", skin);
leaderboardButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
game.setScreen(new LeaderboardScreen(game));
}
});
TextButton settingsButton = new TextButton("Settings", skin);
settingsButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
game.setScreen(new SettingsScreen(game));
}
});
TextButton quitButton = new TextButton("Quit", skin);
quitButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Gdx.app.exit();
}
});
Table buttonTable = new Table();
buttonTable.defaults().padLeft(30).padRight(30);
buttonTable.add(playButton).padBottom(15).expandX().fill().row();
buttonTable.add(leaderboardButton).padBottom(15).fillX().row();
buttonTable.add(settingsButton).padBottom(15).fillX().row();
buttonTable.add(quitButton).fillX();
buttonTable.center();
table.add(buttonTable);
table.center();
table.setFillParent(true);
table.pack();
return table;
}
}

View File

@@ -0,0 +1,153 @@
package com.mygdx.game.screens;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Slider;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.mygdx.game.MyGame;
import com.mygdx.game.*;
import com.mygdx.game.assets.*;
public class SettingsScreen extends ScreenAdapter {
private final MyGame game;
private final AssetManager assetManager;
private Viewport viewport;
private Stage stage;
public SettingsScreen(MyGame game) {
this.game = game;
assetManager = game.assetManager;
}
@Override
public void show() {
viewport = new FitViewport(GameConfig.WIDTH, GameConfig.HEIGHT);
stage = new Stage(viewport, game.batch);
stage.addActor(createUi());
Gdx.input.setInputProcessor(stage);
}
@Override
public void resize(int width, int height) {
viewport.update(width, height, true);
}
@Override
public void render(float delta) {
ScreenUtils.clear(GameConfig.background);
stage.act(delta);
stage.draw();
}
@Override
public void hide() {
dispose();
}
@Override
public void dispose() {
stage.dispose();
}
private Actor createUi() {
Skin uiSkin = assetManager.get(AssetDescriptors.UI_SKIN);
Table contentTable = new Table(uiSkin);
contentTable.add(new Label("Settings", uiSkin)).padBottom(50).colspan(2).row();
CheckBox singlePlayer = new CheckBox(" Single Player", uiSkin);
singlePlayer.setChecked(GameManager.I.singlePlayer);
singlePlayer.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
CheckBox s = (CheckBox) actor;
GameManager.I.singlePlayer = s.isChecked();
}
});
contentTable.add(singlePlayer).padTop(20).colspan(2).row();
CheckBox soundEffect = new CheckBox(" Sound Effects", uiSkin);
soundEffect.setChecked(GameManager.I.soundEffect);
soundEffect.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
CheckBox s = (CheckBox) actor;
GameManager.I.soundEffect = s.isChecked();
}
});
contentTable.add(soundEffect).padTop(20).colspan(2).row();
contentTable.add(new Label("Menu Volume:", uiSkin)).padTop(20).colspan(2).row();
Slider slider = new Slider(0.0f, 1.0f, 0.01f, false,uiSkin);
slider.setValue(GameManager.I.menuVolume);
slider.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Slider s = (Slider) actor;
GameManager.I.menuVolume = s.getValue();
game.gameMusic.pause();
game.menuMusic.play();
game.menuMusic.setVolume(s.getValue());
}
});
contentTable.add(slider).row();
contentTable.add(new Label("Game Volume:", uiSkin)).padTop(20).colspan(2).row();
slider = new Slider(0.0f, 1.0f, 0.01f, false,uiSkin);
slider.setValue(GameManager.I.gameVolume);
slider.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Slider s = (Slider) actor;
GameManager.I.gameVolume = s.getValue();
game.menuMusic.pause();
game.gameMusic.play();
game.gameMusic.setVolume(s.getValue());
}
});
contentTable.add(slider).row();
TextButton backButton = new TextButton("Back", uiSkin);
backButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
game.setScreen(new MenuScreen(game));
}
});
contentTable.add(backButton).width(100).padTop(50).colspan(2).padBottom(50);
Table table = new Table();
table.defaults().pad(20);
table.add(contentTable);
table.center();
table.setFillParent(true);
table.pack();
return table;
}
}

View File

@@ -0,0 +1,49 @@
sourceCompatibility = 1.8
sourceSets.main.java.srcDirs = [ "src/" ]
sourceSets.main.resources.srcDirs = ["../assets"]
project.ext.mainClassName = "com.mygdx.game.DesktopLauncher"
project.ext.assetsDir = new File("../assets")
import org.gradle.internal.os.OperatingSystem
tasks.register('run', JavaExec) {
dependsOn classes
mainClass = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
if (OperatingSystem.current() == OperatingSystem.MAC_OS) {
// Required to run on macOS
jvmArgs += "-XstartOnFirstThread"
}
}
tasks.register('debug', JavaExec) {
dependsOn classes
mainClass = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
debug = true
}
tasks.register('dist', Jar) {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
manifest {
attributes 'Main-Class': project.mainClassName
}
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
}
dist.dependsOn classes
eclipse.project.name = appName + "-desktop"

View File

@@ -0,0 +1,22 @@
package com.mygdx.game;
import com.badlogic.gdx.tools.texturepacker.TexturePacker;
public class AssetPacker {
private static final boolean DRAW_DEBUG_OUTLINE = false;
private static final String RAW_ASSETS_PATH = "assets/raw";
private static final String ASSETS_PATH = "assets";
public static void main(String[] args) {
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.debug = DRAW_DEBUG_OUTLINE;
TexturePacker.process(settings,
RAW_ASSETS_PATH + "/chess", // the directory containing individual images to be packed
ASSETS_PATH + "/chess", // the directory where the pack file will be written
"chess" // the name of the pack file / atlas name
);
}
}

View File

@@ -0,0 +1,15 @@
package com.mygdx.game;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
// Please note that on macOS your application needs to be started with the -XstartOnFirstThread JVM argument
public class DesktopLauncher {
public static void main (String[] arg) {
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
config.setForegroundFPS(60);
config.setTitle("My GDX Game");
new Lwjgl3Application(new MyGame(), config);
}
}

View File

@@ -0,0 +1,7 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms128m -Xmx1500m
org.gradle.configureondemand=false
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
android.useAndroidX=true

View File

@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -0,0 +1,240 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

View File

@@ -0,0 +1,91 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -0,0 +1 @@
include 'desktop', 'core', 'android'