Update #8 - Added ayunami's seamless fullscreen controls

When you enter fullscreen via F11 or video settings you can now use regular ESC again to pause and unpause the game and close your inventory and use CTRL as the sprint key without closing the tab.

This greatly improves user experience when you are a new player and don't understand yet that regular vanilla ESC and CTRL+W messes up the game.
This commit is contained in:
LAX1DUDE
2023-01-04 00:11:39 -08:00
parent 93eb1f51eb
commit 0aeb0ccac5
14 changed files with 164 additions and 28 deletions

View File

@ -20,6 +20,7 @@
> CHANGE 1 : 32 @ 1 : 4
~
~ import net.lax1dude.eaglercraft.v1_8.internal.PlatformInput;
~ import org.apache.commons.lang3.Validate;
~
~ import com.google.common.collect.Lists;
@ -32,7 +33,6 @@
~ import net.lax1dude.eaglercraft.v1_8.Mouse;
~ import net.lax1dude.eaglercraft.v1_8.futures.Executors;
~ import net.lax1dude.eaglercraft.v1_8.futures.FutureTask;
~ import net.lax1dude.eaglercraft.v1_8.futures.Futures;
~ import net.lax1dude.eaglercraft.v1_8.futures.ListenableFuture;
~ import net.lax1dude.eaglercraft.v1_8.futures.ListenableFutureTask;
~ import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformType;
@ -77,9 +77,7 @@
> DELETE 2 @ 2 : 3
> DELETE 14 @ 14 : 15
> DELETE 1 @ 1 : 3
> DELETE 14 @ 14 : 18
> DELETE 21 @ 21 : 25
@ -425,7 +423,7 @@
> CHANGE 108 : 109 @ 108 : 148
~ logger.error("Use F11 to toggle fullscreen!");
~ Display.toggleFullscreen();
> DELETE 11 @ 11 : 12
@ -466,7 +464,13 @@
~ if ((!this.inGameHasFocus || !Mouse.isActuallyGrabbed()) && Mouse.getEventButtonState()) {
~ this.inGameHasFocus = false;
> CHANGE 42 : 43 @ 42 : 43
> INSERT 16 : 19 @ 16
+ if (k == 0x1D && (areKeysLocked() || isFullScreen())) {
+ KeyBinding.setKeyBindState(gameSettings.keyBindSprint.getKeyCode(), Keyboard.getEventKeyState());
+ }
> CHANGE 26 : 27 @ 26 : 27
~ if (k == 1 || (k > -1 && k == this.gameSettings.keyBindClose.getKeyCode())) {
@ -545,7 +549,11 @@
~ return System.currentTimeMillis();
> DELETE 10 @ 10 : 27
> CHANGE 3 : 4 @ 3 : 4
~ return Display.isFullscreen();
> DELETE 6 @ 6 : 23
> DELETE 44 @ 44 : 48
@ -571,11 +579,15 @@
> DELETE 24 @ 24 : 32
> INSERT 7 : 11 @ 7
> INSERT 7 : 15 @ 7
+
+ public static int getGLMaximumTextureSize() {
+ return EaglercraftGPU.glGetInteger(GL_MAX_TEXTURE_SIZE);
+ }
+
+ public boolean areKeysLocked() {
+ return PlatformInput.lockKeys;
+ }
> EOF

View File

@ -34,15 +34,48 @@
+ this.buttonList.add(exitButton = new GuiButton(69, this.width - 100, 3, 97, 20, I18n.format("chat.exit")));
+ }
> CHANGE 18 : 19 @ 18 : 19
> CHANGE 18 : 20 @ 18 : 27
~ protected void keyTyped(char parChar1, int parInt1) {
~ if (parInt1 == 1 && (this.mc.gameSettings.keyBindClose.getKeyCode() == 0 || this.mc.areKeysLocked())) {
> CHANGE 7 : 8 @ 7 : 10
> CHANGE 1 : 5 @ 1 : 10
~ if (parInt1 != 28 && parInt1 != 156) {
~ } else {
~ this.waitingOnAutocomplete = false;
~ if (parInt1 == 15) {
~ this.autocompletePlayerNames();
> CHANGE 43 : 44 @ 43 : 44
> CHANGE 1 : 2 @ 1 : 2
~ this.playerNamesFound = false;
> DELETE 1 @ 1 : 6
> CHANGE 1 : 21 @ 1 : 2
~ if (parInt1 != 28 && parInt1 != 156) {
~ if (parInt1 == 200) {
~ this.getSentHistory(-1);
~ } else if (parInt1 == 208) {
~ this.getSentHistory(1);
~ } else if (parInt1 == 201) {
~ this.mc.ingameGUI.getChatGUI().scroll(this.mc.ingameGUI.getChatGUI().getLineCount() - 1);
~ } else if (parInt1 == 209) {
~ this.mc.ingameGUI.getChatGUI().scroll(-this.mc.ingameGUI.getChatGUI().getLineCount() + 1);
~ } else {
~ this.inputField.textboxKeyTyped(parChar1, parInt1);
~ }
~ } else {
~ String s = this.inputField.getText().trim();
~ if (s.length() > 0) {
~ this.sendChatMessage(s);
~ }
~
~ this.mc.displayGuiScreen((GuiScreen) null);
~ }
> CHANGE 25 : 26 @ 25 : 26
~ protected void mouseClicked(int parInt1, int parInt2, int parInt3) {

View File

@ -90,7 +90,7 @@
~ protected void keyTyped(char parChar1, int parInt1) {
~ if (((this.mc.theWorld == null || this.mc.thePlayer.getHealth() <= 0.0F) && parInt1 == 1)
~ || parInt1 == this.mc.gameSettings.keyBindClose.getKeyCode()
~ || (parInt1 == 1 && this.mc.gameSettings.keyBindClose.getKeyCode() == 0)) {
~ || (parInt1 == 1 && (this.mc.gameSettings.keyBindClose.getKeyCode() == 0 || this.mc.areKeysLocked()))) {
> INSERT 4 : 6 @ 4

View File

@ -13,9 +13,9 @@
~ GameSettings.Options.PARTICLES, GameSettings.Options.FXAA, GameSettings.Options.MIPMAP_LEVELS,
~ GameSettings.Options.BLOCK_ALTERNATIVES, GameSettings.Options.ENTITY_SHADOWS, GameSettings.Options.FOG,
~ GameSettings.Options.HUD_FPS, GameSettings.Options.HUD_COORDS, GameSettings.Options.HUD_PLAYER,
~ GameSettings.Options.HUD_STATS, GameSettings.Options.HUD_WORLD, GameSettings.Options.HUD_24H,
~ GameSettings.Options.CHUNK_FIX };
~ GameSettings.Options.FULLSCREEN, GameSettings.Options.HUD_FPS, GameSettings.Options.HUD_COORDS,
~ GameSettings.Options.HUD_PLAYER, GameSettings.Options.HUD_STATS, GameSettings.Options.HUD_WORLD,
~ GameSettings.Options.HUD_24H, GameSettings.Options.CHUNK_FIX };
> CHANGE 11 : 13 @ 11 : 14

View File

@ -41,7 +41,7 @@
~ protected void keyTyped(char parChar1, int parInt1) {
~ if (parInt1 == this.mc.gameSettings.keyBindClose.getKeyCode()
~ || parInt1 == this.mc.gameSettings.keyBindInventory.getKeyCode()
~ || (parInt1 == 1 && this.mc.gameSettings.keyBindClose.getKeyCode() == 0)) {
~ || (parInt1 == 1 && (this.mc.gameSettings.keyBindClose.getKeyCode() == 0 || this.mc.areKeysLocked()))) {
> CHANGE 1 : 3 @ 1 : 9

View File

@ -26,7 +26,7 @@
> CHANGE 13 : 16 @ 13 : 14
~ if (parInt1 == getCloseKey()) {
~ if (parInt1 == getCloseKey() || (parInt1 == 1 && this.mc.areKeysLocked())) {
~ mc.displayGuiScreen(null);
~ } else if (!this.checkHotbarKeys(parInt1)) {

View File

@ -124,7 +124,7 @@
> DELETE 58 @ 58 : 75
> INSERT 13 : 49 @ 13
> INSERT 13 : 53 @ 13
+ if (parOptions == GameSettings.Options.HUD_FPS) {
+ this.hudFps = !this.hudFps;
@ -162,10 +162,14 @@
+ this.fxaa = (this.fxaa + parInt1) % 3;
+ }
+
+ if (parOptions == GameSettings.Options.FULLSCREEN) {
+ this.mc.toggleFullscreen();
+ }
+
> DELETE 54 @ 54 : 60
> INSERT 12 : 28 @ 12
> INSERT 12 : 30 @ 12
+ case HUD_COORDS:
+ return this.hudCoords;
@ -183,6 +187,8 @@
+ return this.chunkFix;
+ case FOG:
+ return this.fog;
+ case FULLSCREEN:
+ return this.mc.isFullScreen();
> CHANGE 43 : 46 @ 43 : 47
@ -370,12 +376,13 @@
~ TOUCHSCREEN("options.touchscreen", false, true), CHAT_SCALE("options.chat.scale", true, false),
~ CHAT_WIDTH("options.chat.width", true, false), CHAT_HEIGHT_FOCUSED("options.chat.height.focused", true, false),
> CHANGE 14 : 19 @ 14 : 15
> CHANGE 14 : 20 @ 14 : 15
~ ENTITY_SHADOWS("options.entityShadows", false, true), HUD_FPS("options.hud.fps", false, true),
~ HUD_COORDS("options.hud.coords", false, true), HUD_STATS("options.hud.stats", false, true),
~ HUD_WORLD("options.hud.world", false, true), HUD_PLAYER("options.hud.player", false, true),
~ HUD_24H("options.hud.24h", false, true), CHUNK_FIX("options.chunkFix", false, true),
~ FOG("options.fog", false, true), FXAA("options.fxaa", false, false);
~ FOG("options.fog", false, true), FXAA("options.fxaa", false, false),
~ FULLSCREEN("options.fullscreen", false, true);
> EOF