Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
738 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,127 @@ | ||
# Compiled class file | ||
## Java | ||
|
||
*.class | ||
*.war | ||
*.ear | ||
hs_err_pid* | ||
|
||
# Log file | ||
*.log | ||
## Robovm | ||
/ios/robovm-build/ | ||
|
||
# BlueJ files | ||
*.ctxt | ||
## GWT | ||
/html/war/ | ||
/html/gwt-unitCache/ | ||
.apt_generated/ | ||
.gwt/ | ||
gwt-unitCache/ | ||
www-test/ | ||
.gwt-tmp/ | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
## Android Studio and Intellij and Android in general | ||
/android/libs/armeabi/ | ||
/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 | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
## Eclipse | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
.classpath | ||
.project | ||
.metadata/ | ||
/android/bin/ | ||
/core/bin/ | ||
/desktop/bin/ | ||
/html/bin/ | ||
/ios/bin/ | ||
/ios-moe/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/ | ||
/ios-moe/nbproject/private/ | ||
|
||
/build/ | ||
/android/build/ | ||
/core/build/ | ||
/desktop/build/ | ||
/html/build/ | ||
/ios/build/ | ||
/ios-moe/build/ | ||
|
||
/nbbuild/ | ||
/android/nbbuild/ | ||
/core/nbbuild/ | ||
/desktop/nbbuild/ | ||
/html/nbbuild/ | ||
/ios/nbbuild/ | ||
/ios-moe/nbbuild/ | ||
|
||
/dist/ | ||
/android/dist/ | ||
/core/dist/ | ||
/desktop/dist/ | ||
/html/dist/ | ||
/ios/dist/ | ||
/ios-moe/dist/ | ||
|
||
/nbdist/ | ||
/android/nbdist/ | ||
/core/nbdist/ | ||
/desktop/nbdist/ | ||
/html/nbdist/ | ||
/ios/nbdist/ | ||
/ios-moe/nbdist/ | ||
|
||
nbactions.xml | ||
nb-configuration.xml | ||
|
||
## Gradle | ||
|
||
/local.properties | ||
.gradle/ | ||
gradle-app.setting | ||
/build/ | ||
/android/build/ | ||
/core/build/ | ||
/desktop/build/ | ||
/html/build/ | ||
/ios/build/ | ||
/ios-moe/build/ | ||
|
||
## 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 | ||
|
||
/ios-moe/xcode/*.xcodeproj/* | ||
!/ios-moe/xcode/*.xcodeproj/xcshareddata | ||
!/ios-moe/xcode/*.xcodeproj/project.pbxproj | ||
/ios-moe/xcode/native/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
buildscript { | ||
|
||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
maven { url "https://plugins.gradle.org/m2/" } | ||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } | ||
jcenter() | ||
google() | ||
} | ||
dependencies { | ||
|
||
|
||
} | ||
} | ||
|
||
allprojects { | ||
apply plugin: "eclipse" | ||
|
||
version = '1.0' | ||
ext { | ||
appName = "shelter" | ||
gdxVersion = '1.9.10' | ||
roboVMVersion = '2.3.8' | ||
box2DLightsVersion = '1.4' | ||
ashleyVersion = '1.7.0' | ||
aiVersion = '1.8.0' | ||
braingdxVersion = '0.6.15' | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
jcenter() | ||
google() | ||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } | ||
maven { url "https://oss.sonatype.org/content/repositories/releases/" } | ||
} | ||
} | ||
|
||
project(":desktop") { | ||
apply plugin: "java-library" | ||
|
||
|
||
dependencies { | ||
implementation project(":core") | ||
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" | ||
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" | ||
api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" | ||
api "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion" | ||
api "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop" | ||
api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" | ||
|
||
} | ||
} | ||
|
||
project(":core") { | ||
apply plugin: "java-library" | ||
|
||
|
||
dependencies { | ||
api "com.badlogicgames.gdx:gdx:$gdxVersion" | ||
api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" | ||
api "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion" | ||
api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" | ||
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" | ||
compile "io.github.bitbrain:braingdx-2d:$braingdxVersion" | ||
compile "io.github.bitbrain:braingdx-2d:$braingdxVersion:sources" | ||
compile "io.github.bitbrain:braingdx-2d:$braingdxVersion:javadoc" | ||
compile "commons-lang:commons-lang:2.5" | ||
|
||
} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apply plugin: "java" | ||
|
||
sourceCompatibility = 1.7 | ||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' | ||
|
||
sourceSets.main.java.srcDirs = [ "src/" ] | ||
|
||
eclipse.project.name = appName + "-core" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package de.bitbrain.shelter; | ||
|
||
public interface Assets { | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package de.bitbrain.shelter; | ||
|
||
import com.badlogic.gdx.Application; | ||
import com.badlogic.gdx.Gdx; | ||
import de.bitbrain.braingdx.BrainGdxGame; | ||
import de.bitbrain.braingdx.GameSettings; | ||
import de.bitbrain.braingdx.assets.GameAssetLoader; | ||
import de.bitbrain.braingdx.assets.SmartAssetLoader; | ||
import de.bitbrain.braingdx.event.GameEventManagerImpl; | ||
import de.bitbrain.braingdx.graphics.GraphicsSettings; | ||
import de.bitbrain.braingdx.graphics.postprocessing.filters.RadialBlur; | ||
import de.bitbrain.braingdx.screens.AbstractScreen; | ||
import de.bitbrain.shelter.i18n.Bundle; | ||
import de.bitbrain.shelter.screens.IngameScreen; | ||
import de.bitbrain.shelter.ui.Styles; | ||
import org.apache.commons.lang.SystemUtils; | ||
|
||
public class ShelterGame extends BrainGdxGame { | ||
|
||
private enum ScreenMode { | ||
SCREENSHOT, | ||
GIF, | ||
FULLSCREEN | ||
} | ||
|
||
private ScreenMode screenMode; | ||
|
||
public ShelterGame(String[] args) { | ||
screenMode = ScreenMode.FULLSCREEN; | ||
for (String arg : args) { | ||
if (arg.equals("screenshot")) { | ||
screenMode = ScreenMode.SCREENSHOT; | ||
} | ||
if (arg.equals("gif")) { | ||
screenMode = ScreenMode.GIF; | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
protected GameAssetLoader getAssetLoader() { | ||
return new SmartAssetLoader(Assets.class); | ||
} | ||
|
||
@Override | ||
protected AbstractScreen<?, ?> getInitialScreen() { | ||
configureSettings(); | ||
Bundle.load(); | ||
Styles.init(); | ||
return new IngameScreen(this); | ||
} | ||
|
||
private void configureSettings() { | ||
GameSettings settings = new GameSettings(new GameEventManagerImpl()); | ||
GraphicsSettings graphicsSettings = settings.getGraphics(); | ||
if (Gdx.app.getType() == Application.ApplicationType.Desktop) { | ||
if (screenMode == ScreenMode.SCREENSHOT) { | ||
Gdx.graphics.setWindowedMode(3840, 2160); | ||
} else if (screenMode == ScreenMode.GIF) { | ||
Gdx.graphics.setWindowedMode(1248, 770); | ||
} else if (SystemUtils.IS_OS_WINDOWS) { | ||
Gdx.graphics.setUndecorated(true); | ||
Gdx.graphics.setWindowedMode(Gdx.graphics.getDisplayMode().width, Gdx.graphics.getDisplayMode().height); | ||
} else { | ||
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); | ||
} | ||
graphicsSettings.setRadialBlurQuality(RadialBlur.Quality.High); | ||
graphicsSettings.setRenderScale(0.3f); | ||
graphicsSettings.setParticleMultiplier(0.5f); | ||
graphicsSettings.save(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package de.bitbrain.shelter.i18n; | ||
|
||
import com.badlogic.gdx.Gdx; | ||
import com.badlogic.gdx.files.FileHandle; | ||
import com.badlogic.gdx.utils.I18NBundle; | ||
|
||
import java.util.Locale; | ||
import java.util.MissingResourceException; | ||
|
||
public final class Bundle { | ||
|
||
private static final String PATH = "i18n/translations"; | ||
|
||
private static I18NBundle translations; | ||
|
||
private static FileHandle generalHandle; | ||
|
||
public static void load() { | ||
Gdx.app.log("LOAD", "Loading translation bundles..."); | ||
generalHandle = Gdx.files.internal(PATH); | ||
setLocale(Locale.getDefault()); | ||
Gdx.app.log("INFO", "Done loading translation bundles."); | ||
} | ||
|
||
public static String get(Messages key) { | ||
return get(key.getKey()); | ||
} | ||
|
||
public static String get(String key) { | ||
try { | ||
return translations.get(key); | ||
} catch (MissingResourceException ex) { | ||
Gdx.app.error("Translations", "Unable to resolve translation for key=" + key + " and locale=" + translations.getLocale()); | ||
return key; | ||
} | ||
} | ||
|
||
public static void setLocale(Locale locale) { | ||
Gdx.app.log("INFO", "Set locale to '" + locale + "'"); | ||
translations = I18NBundle.createBundle(generalHandle, locale); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package de.bitbrain.shelter.i18n; | ||
|
||
public enum Messages { | ||
|
||
PLAY_GAME("play.game"); | ||
|
||
private final String key; | ||
|
||
Messages(String key) { | ||
this.key = key; | ||
} | ||
|
||
public String getKey() { | ||
return key; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
core/src/de/bitbrain/shelter/input/ingame/IngameKeyboardAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package de.bitbrain.shelter.input.ingame; | ||
|
||
import com.badlogic.gdx.Gdx; | ||
import com.badlogic.gdx.Input; | ||
import com.badlogic.gdx.InputAdapter; | ||
import de.bitbrain.braingdx.util.Updateable; | ||
|
||
public class IngameKeyboardAdapter extends InputAdapter implements Updateable { | ||
|
||
@Override | ||
public void update(float delta) { | ||
if (Gdx.input.isKeyPressed(Input.Keys.ESCAPE)) { | ||
Gdx.app.exit(); | ||
} | ||
} | ||
} |
Oops, something went wrong.