mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
fix bug while switching game modes and forcing an exit
- aldo update new_game_mobile.json
This commit is contained in:
@@ -66,7 +66,7 @@ public class Forge implements ApplicationListener {
|
|||||||
static Batch animationBatch;
|
static Batch animationBatch;
|
||||||
static Texture transitionTexture;
|
static Texture transitionTexture;
|
||||||
static TextureRegion lastScreenTexture;
|
static TextureRegion lastScreenTexture;
|
||||||
private static boolean sceneWasSwapped =false;
|
private static boolean sceneWasSwapped = false;
|
||||||
private static Clipboard clipboard;
|
private static Clipboard clipboard;
|
||||||
private static IDeviceAdapter deviceAdapter;
|
private static IDeviceAdapter deviceAdapter;
|
||||||
private static int screenWidth;
|
private static int screenWidth;
|
||||||
@@ -134,6 +134,7 @@ public class Forge implements ApplicationListener {
|
|||||||
GuiBase.setDeviceInfo(deviceName, AndroidRelease, AndroidAPI, totalRAM);
|
GuiBase.setDeviceInfo(deviceName, AndroidRelease, AndroidAPI, totalRAM);
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Forge() {
|
private Forge() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,8 +172,7 @@ public class Forge implements ApplicationListener {
|
|||||||
String skinName;
|
String skinName;
|
||||||
if (FileUtil.doesFileExist(ForgeConstants.MAIN_PREFS_FILE)) {
|
if (FileUtil.doesFileExist(ForgeConstants.MAIN_PREFS_FILE)) {
|
||||||
skinName = prefs.getPref(FPref.UI_SKIN);
|
skinName = prefs.getPref(FPref.UI_SKIN);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
skinName = "default"; //use default skin if preferences file doesn't exist yet
|
skinName = "default"; //use default skin if preferences file doesn't exist yet
|
||||||
}
|
}
|
||||||
FSkin.loadLight(skinName, splashScreen);
|
FSkin.loadLight(skinName, splashScreen);
|
||||||
@@ -195,8 +195,8 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
if (autoCache) {
|
if (autoCache) {
|
||||||
//increase cacheSize for devices with RAM more than 5GB, default is 400. Some phones have more than 10GB RAM (Mi 10, OnePlus 8, S20, etc..)
|
//increase cacheSize for devices with RAM more than 5GB, default is 400. Some phones have more than 10GB RAM (Mi 10, OnePlus 8, S20, etc..)
|
||||||
if (totalDeviceRAM>5000) //devices with more than 10GB RAM will have 800 Cache size, 600 Cache size for morethan 5GB RAM
|
if (totalDeviceRAM > 5000) //devices with more than 10GB RAM will have 800 Cache size, 600 Cache size for morethan 5GB RAM
|
||||||
cacheSize = totalDeviceRAM>10000 ? 800: 600;
|
cacheSize = totalDeviceRAM > 10000 ? 800 : 600;
|
||||||
}
|
}
|
||||||
//init cache
|
//init cache
|
||||||
ImageCache.initCache(cacheSize);
|
ImageCache.initCache(cacheSize);
|
||||||
@@ -208,7 +208,9 @@ public class Forge implements ApplicationListener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
//see if app or assets need updating
|
//see if app or assets need updating
|
||||||
AssetsDownloader.checkForUpdates(splashScreen);
|
AssetsDownloader.checkForUpdates(splashScreen);
|
||||||
if (exited) { return; } //don't continue if user chose to exit or couldn't download required assets
|
if (exited) {
|
||||||
|
return;
|
||||||
|
} //don't continue if user chose to exit or couldn't download required assets
|
||||||
|
|
||||||
ImageKeys.setIsLibGDXPort(GuiBase.getInterface().isLibgdxPort());
|
ImageKeys.setIsLibGDXPort(GuiBase.getInterface().isLibgdxPort());
|
||||||
FModel.initialize(splashScreen.getProgressBar(), null);
|
FModel.initialize(splashScreen.getProgressBar(), null);
|
||||||
@@ -223,13 +225,13 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
//add reminder to preload
|
//add reminder to preload
|
||||||
if (enablePreloadExtendedArt) {
|
if (enablePreloadExtendedArt) {
|
||||||
if(autoCache)
|
if (autoCache)
|
||||||
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblPreloadExtendedArt")+"\nDetected RAM: " +totalDeviceRAM+"MB. Cache size: "+cacheSize);
|
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblPreloadExtendedArt") + "\nDetected RAM: " + totalDeviceRAM + "MB. Cache size: " + cacheSize);
|
||||||
else
|
else
|
||||||
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblPreloadExtendedArt"));
|
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblPreloadExtendedArt"));
|
||||||
} else {
|
} else {
|
||||||
if(autoCache)
|
if (autoCache)
|
||||||
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblFinishingStartup")+"\nDetected RAM: " +totalDeviceRAM+"MB. Cache size: "+cacheSize);
|
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblFinishingStartup") + "\nDetected RAM: " + totalDeviceRAM + "MB. Cache size: " + cacheSize);
|
||||||
else
|
else
|
||||||
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblFinishingStartup"));
|
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblFinishingStartup"));
|
||||||
}
|
}
|
||||||
@@ -250,6 +252,7 @@ public class Forge implements ApplicationListener {
|
|||||||
public static InputProcessor getInputProcessor() {
|
public static InputProcessor getInputProcessor() {
|
||||||
return inputProcessor;
|
return inputProcessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Graphics getGraphics() {
|
public static Graphics getGraphics() {
|
||||||
return graphics;
|
return graphics;
|
||||||
}
|
}
|
||||||
@@ -259,24 +262,26 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void preloadExtendedArt() {
|
private void preloadExtendedArt() {
|
||||||
if (!enablePreloadExtendedArt||!enableUIMask.equals("Full"))
|
if (!enablePreloadExtendedArt || !enableUIMask.equals("Full"))
|
||||||
return;
|
return;
|
||||||
List<String> borderlessCardlistkeys = FileUtil.readFile(ForgeConstants.BORDERLESS_CARD_LIST_FILE);
|
List<String> borderlessCardlistkeys = FileUtil.readFile(ForgeConstants.BORDERLESS_CARD_LIST_FILE);
|
||||||
if(borderlessCardlistkeys.isEmpty())
|
if (borderlessCardlistkeys.isEmpty())
|
||||||
return;
|
return;
|
||||||
List<String> filteredkeys = new ArrayList<>();
|
List<String> filteredkeys = new ArrayList<>();
|
||||||
for (String cardname : borderlessCardlistkeys){
|
for (String cardname : borderlessCardlistkeys) {
|
||||||
File image = new File(ForgeConstants.CACHE_CARD_PICS_DIR+ForgeConstants.PATH_SEPARATOR+cardname+".jpg");
|
File image = new File(ForgeConstants.CACHE_CARD_PICS_DIR + ForgeConstants.PATH_SEPARATOR + cardname + ".jpg");
|
||||||
if (image.exists())
|
if (image.exists())
|
||||||
filteredkeys.add(cardname);
|
filteredkeys.add(cardname);
|
||||||
}
|
}
|
||||||
if (!filteredkeys.isEmpty())
|
if (!filteredkeys.isEmpty())
|
||||||
ImageCache.preloadCache(filteredkeys);
|
ImageCache.preloadCache(filteredkeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void preloadBoosterDrafts() {
|
private void preloadBoosterDrafts() {
|
||||||
//preloading of custom drafts
|
//preloading of custom drafts
|
||||||
BoosterDraft.initializeCustomDrafts();
|
BoosterDraft.initializeCustomDrafts();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openHomeScreen(int index, FScreen lastMatch) {
|
public static void openHomeScreen(int index, FScreen lastMatch) {
|
||||||
openScreen(HomeScreen.instance);
|
openScreen(HomeScreen.instance);
|
||||||
HomeScreen.instance.openMenu(index);
|
HomeScreen.instance.openMenu(index);
|
||||||
@@ -291,6 +296,7 @@ public class Forge implements ApplicationListener {
|
|||||||
/*for (FScreen fScreen : Dscreens)
|
/*for (FScreen fScreen : Dscreens)
|
||||||
System.out.println(fScreen.toString());*/
|
System.out.println(fScreen.toString());*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openHomeDefault() {
|
public static void openHomeDefault() {
|
||||||
GuiBase.setIsAdventureMode(false);
|
GuiBase.setIsAdventureMode(false);
|
||||||
openHomeScreen(-1, null); //default for startup
|
openHomeScreen(-1, null); //default for startup
|
||||||
@@ -300,6 +306,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
stopContinuousRendering(); //save power consumption by disabling continuous rendering once assets loaded
|
stopContinuousRendering(); //save power consumption by disabling continuous rendering once assets loaded
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openAdventure() {
|
public static void openAdventure() {
|
||||||
//continuous rendering is needed for adventure mode
|
//continuous rendering is needed for adventure mode
|
||||||
startContinuousRendering();
|
startContinuousRendering();
|
||||||
@@ -314,11 +321,14 @@ public class Forge implements ApplicationListener {
|
|||||||
sceneType.instance.resLoaded();
|
sceneType.instance.resLoaded();
|
||||||
}
|
}
|
||||||
switchScene(SceneType.StartScene.instance);
|
switchScene(SceneType.StartScene.instance);
|
||||||
} catch (Exception e) { e.printStackTrace(); }
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void afterDbLoaded() {
|
protected void afterDbLoaded() {
|
||||||
//init here to fix crash if the assets are missing
|
//init here to fix crash if the assets are missing
|
||||||
transitionTexture = new Texture(GuiBase.isAndroid() ? Gdx.files.internal("fallback_skin").child("transition.png") : Gdx.files.classpath("fallback_skin").child("transition.png"));
|
transitionTexture = new Texture(GuiBase.isAndroid() ? Gdx.files.internal("fallback_skin").child("transition.png") : Gdx.files.classpath("fallback_skin").child("transition.png"));
|
||||||
|
|
||||||
|
|
||||||
destroyThis = false; //Allow back()
|
destroyThis = false; //Allow back()
|
||||||
@@ -364,6 +374,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCursor(TextureRegion textureRegion, String name) {
|
public static void setCursor(TextureRegion textureRegion, String name) {
|
||||||
if (GuiBase.isAndroid())
|
if (GuiBase.isAndroid())
|
||||||
return;
|
return;
|
||||||
@@ -379,7 +390,7 @@ public class Forge implements ApplicationListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String path = "skin/cursor"+name+".png";
|
String path = "skin/cursor" + name + ".png";
|
||||||
Pixmap pm = new Pixmap(Config.instance().getFile(path));
|
Pixmap pm = new Pixmap(Config.instance().getFile(path));
|
||||||
|
|
||||||
if (name == "0") {
|
if (name == "0") {
|
||||||
@@ -444,9 +455,11 @@ public class Forge implements ApplicationListener {
|
|||||||
cursorName = name;
|
cursorName = name;
|
||||||
pm.dispose();
|
pm.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setGdxCursor(Cursor c) {
|
static void setGdxCursor(Cursor c) {
|
||||||
Gdx.graphics.setCursor(c);
|
Gdx.graphics.setCursor(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Clipboard getClipboard() {
|
public static Clipboard getClipboard() {
|
||||||
return clipboard;
|
return clipboard;
|
||||||
}
|
}
|
||||||
@@ -461,6 +474,7 @@ public class Forge implements ApplicationListener {
|
|||||||
Gdx.graphics.setContinuousRendering(true);
|
Gdx.graphics.setContinuousRendering(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void stopContinuousRendering() {
|
public static void stopContinuousRendering() {
|
||||||
if (continuousRenderingCount > 0 && --continuousRenderingCount == 0) {
|
if (continuousRenderingCount > 0 && --continuousRenderingCount == 0) {
|
||||||
//only set continuous rendering to false if all continuous rendering requests have been ended
|
//only set continuous rendering to false if all continuous rendering requests have been ended
|
||||||
@@ -477,14 +491,12 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void adjustHeightModifier(float DisplayW, float DisplayH) {
|
public static void adjustHeightModifier(float DisplayW, float DisplayH) {
|
||||||
if(isLandscapeMode())
|
if (isLandscapeMode()) {//TODO: Fullscreen support for Display without screen controls
|
||||||
{//TODO: Fullscreen support for Display without screen controls
|
|
||||||
float aspectratio = DisplayW / DisplayH;
|
float aspectratio = DisplayW / DisplayH;
|
||||||
if(aspectratio > 1.82f) {/* extra wide */
|
if (aspectratio > 1.82f) {/* extra wide */
|
||||||
setHeightModifier(200.0f);
|
setHeightModifier(200.0f);
|
||||||
extrawide = "extrawide";
|
extrawide = "extrawide";
|
||||||
}
|
} else if (aspectratio > 1.7f) {/* wide */
|
||||||
else if(aspectratio > 1.7f) {/* wide */
|
|
||||||
setHeightModifier(100.0f);
|
setHeightModifier(100.0f);
|
||||||
extrawide = "wide";
|
extrawide = "wide";
|
||||||
}
|
}
|
||||||
@@ -509,12 +521,13 @@ public class Forge implements ApplicationListener {
|
|||||||
public static void back() {
|
public static void back() {
|
||||||
back(false);
|
back(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void back(boolean clearlastMatch) {
|
public static void back(boolean clearlastMatch) {
|
||||||
if (isMobileAdventureMode) {
|
if (isMobileAdventureMode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FScreen lastMatch = currentScreen;
|
FScreen lastMatch = currentScreen;
|
||||||
if(destroyThis && isLandscapeMode())
|
if (destroyThis && isLandscapeMode())
|
||||||
return;
|
return;
|
||||||
if (Dscreens.size() < 2 || (currentScreen == HomeScreen.instance && Forge.isPortraitMode)) {
|
if (Dscreens.size() < 2 || (currentScreen == HomeScreen.instance && Forge.isPortraitMode)) {
|
||||||
exit(false); //prompt to exit if attempting to go back from home screen
|
exit(false); //prompt to exit if attempting to go back from home screen
|
||||||
@@ -554,7 +567,9 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void restart(boolean silent) {
|
public static void restart(boolean silent) {
|
||||||
if (exited) { return; } //don't allow exiting multiple times
|
if (exited) {
|
||||||
|
return;
|
||||||
|
} //don't allow exiting multiple times
|
||||||
|
|
||||||
Callback<Boolean> callback = new Callback<Boolean>() {
|
Callback<Boolean> callback = new Callback<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -570,8 +585,7 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
if (silent) {
|
if (silent) {
|
||||||
callback.run(true);
|
callback.run(true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
FOptionPane.showConfirmDialog(
|
FOptionPane.showConfirmDialog(
|
||||||
localizer.getMessage("lblAreYouSureYouWishRestartForge"), localizer.getMessage("lblRestartForge"),
|
localizer.getMessage("lblAreYouSureYouWishRestartForge"), localizer.getMessage("lblRestartForge"),
|
||||||
localizer.getMessage("lblRestart"), localizer.getMessage("lblCancel"), callback);
|
localizer.getMessage("lblRestart"), localizer.getMessage("lblCancel"), callback);
|
||||||
@@ -579,7 +593,9 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void exit(boolean silent) {
|
public static void exit(boolean silent) {
|
||||||
if (exited) { return; } //don't allow exiting multiple times
|
if (exited) {
|
||||||
|
return;
|
||||||
|
} //don't allow exiting multiple times
|
||||||
|
|
||||||
final Localizer localizer = Localizer.getInstance();
|
final Localizer localizer = Localizer.getInstance();
|
||||||
final String title = Forge.isLandscapeMode() && GuiBase.isAndroid() ? "" : localizer.getMessage("lblExitForge");
|
final String title = Forge.isLandscapeMode() && GuiBase.isAndroid() ? "" : localizer.getMessage("lblExitForge");
|
||||||
@@ -603,18 +619,20 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
if (silent) {
|
if (silent) {
|
||||||
callback.run(0);
|
callback.run(0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
FOptionPane.showOptionDialog(localizer.getMessage("lblAreYouSureYouWishExitForge"), title,
|
FOptionPane.showOptionDialog(localizer.getMessage("lblAreYouSureYouWishExitForge"), title,
|
||||||
FOptionPane.QUESTION_ICON, options,0, callback);
|
FOptionPane.QUESTION_ICON, options, 0, callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openScreen(final FScreen screen0) {
|
public static void openScreen(final FScreen screen0) {
|
||||||
openScreen(screen0, false);
|
openScreen(screen0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openScreen(final FScreen screen0, final boolean replaceBackScreen) {
|
public static void openScreen(final FScreen screen0, final boolean replaceBackScreen) {
|
||||||
if (currentScreen == screen0) { return; }
|
if (currentScreen == screen0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (currentScreen == null) {
|
if (currentScreen == null) {
|
||||||
Dscreens.addFirst(screen0);
|
Dscreens.addFirst(screen0);
|
||||||
@@ -649,11 +667,11 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTextureFilteringEnabled() {
|
public static boolean isTextureFilteringEnabled() {
|
||||||
return textureFiltering;
|
return textureFiltering;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLandscapeMode() {
|
public static boolean isLandscapeMode() {
|
||||||
if(GuiBase.isAndroid())
|
if (GuiBase.isAndroid())
|
||||||
return !isPortraitMode;
|
return !isPortraitMode;
|
||||||
return screenWidth > screenHeight;
|
return screenWidth > screenHeight;
|
||||||
}
|
}
|
||||||
@@ -681,6 +699,7 @@ public class Forge implements ApplicationListener {
|
|||||||
public static void clearCurrentScreen() {
|
public static void clearCurrentScreen() {
|
||||||
currentScreen = null;
|
currentScreen = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void switchToClassic() {
|
public static void switchToClassic() {
|
||||||
setTransitionScreen(new TransitionScreen(new Runnable() {
|
setTransitionScreen(new TransitionScreen(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -690,11 +709,13 @@ public class Forge implements ApplicationListener {
|
|||||||
setCursor(FSkin.getCursor().get(0), "0");
|
setCursor(FSkin.getCursor().get(0), "0");
|
||||||
altZoneTabs = FModel.getPreferences().getPrefBoolean(FPref.UI_ALT_PLAYERZONETABS);
|
altZoneTabs = FModel.getPreferences().getPrefBoolean(FPref.UI_ALT_PLAYERZONETABS);
|
||||||
Gdx.input.setInputProcessor(getInputProcessor());
|
Gdx.input.setInputProcessor(getInputProcessor());
|
||||||
openHomeDefault();
|
|
||||||
clearTransitionScreen();
|
clearTransitionScreen();
|
||||||
|
openHomeDefault();
|
||||||
|
exited = false;
|
||||||
}
|
}
|
||||||
}, ScreenUtils.getFrameBufferTexture(), false, false));
|
}, ScreenUtils.getFrameBufferTexture(), false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void switchToAdventure() {
|
public static void switchToAdventure() {
|
||||||
setTransitionScreen(new TransitionScreen(new Runnable() {
|
setTransitionScreen(new TransitionScreen(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -702,12 +723,15 @@ public class Forge implements ApplicationListener {
|
|||||||
clearCurrentScreen();
|
clearCurrentScreen();
|
||||||
clearTransitionScreen();
|
clearTransitionScreen();
|
||||||
openAdventure();
|
openAdventure();
|
||||||
|
exited = false;
|
||||||
}
|
}
|
||||||
}, ScreenUtils.getFrameBufferTexture(), false, false));
|
}, ScreenUtils.getFrameBufferTexture(), false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setTransitionScreen(TransitionScreen screen) {
|
public static void setTransitionScreen(TransitionScreen screen) {
|
||||||
transitionScreen = screen;
|
transitionScreen = screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clearTransitionScreen() {
|
public static void clearTransitionScreen() {
|
||||||
transitionScreen = null;
|
transitionScreen = null;
|
||||||
}
|
}
|
||||||
@@ -715,6 +739,7 @@ public class Forge implements ApplicationListener {
|
|||||||
public static void clearSplashScreen() {
|
public static void clearSplashScreen() {
|
||||||
splashScreen = null;
|
splashScreen = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setCurrentScreen(FScreen screen0) {
|
private static void setCurrentScreen(FScreen screen0) {
|
||||||
String toNewScreen = screen0 != null ? screen0.toString() : "";
|
String toNewScreen = screen0 != null ? screen0.toString() : "";
|
||||||
String previousScreen = currentScreen != null ? currentScreen.toString() : "";
|
String previousScreen = currentScreen != null ? currentScreen.toString() : "";
|
||||||
@@ -727,14 +752,13 @@ public class Forge implements ApplicationListener {
|
|||||||
currentScreen = screen0;
|
currentScreen = screen0;
|
||||||
currentScreen.setSize(screenWidth, screenHeight);
|
currentScreen.setSize(screenWidth, screenHeight);
|
||||||
currentScreen.onActivate();
|
currentScreen.onActivate();
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
graphics.end();
|
graphics.end();
|
||||||
//check if sentry is enabled, if not it will call the gui interface but here we end the graphics so we only send it via sentry..
|
//check if sentry is enabled, if not it will call the gui interface but here we end the graphics so we only send it via sentry..
|
||||||
if (BugReporter.isSentryEnabled())
|
if (BugReporter.isSentryEnabled())
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex);
|
||||||
} finally {
|
} finally {
|
||||||
if(dispose)
|
if (dispose)
|
||||||
ImageCache.disposeTexture();
|
ImageCache.disposeTexture();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -754,58 +778,52 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
if (closingScreen != null) {
|
if (closingScreen != null) {
|
||||||
screen = closingScreen;
|
screen = closingScreen;
|
||||||
} else if(transitionScreen != null){
|
} else if (transitionScreen != null) {
|
||||||
screen = transitionScreen;
|
screen = transitionScreen;
|
||||||
} else if (screen == null) {
|
} else if (screen == null) {
|
||||||
screen = splashScreen;
|
screen = splashScreen;
|
||||||
if (screen == null) {
|
if (screen == null) {
|
||||||
if (isMobileAdventureMode) {
|
if (isMobileAdventureMode) {
|
||||||
try {
|
try {
|
||||||
float delta=Gdx.graphics.getDeltaTime();
|
float delta = Gdx.graphics.getDeltaTime();
|
||||||
float transitionTime = 0.2f;
|
float transitionTime = 0.2f;
|
||||||
if(sceneWasSwapped)
|
if (sceneWasSwapped) {
|
||||||
{
|
sceneWasSwapped = false;
|
||||||
sceneWasSwapped =false;
|
animationTimeout = transitionTime;
|
||||||
animationTimeout= transitionTime;
|
|
||||||
Gdx.gl.glClearColor(0, 0, 0, 1);
|
Gdx.gl.glClearColor(0, 0, 0, 1);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(animationTimeout>=0)
|
if (animationTimeout >= 0) {
|
||||||
{
|
|
||||||
Gdx.gl.glClearColor(0, 0, 0, 1);
|
Gdx.gl.glClearColor(0, 0, 0, 1);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
animationBatch.begin();
|
animationBatch.begin();
|
||||||
animationTimeout-=delta;
|
animationTimeout -= delta;
|
||||||
animationBatch.setColor(1,1,1,1);
|
animationBatch.setColor(1, 1, 1, 1);
|
||||||
animationBatch.draw(lastScreenTexture,0,0, Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
|
animationBatch.draw(lastScreenTexture, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
animationBatch.setColor(1,1,1,1-(1/ transitionTime)*animationTimeout);
|
animationBatch.setColor(1, 1, 1, 1 - (1 / transitionTime) * animationTimeout);
|
||||||
animationBatch.draw(transitionTexture,0,0, Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
|
animationBatch.draw(transitionTexture, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
animationBatch.draw(transitionTexture,0,0, Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
|
animationBatch.draw(transitionTexture, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
animationBatch.end();
|
animationBatch.end();
|
||||||
if(animationTimeout<0)
|
if (animationTimeout < 0) {
|
||||||
{
|
|
||||||
currentScene.render();
|
currentScene.render();
|
||||||
storeScreen();
|
storeScreen();
|
||||||
Gdx.gl.glClearColor(0, 0, 0, 1);
|
Gdx.gl.glClearColor(0, 0, 0, 1);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(animationTimeout>=-transitionTime)
|
if (animationTimeout >= -transitionTime) {
|
||||||
{
|
|
||||||
Gdx.gl.glClearColor(0, 0, 0, 1);
|
Gdx.gl.glClearColor(0, 0, 0, 1);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
animationBatch.begin();
|
animationBatch.begin();
|
||||||
animationTimeout-=delta;
|
animationTimeout -= delta;
|
||||||
animationBatch.setColor(1,1,1,1);
|
animationBatch.setColor(1, 1, 1, 1);
|
||||||
animationBatch.draw(lastScreenTexture,0,0, Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
|
animationBatch.draw(lastScreenTexture, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
animationBatch.setColor(1,1,1,(1/ transitionTime)*(animationTimeout+ transitionTime));
|
animationBatch.setColor(1, 1, 1, (1 / transitionTime) * (animationTimeout + transitionTime));
|
||||||
animationBatch.draw(transitionTexture,0,0, Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
|
animationBatch.draw(transitionTexture, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
animationBatch.draw(transitionTexture,0,0, Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
|
animationBatch.draw(transitionTexture, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
animationBatch.end();
|
animationBatch.end();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -844,8 +862,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
graphics.end();
|
graphics.end();
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
graphics.end();
|
graphics.end();
|
||||||
//check if sentry is enabled, if not it will call the gui interface but here we end the graphics so we only send it via sentry..
|
//check if sentry is enabled, if not it will call the gui interface but here we end the graphics so we only send it via sentry..
|
||||||
if (BugReporter.isSentryEnabled())
|
if (BugReporter.isSentryEnabled())
|
||||||
@@ -854,6 +871,7 @@ public class Forge implements ApplicationListener {
|
|||||||
if (showFPS)
|
if (showFPS)
|
||||||
frameRate.render();
|
frameRate.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void delayedSwitchBack() {
|
public static void delayedSwitchBack() {
|
||||||
FThreads.invokeInBackgroundThread(new Runnable() {
|
FThreads.invokeInBackgroundThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -869,6 +887,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resize(int width, int height) {
|
public void resize(int width, int height) {
|
||||||
try {
|
try {
|
||||||
@@ -876,12 +895,10 @@ public class Forge implements ApplicationListener {
|
|||||||
screenHeight = height;
|
screenHeight = height;
|
||||||
if (currentScreen != null) {
|
if (currentScreen != null) {
|
||||||
currentScreen.setSize(width, height);
|
currentScreen.setSize(width, height);
|
||||||
}
|
} else if (splashScreen != null) {
|
||||||
else if (splashScreen != null) {
|
|
||||||
splashScreen.setSize(width, height);
|
splashScreen.setSize(width, height);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
graphics.end();
|
graphics.end();
|
||||||
//check if sentry is enabled, if not it will call the gui interface but here we end the graphics so we only send it via sentry..
|
//check if sentry is enabled, if not it will call the gui interface but here we end the graphics so we only send it via sentry..
|
||||||
if (BugReporter.isSentryEnabled())
|
if (BugReporter.isSentryEnabled())
|
||||||
@@ -915,8 +932,8 @@ public class Forge implements ApplicationListener {
|
|||||||
SoundSystem.instance.dispose();
|
SoundSystem.instance.dispose();
|
||||||
try {
|
try {
|
||||||
ExceptionHandler.unregisterErrorHandling();
|
ExceptionHandler.unregisterErrorHandling();
|
||||||
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
catch (Exception e) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean switchScene(Scene newScene) {
|
public static boolean switchScene(Scene newScene) {
|
||||||
@@ -926,7 +943,7 @@ public class Forge implements ApplicationListener {
|
|||||||
lastScene.add(currentScene);
|
lastScene.add(currentScene);
|
||||||
}
|
}
|
||||||
storeScreen();
|
storeScreen();
|
||||||
sceneWasSwapped =true;
|
sceneWasSwapped = true;
|
||||||
if (newScene instanceof GameScene)
|
if (newScene instanceof GameScene)
|
||||||
MapStage.getInstance().clearIsInMap();
|
MapStage.getInstance().clearIsInMap();
|
||||||
currentScene = newScene;
|
currentScene = newScene;
|
||||||
@@ -935,35 +952,37 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static void storeScreen() {
|
protected static void storeScreen() {
|
||||||
if(!(currentScene instanceof ForgeScene))
|
if (!(currentScene instanceof ForgeScene)) {
|
||||||
{
|
if (lastScreenTexture != null)
|
||||||
if(lastScreenTexture!=null)
|
|
||||||
lastScreenTexture.getTexture().dispose();
|
lastScreenTexture.getTexture().dispose();
|
||||||
lastScreenTexture = ScreenUtils.getFrameBufferTexture();
|
lastScreenTexture = ScreenUtils.getFrameBufferTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Scene switchToLast() {
|
public static Scene switchToLast() {
|
||||||
|
|
||||||
if(lastScene.size!=0)
|
if (lastScene.size != 0) {
|
||||||
{
|
|
||||||
storeScreen();
|
storeScreen();
|
||||||
currentScene = lastScene.get(lastScene.size-1);
|
currentScene = lastScene.get(lastScene.size - 1);
|
||||||
currentScene.enter();
|
currentScene.enter();
|
||||||
sceneWasSwapped =true;
|
sceneWasSwapped = true;
|
||||||
lastScene.removeIndex(lastScene.size-1);
|
lastScene.removeIndex(lastScene.size - 1);
|
||||||
return currentScene;
|
return currentScene;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//log message to Forge.log file
|
//log message to Forge.log file
|
||||||
public static void log(Object message) {
|
public static void log(Object message) {
|
||||||
System.out.println(message);
|
System.out.println(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void startKeyInput(KeyInputAdapter adapter) {
|
public static void startKeyInput(KeyInputAdapter adapter) {
|
||||||
if (keyInputAdapter == adapter) { return; }
|
if (keyInputAdapter == adapter) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (keyInputAdapter != null) {
|
if (keyInputAdapter != null) {
|
||||||
keyInputAdapter.onInputEnd(); //make sure previous adapter is ended
|
keyInputAdapter.onInputEnd(); //make sure previous adapter is ended
|
||||||
}
|
}
|
||||||
@@ -972,7 +991,9 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean endKeyInput() {
|
public static boolean endKeyInput() {
|
||||||
if (keyInputAdapter == null) { return false; }
|
if (keyInputAdapter == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
keyInputAdapter.onInputEnd();
|
keyInputAdapter.onInputEnd();
|
||||||
keyInputAdapter = null;
|
keyInputAdapter = null;
|
||||||
MainInputProcessor.keyTyped = false;
|
MainInputProcessor.keyTyped = false;
|
||||||
@@ -982,6 +1003,8 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void exitAnimation(boolean restart) {
|
static void exitAnimation(boolean restart) {
|
||||||
|
if (transitionScreen != null)
|
||||||
|
return; //finish transition incase exit is touched
|
||||||
if (closingScreen == null) {
|
if (closingScreen == null) {
|
||||||
closingScreen = new ClosingScreen(restart);
|
closingScreen = new ClosingScreen(restart);
|
||||||
}
|
}
|
||||||
@@ -989,32 +1012,41 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
public static abstract class KeyInputAdapter {
|
public static abstract class KeyInputAdapter {
|
||||||
public abstract FDisplayObject getOwner();
|
public abstract FDisplayObject getOwner();
|
||||||
|
|
||||||
public abstract boolean allowTouchInput();
|
public abstract boolean allowTouchInput();
|
||||||
|
|
||||||
public abstract boolean keyTyped(char ch);
|
public abstract boolean keyTyped(char ch);
|
||||||
|
|
||||||
public abstract boolean keyDown(int keyCode);
|
public abstract boolean keyDown(int keyCode);
|
||||||
|
|
||||||
public abstract void onInputEnd();
|
public abstract void onInputEnd();
|
||||||
|
|
||||||
//also allow handling of keyUp but don't require it
|
//also allow handling of keyUp but don't require it
|
||||||
public boolean keyUp(int keyCode) { return false; }
|
public boolean keyUp(int keyCode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isCtrlKeyDown() {
|
public static boolean isCtrlKeyDown() {
|
||||||
return Gdx.input.isKeyPressed(Keys.CONTROL_LEFT) || Gdx.input.isKeyPressed(Keys.CONTROL_RIGHT);
|
return Gdx.input.isKeyPressed(Keys.CONTROL_LEFT) || Gdx.input.isKeyPressed(Keys.CONTROL_RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isShiftKeyDown() {
|
public static boolean isShiftKeyDown() {
|
||||||
return Gdx.input.isKeyPressed(Keys.SHIFT_LEFT) || Gdx.input.isKeyPressed(Keys.SHIFT_RIGHT);
|
return Gdx.input.isKeyPressed(Keys.SHIFT_LEFT) || Gdx.input.isKeyPressed(Keys.SHIFT_RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAltKeyDown() {
|
public static boolean isAltKeyDown() {
|
||||||
return Gdx.input.isKeyPressed(Keys.ALT_LEFT) || Gdx.input.isKeyPressed(Keys.ALT_RIGHT);
|
return Gdx.input.isKeyPressed(Keys.ALT_LEFT) || Gdx.input.isKeyPressed(Keys.ALT_RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isModifierKey(int keyCode) {
|
public static boolean isModifierKey(int keyCode) {
|
||||||
switch (keyCode) {
|
switch (keyCode) {
|
||||||
case Keys.CONTROL_LEFT:
|
case Keys.CONTROL_LEFT:
|
||||||
case Keys.CONTROL_RIGHT:
|
case Keys.CONTROL_RIGHT:
|
||||||
case Keys.SHIFT_LEFT:
|
case Keys.SHIFT_LEFT:
|
||||||
case Keys.SHIFT_RIGHT:
|
case Keys.SHIFT_RIGHT:
|
||||||
case Keys.ALT_LEFT:
|
case Keys.ALT_LEFT:
|
||||||
case Keys.ALT_RIGHT:
|
case Keys.ALT_RIGHT:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1038,25 +1070,25 @@ public class Forge implements ApplicationListener {
|
|||||||
// Cursor keys emulate swipe gestures
|
// Cursor keys emulate swipe gestures
|
||||||
// First we touch the screen and later swipe (fling) in the direction of the key pressed
|
// First we touch the screen and later swipe (fling) in the direction of the key pressed
|
||||||
if (keyCode == Keys.LEFT) {
|
if (keyCode == Keys.LEFT) {
|
||||||
touchDown(0,0,0,0);
|
touchDown(0, 0, 0, 0);
|
||||||
return fling(1000,0);
|
return fling(1000, 0);
|
||||||
}
|
}
|
||||||
if (keyCode == Keys.RIGHT) {
|
if (keyCode == Keys.RIGHT) {
|
||||||
touchDown(0,0,0,0);
|
touchDown(0, 0, 0, 0);
|
||||||
return fling(-1000,0);
|
return fling(-1000, 0);
|
||||||
}
|
}
|
||||||
if (keyCode == Keys.UP) {
|
if (keyCode == Keys.UP) {
|
||||||
touchDown(0,0,0,0);
|
touchDown(0, 0, 0, 0);
|
||||||
return fling(0,-1000);
|
return fling(0, -1000);
|
||||||
}
|
}
|
||||||
if (keyCode == Keys.DOWN) {
|
if (keyCode == Keys.DOWN) {
|
||||||
touchDown(0,0,0,0);
|
touchDown(0, 0, 0, 0);
|
||||||
return fling(0,1000);
|
return fling(0, 1000);
|
||||||
}
|
}
|
||||||
if(keyCode == Keys.BACK){
|
if (keyCode == Keys.BACK) {
|
||||||
if ((destroyThis && !isMobileAdventureMode)||(splashScreen != null && splashScreen.isShowModeSelector()))
|
if ((destroyThis && !isMobileAdventureMode) || (splashScreen != null && splashScreen.isShowModeSelector()))
|
||||||
exitAnimation(false);
|
exitAnimation(false);
|
||||||
else if(onHomeScreen() && isLandscapeMode())
|
else if (onHomeScreen() && isLandscapeMode())
|
||||||
back();
|
back();
|
||||||
}
|
}
|
||||||
if (keyInputAdapter == null) {
|
if (keyInputAdapter == null) {
|
||||||
@@ -1125,6 +1157,8 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean touchDown(int x, int y, int pointer, int button) {
|
public boolean touchDown(int x, int y, int pointer, int button) {
|
||||||
|
if (transitionScreen != null)
|
||||||
|
return false;
|
||||||
if (pointer == 0) { //don't change listeners when second finger goes down for zoom
|
if (pointer == 0) { //don't change listeners when second finger goes down for zoom
|
||||||
updatePotentialListeners(x, y);
|
updatePotentialListeners(x, y);
|
||||||
if (keyInputAdapter != null) {
|
if (keyInputAdapter != null) {
|
||||||
@@ -1146,8 +1180,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1162,8 +1195,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1178,8 +1210,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1197,8 +1228,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1213,8 +1243,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1229,8 +1258,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1245,8 +1273,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1261,8 +1288,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1277,8 +1303,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1286,6 +1311,7 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
//mouseMoved and scrolled events for desktop version
|
//mouseMoved and scrolled events for desktop version
|
||||||
private int mouseMovedX, mouseMovedY;
|
private int mouseMovedX, mouseMovedY;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseMoved(int screenX, int screenY) {
|
public boolean mouseMoved(int screenX, int screenY) {
|
||||||
magnify = true;
|
magnify = true;
|
||||||
@@ -1300,8 +1326,7 @@ public class Forge implements ApplicationListener {
|
|||||||
for (FDisplayObject listener : potentialListeners) {
|
for (FDisplayObject listener : potentialListeners) {
|
||||||
listener.setHovered(false);
|
listener.setHovered(false);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex);
|
||||||
}
|
}
|
||||||
updatePotentialListeners(screenX, screenY);
|
updatePotentialListeners(screenX, screenY);
|
||||||
@@ -1319,8 +1344,7 @@ public class Forge implements ApplicationListener {
|
|||||||
boolean handled;
|
boolean handled;
|
||||||
if (KeyInputAdapter.isShiftKeyDown()) {
|
if (KeyInputAdapter.isShiftKeyDown()) {
|
||||||
handled = pan(mouseMovedX, mouseMovedY, -Utils.AVG_FINGER_WIDTH * amountX, 0, false);
|
handled = pan(mouseMovedX, mouseMovedY, -Utils.AVG_FINGER_WIDTH * amountX, 0, false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
handled = pan(mouseMovedX, mouseMovedY, 0, -Utils.AVG_FINGER_HEIGHT * amountY, true);
|
handled = pan(mouseMovedX, mouseMovedY, 0, -Utils.AVG_FINGER_HEIGHT * amountY, true);
|
||||||
}
|
}
|
||||||
if (panStop(mouseMovedX, mouseMovedY)) {
|
if (panStop(mouseMovedX, mouseMovedY)) {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
"text": "Avatar:",
|
"text": "Avatar:",
|
||||||
"width": 128,
|
"width": 128,
|
||||||
"height": 32,
|
"height": 32,
|
||||||
|
"font" : "black",
|
||||||
"x": 104,
|
"x": 104,
|
||||||
"y": 58
|
"y": 58
|
||||||
},
|
},
|
||||||
@@ -39,6 +40,7 @@
|
|||||||
"text": "Name:",
|
"text": "Name:",
|
||||||
"width": 128,
|
"width": 128,
|
||||||
"height": 32,
|
"height": 32,
|
||||||
|
"font" : "black",
|
||||||
"x": 104,
|
"x": 104,
|
||||||
"y": 90
|
"y": 90
|
||||||
},
|
},
|
||||||
@@ -47,6 +49,7 @@
|
|||||||
"text": "Race:",
|
"text": "Race:",
|
||||||
"width": 128,
|
"width": 128,
|
||||||
"height": 32,
|
"height": 32,
|
||||||
|
"font" : "black",
|
||||||
"x": 104,
|
"x": 104,
|
||||||
"y": 124
|
"y": 124
|
||||||
},
|
},
|
||||||
@@ -55,6 +58,7 @@
|
|||||||
"text": "Gender:",
|
"text": "Gender:",
|
||||||
"width": 128,
|
"width": 128,
|
||||||
"height": 32,
|
"height": 32,
|
||||||
|
"font" : "black",
|
||||||
"x": 104,
|
"x": 104,
|
||||||
"y": 154
|
"y": 154
|
||||||
},
|
},
|
||||||
@@ -63,6 +67,7 @@
|
|||||||
"text": "Difficulty:",
|
"text": "Difficulty:",
|
||||||
"width": 128,
|
"width": 128,
|
||||||
"height": 32,
|
"height": 32,
|
||||||
|
"font" : "black",
|
||||||
"x": 104,
|
"x": 104,
|
||||||
"y": 186
|
"y": 186
|
||||||
},
|
},
|
||||||
@@ -71,6 +76,7 @@
|
|||||||
"text": "Deck:",
|
"text": "Deck:",
|
||||||
"width": 128,
|
"width": 128,
|
||||||
"height": 32,
|
"height": 32,
|
||||||
|
"font" : "black",
|
||||||
"x": 104,
|
"x": 104,
|
||||||
"y": 218
|
"y": 218
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user