diff --git a/core/src/ru/deadsoftware/cavedroid/CaveGame.java b/core/src/ru/deadsoftware/cavedroid/CaveGame.java
index 177f25fa90fff57510132a419eb8517dcbbc088e..9ca34b8e0507a5a42523accf769469847185661a 100644 (file)
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.Graphics;
import ru.deadsoftware.cavedroid.game.GameScreen;
import ru.deadsoftware.cavedroid.misc.Assets;
import ru.deadsoftware.cavedroid.misc.utils.AssetLoader;
import ru.deadsoftware.cavedroid.game.GameScreen;
import ru.deadsoftware.cavedroid.misc.Assets;
import ru.deadsoftware.cavedroid.misc.utils.AssetLoader;
+import ru.deadsoftware.cavedroid.prefs.PreferencesStore;
import javax.annotation.Nullable;
import javax.annotation.Nullable;
private static final String TAG = "CaveGame";
private static final String TAG = "CaveGame";
- public static final String VERSION = "alpha 0.6.0";
+ public static final String VERSION = "alpha 0.9.2";
private final MainConfig mMainConfig;
private final MainComponent mMainComponent;
private final MainConfig mMainConfig;
private final MainComponent mMainComponent;
@Nullable
private final String mAssetsPackPath;
@Nullable
private final String mAssetsPackPath;
- public CaveGame(String gameFolder, boolean touch, @Nullable String assetsPackPath) {
+ public CaveGame(String gameFolder,
+ boolean touch,
+ PreferencesStore preferencesStore,
+ @Nullable String assetsPackPath) {
mGameFolder = gameFolder;
mTouch = touch;
mAssetsPackPath = assetsPackPath;
mGameFolder = gameFolder;
mTouch = touch;
mAssetsPackPath = assetsPackPath;
- mMainComponent = DaggerMainComponent.builder().caveGame(this).build();
+ mMainComponent = DaggerMainComponent
+ .builder()
+ .caveGame(this)
+ .preferencesStore(preferencesStore)
+ .build();
mMainConfig = mMainComponent.getMainConfig();
mAssetLoader = mMainComponent.getAssetLoader();
mMainConfig = mMainComponent.getMainConfig();
mAssetLoader = mMainComponent.getAssetLoader();
}
private void initConfig() {
}
private void initConfig() {
- int width = mTouch ? 320 : 480;
+ int width = 480;
int height = (int) (width * ((float) Gdx.graphics.getHeight() / Gdx.graphics.getWidth()));
mMainConfig.setMainComponent(mMainComponent);
int height = (int) (width * ((float) Gdx.graphics.getHeight() / Gdx.graphics.getWidth()));
mMainConfig.setMainComponent(mMainComponent);
} else {
Gdx.app.setLogLevel(Application.LOG_ERROR);
}
} else {
Gdx.app.setLogLevel(Application.LOG_ERROR);
}
+
+ mMainConfig.setFullscreenToggleListener((value) -> {
+ if (value) {
+ Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
+ } else {
+ Gdx.graphics.setWindowedMode(width, height);
+ }
+ });
}
public void newGame(int gameMode) {
}
public void newGame(int gameMode) {