Skip to content

Commit 9e5dd53

Browse files
Switch port
1 parent 1ffbeae commit 9e5dd53

File tree

22 files changed

+2058
-70
lines changed

22 files changed

+2058
-70
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,3 @@ Security.java
153153
/excluded-resources/Video
154154
/excluded-resources/music
155155
/excluded-resources/libgdx token.txt
156-
HTTP.java
157-
Security.java
158-
HttpServer.java
159-
/core/src/at/therefactory/jewelthief/net/HttpServer.java

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Jewel Thief ![appicon](excluded-resources/appicon.png) <a href="https://www.youtube.com/channel/UCShL6kEbNc02XjA89zsrtDQ"><img src="http://therefactory.bplaced.net/img/youtube_hover.png" height="32px" align="right"></a>
22

3-
*This Android game is a remake of the legendary Jewel Thief game made by Paul Ligeski from ServantWare in 1991.*
3+
*This Android game is a remake of the legendary Jewel Thief game made by Paul Ligeski from ServantWare in 1991. Ported to Switch using [SwitchGDX](https://github.com/TheLogicMaster/switch-gdx).*
44

55
[![version](https://img.shields.io/badge/version-2018.9-2095ff.svg)](CHANGELOG.md)
66
[![license](https://img.shields.io/badge/license-GPL--3.0-2095ff.svg)](LICENSE.md)
@@ -53,6 +53,9 @@ The more you tell me, the better my apps get. Please use the comments on <a href
5353

5454
Your privacy is really important to me. The only permission that this app requires is internet access (android.permission.INTERNET). This is needed for the highscore list to function.
5555

56+
## Building
57+
To build for PC or Switch, the `crypt` directory needs to be sourced from an APK of the game and placed into the `assets` directory.
58+
5659
## License
5760

5861
Copyright &copy; 2016 Christian DeTamble

build.gradle

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,29 @@ buildscript {
2222
mavenCentral()
2323
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
2424
jcenter()
25+
google()
2526
}
2627
dependencies {
27-
classpath 'com.android.tools.build:gradle:2.3.2'
28+
classpath 'com.android.tools.build:gradle:7.0.0'
2829
}
2930
}
3031

3132
allprojects {
3233
apply plugin: "eclipse"
3334
apply plugin: "idea"
3435

35-
version = '2018.9'
36+
version = '2.0'
3637
ext {
3738
appName = "jewelthief"
38-
gdxVersion = '1.9.8'
39+
gdxVersion = '1.11.0'
3940
roboVMVersion = '2.2.0'
40-
box2DLightsVersion = '1.4'
41-
ashleyVersion = '1.7.3'
42-
aiVersion = '1.8.0'
41+
box2DLightsVersion = '1.5'
42+
ashleyVersion = '1.7.4'
43+
aiVersion = '1.8.2'
44+
gdxControllersVersion = '2.2.1'
45+
retroLambdaVersion = '2.5.7'
46+
clearwingVersion = '0.1'
47+
switchGdxVersion = '0.1'
4348
}
4449

4550
repositories {
@@ -54,38 +59,39 @@ project(":desktop") {
5459

5560

5661
dependencies {
57-
compile project(":core")
58-
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
59-
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
60-
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
62+
implementation project(":core")
63+
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
64+
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
65+
implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
6166
}
6267
}
6368

64-
project(":android") {
65-
apply plugin: "android"
66-
67-
configurations { natives }
68-
69-
dependencies {
70-
compile project(":core")
71-
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
72-
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
73-
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
74-
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
75-
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
76-
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
77-
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
78-
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
79-
}
80-
}
69+
//project(":android") {
70+
// apply plugin: "android"
71+
//
72+
// configurations { natives }
73+
//
74+
// dependencies {
75+
// implementation project(":core")
76+
// implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
77+
// natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
78+
// natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
79+
// natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
80+
// implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
81+
// natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
82+
// natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
83+
// natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
84+
// }
85+
//}
8186

8287
project(":core") {
8388
apply plugin: "java"
8489

8590

8691
dependencies {
87-
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
88-
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
92+
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
93+
implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
94+
implementation "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion"
8995
}
9096
}
9197

core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
apply plugin: "java"
2121

22-
sourceCompatibility = 1.6
22+
sourceCompatibility = 1.8
2323
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
2424

2525
sourceSets.main.java.srcDirs = [ "src/" ]

core/src/at/therefactory/jewelthief/Game.java

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,27 @@ private void calculateScore() {
344344
// build game end phrase to display in dialog
345345
String[] applausePhrases = bundle.get(APPLAUSE_PHRASES).split(";");
346346
String[] motivationPhrases = bundle.get(MOTIVATION_PHRASES).split(";");
347-
gameEndPhrase = bundle
348-
.format(GAME_END_PHRASE,
349-
Math.max(0, currentScore),
350-
player.getNumCollectedJewels(),
351-
Utils.secondsToTimeString(numSeconds),
352-
currentScore > bestScore ? bundle.get(IMPROVED_HIGHSCORE) : bundle
353-
.get(MISSED_HIGHSCORE), currentScore > bestScore ? (currentScore - bestScore)
354-
: Math.abs(Math.max(0, currentScore) - bestScore),
355-
currentScore > bestScore ? applausePhrases[Utils.randomWithin(0, applausePhrases.length - 1)]
356-
: motivationPhrases[Utils.randomWithin(0, motivationPhrases.length - 1)]);
347+
// gameEndPhrase = bundle
348+
// .format(GAME_END_PHRASE,
349+
// Math.max(0, currentScore),
350+
// player.getNumCollectedJewels(),
351+
// Utils.secondsToTimeString(numSeconds),
352+
// currentScore > bestScore ? bundle.get(IMPROVED_HIGHSCORE) : bundle
353+
// .get(MISSED_HIGHSCORE), currentScore > bestScore ? (currentScore - bestScore)
354+
// : Math.abs(Math.max(0, currentScore) - bestScore),
355+
// currentScore > bestScore ? applausePhrases[Utils.randomWithin(0, applausePhrases.length - 1)]
356+
// : motivationPhrases[Utils.randomWithin(0, motivationPhrases.length - 1)]);
357+
int score = Math.max(0, currentScore);
358+
gameEndPhrase = "You scored "
359+
+ (score == 0 ? "no points" : (score == 1 ? "one point" : score + " points"))
360+
+ " ("
361+
+ (player.getNumCollectedJewels() == 1 ? "1 jewel" : player.getNumCollectedJewels() + " jewels")
362+
+ " in "
363+
+ Utils.secondsToTimeString(numSeconds) + ")\nand "
364+
+ (currentScore > bestScore ? bundle.get(IMPROVED_HIGHSCORE) : bundle.get(MISSED_HIGHSCORE)) + " "
365+
+ (currentScore > bestScore ? (currentScore - bestScore) : Math.abs(Math.max(0, currentScore) - bestScore))
366+
+ "\n\n" + (currentScore > bestScore ? applausePhrases[Utils.randomWithin(0, applausePhrases.length - 1)]
367+
: motivationPhrases[Utils.randomWithin(0, motivationPhrases.length - 1)]);
357368

358369
if (currentScore > bestScore) {
359370
renderFireworksEffect = true;

core/src/at/therefactory/jewelthief/constants/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public class Config {
8888

8989
// application
9090
public static final String DEFAULT_LOCALE = "en"; // en, de, es
91-
public static final String VERSION_NAME = "2018.9";
91+
public static final String VERSION_NAME = "2.0";
9292

9393
// ui
9494
public static final long TIME_PLAYER_STAYS_RED_WHEN_HURT = 400; // in ms

core/src/at/therefactory/jewelthief/input/GameScreenInputAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public GameScreenInputAdapter(Game game, Viewport viewport, Hud hud) {
7070
@Override
7171
public boolean keyDown(int keycode) {
7272
boolean returnValue = super.keyDown(keycode);
73-
if (keycode == Keys.BACK) {
73+
if (keycode == Keys.BACK || keycode == Keys.BUTTON_B) {
7474
if (game.isMenuShown()) {
7575
JewelThief.getInstance().switchToMainMenu();
7676
return true;

core/src/at/therefactory/jewelthief/input/KeyboardInputListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void input(String text) {
3636
text = text.trim().replaceAll(" ", "_");
3737
HttpServer.changeName(JewelThief.getInstance().getPreferences().getString("id"), text);
3838
if (text.length() == 0) {
39-
JewelThief.getInstance().getPreferences().putInteger(PrefsKeys.MY_RANK, -1);
39+
JewelThief.getInstance().getPreferences().putInteger(PrefsKeys.MY_RANK, -1).flush();
4040
}
4141
} else {
4242
JewelThief.getInstance().toast(JewelThief.getInstance().getBundle().format(I18NKeys.NAME_MUST_BE_SHORTER_THAN, PLAYERNAME_MAXLEN + 1), true);

core/src/at/therefactory/jewelthief/input/MenuScreenInputAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public MenuScreenInputAdapter(MenuScreen menuScreen, FitViewport viewport) {
6868

6969
@Override
7070
public boolean keyDown(int keycode) {
71-
if (keycode == Input.Keys.BACK) {
71+
if (keycode == Input.Keys.BACK || keycode == Input.Keys.BUTTON_B) {
7272
if (menuScreen.getState().equals(MenuScreen.MenuState.ShowSettings)
7373
|| menuScreen.getState().equals(MenuScreen.MenuState.ShowHighscores)
7474
|| menuScreen.getState().equals(MenuScreen.MenuState.ShowAbout)) {

core/src/at/therefactory/jewelthief/misc/Utils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ public static CharSequence secondsToTimeString(int numSeconds) {
9898
int hours = numSeconds / 3600;
9999
int minutes = (numSeconds - (hours * 3600)) / 60;
100100
int seconds = Math.max(0, numSeconds - (hours * 3600) - (minutes * 60));
101-
return (hours > 0 ? String.format("%2s", hours).replace(' ', '0') + ":" : "")
102-
+ String.format("%2s", minutes).replace(' ', '0')
103-
+ ":" + String.format("%2s", seconds).replace(' ', '0');
101+
// return (hours > 0 ? String.format("%2s", hours).replace(' ', '0') + ":" : "")
102+
// + String.format("%2s", minutes).replace(' ', '0')
103+
// + ":" + String.format("%2s", seconds).replace(' ', '0');
104+
return "" + (minutes < 10 ? "0" : "") + minutes + ":" + (seconds < 10 ? "0" : "") + seconds;
104105
}
105106

106107
/**

0 commit comments

Comments
 (0)