Fullscreen Support!

This commit is contained in:
PeytonPlayz595 2023-07-17 02:05:46 -04:00
parent c48e9cfe02
commit fb6a578d1c
4 changed files with 1975 additions and 1955 deletions

3904
js/app.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@ public final class GameSettings
{ {
bindings = new KeyBinding[] {forwardKey, leftKey, backKey, rightKey, jumpKey, buildKey, chatKey, toggleFogKey, saveLocationKey, loadLocationKey}; bindings = new KeyBinding[] {forwardKey, leftKey, backKey, rightKey, jumpKey, buildKey, chatKey, toggleFogKey, saveLocationKey, loadLocationKey};
settingCount = 9; settingCount = 10;
this.minecraft = minecraft; this.minecraft = minecraft;
@ -29,6 +29,7 @@ public final class GameSettings
public boolean anaglyph = false; public boolean anaglyph = false;
public boolean limitFramerate = false; public boolean limitFramerate = false;
public boolean gamemode = false; public boolean gamemode = false;
public boolean fullscreen = false;
public KeyBinding forwardKey = new KeyBinding("Forward", 17); public KeyBinding forwardKey = new KeyBinding("Forward", 17);
public KeyBinding leftKey = new KeyBinding("Left", 30); public KeyBinding leftKey = new KeyBinding("Left", 30);
public KeyBinding backKey = new KeyBinding("Back", 31); public KeyBinding backKey = new KeyBinding("Back", 31);
@ -115,6 +116,11 @@ public final class GameSettings
} }
} }
if(setting == 9) {
fullscreen = !fullscreen;
GL11.setFullscreen(fullscreen);
}
save(); save();
} }
@ -129,7 +135,8 @@ public final class GameSettings
: (id == 6 ? "3d anaglyph: " + (anaglyph ? "ON" : "OFF") : (id == 6 ? "3d anaglyph: " + (anaglyph ? "ON" : "OFF")
: (id == 7 ? "Limit framerate: " + (limitFramerate ? "ON" : "OFF") : (id == 7 ? "Limit framerate: " + (limitFramerate ? "ON" : "OFF")
: (id == 8 ? "Game Mode: " + (gamemode ? "Creative" : "Survival") : (id == 8 ? "Game Mode: " + (gamemode ? "Creative" : "Survival")
: "")))))))); : (id == 9 ? "Fullscreen: " + (fullscreen ? "ON" : "OFF")
: "")))))))));
} }
private void load() private void load()

View File

@ -1092,8 +1092,19 @@ public class EaglerAdapterImpl2 {
return (p1 >= 0 && p1 < 256) ? LWJGLKeyNames[p1] : "null"; return (p1 >= 0 && p1 < 256) ? LWJGLKeyNames[p1] : "null";
} }
public static final void setFullscreen(boolean p1) { public static final void setFullscreen(boolean p1) {
win.alert("use F11 to enter fullscreen"); if(p1) {
fullscreen();
} else {
exitFullscreen();
}
} }
@JSBody(script = "if(!document.fullscreenElement){document.documentElement.requestFullscreen();}")
public static final native void fullscreen();
@JSBody(script = "if(document.fullscreenElement){document.exitFullscreen();}")
public static final native void exitFullscreen();
public static final boolean shouldShutdown() { public static final boolean shouldShutdown() {
return false; return false;
} }