Improve video dialog
This commit is contained in:
@@ -266,12 +266,12 @@ public void updateResolution(int width, int height, float imageFactor, boolean i
|
|||||||
|
|
||||||
prefs.putFloat("scale", scaleFactor);
|
prefs.putFloat("scale", scaleFactor);
|
||||||
prefs.putBoolean("fullscreen", true);
|
prefs.putBoolean("fullscreen", true);
|
||||||
|
} else {
|
||||||
|
prefs.putInt("width", width);
|
||||||
|
prefs.putInt("height", height);
|
||||||
|
prefs.putFloat("scale", imageFactor);
|
||||||
|
prefs.putBoolean("fullscreen", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
prefs.putInt("width", width);
|
|
||||||
prefs.putInt("height", height);
|
|
||||||
prefs.putFloat("scale", imageFactor);
|
|
||||||
prefs.putBoolean("fullscreen", false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void restartApp() {
|
public static void restartApp() {
|
||||||
|
|||||||
@@ -9,7 +9,11 @@
|
|||||||
import pp.mdga.client.button.MenuButton;
|
import pp.mdga.client.button.MenuButton;
|
||||||
import pp.mdga.client.view.MdgaView;
|
import pp.mdga.client.view.MdgaView;
|
||||||
|
|
||||||
|
import java.util.prefs.Preferences;
|
||||||
|
|
||||||
public class VideoSettingsDialog extends Dialog {
|
public class VideoSettingsDialog extends Dialog {
|
||||||
|
private static Preferences prefs = Preferences.userNodeForPackage(JoinDialog.class);
|
||||||
|
|
||||||
private ButtonRight fullscreenButton;
|
private ButtonRight fullscreenButton;
|
||||||
private MenuButton backButton;
|
private MenuButton backButton;
|
||||||
private ButtonRight restartButton;
|
private ButtonRight restartButton;
|
||||||
@@ -30,19 +34,20 @@ public VideoSettingsDialog(MdgaApp app, Node node, MdgaView view) {
|
|||||||
|
|
||||||
this.view = view;
|
this.view = view;
|
||||||
|
|
||||||
fullscreenButton = new ButtonRight(app, node, () -> app.updateResolution(0, 0, 0, true), "Vollbild", 1);
|
|
||||||
backButton = new MenuButton(app, node, view::leaveVideoSettings, "Zurück");
|
backButton = new MenuButton(app, node, view::leaveVideoSettings, "Zurück");
|
||||||
|
|
||||||
restartButton = new ButtonRight(app, node, MdgaApp::restartApp, "Neustart", 1);
|
restartButton = new ButtonRight(app, node, MdgaApp::restartApp, "Neustart", 1);
|
||||||
|
|
||||||
hdButton9 = new ButtonLeft(app, node, () -> app.updateResolution(1280, 720, 1.0f, false), "hd 16:9", 10);
|
fullscreenButton = new ButtonRight(app, node, () -> updateResolution(0, 0, 0, true), "Vollbild", 1);
|
||||||
fullHdButton9 = new ButtonLeft(app, node, () -> app.updateResolution(1920, 1080, 2.25f, false), "full hd 16:9", 10);
|
|
||||||
wqhdButton9 = new ButtonLeft(app, node, () -> app.updateResolution(2560, 1440, 4.0f, false), "wqhd 16:9", 10);
|
hdButton9 = new ButtonLeft(app, node, () -> updateResolution(1280, 720, 1.0f, false), "hd 16:9", 10);
|
||||||
|
fullHdButton9 = new ButtonLeft(app, node, () -> updateResolution(1920, 1080, 2.25f, false), "full hd 16:9", 10);
|
||||||
|
wqhdButton9 = new ButtonLeft(app, node, () -> updateResolution(2560, 1440, 4.0f, false), "wqhd 16:9", 10);
|
||||||
|
|
||||||
|
|
||||||
hdButton10 = new ButtonRight(app, node, () -> app.updateResolution(1280, 800, 1.0f, false), "hd 16:10", 10);
|
hdButton10 = new ButtonRight(app, node, () -> updateResolution(1280, 800, 1.0f, false), "hd 16:10", 10);
|
||||||
fullHdButton10 = new ButtonRight(app, node, () -> app.updateResolution(1920, 1200, 2.25f, false), "full hd 16:10", 10);
|
fullHdButton10 = new ButtonRight(app, node, () -> updateResolution(1920, 1200, 2.25f, false), "full hd 16:10", 10);
|
||||||
wqhdButton10 = new ButtonRight(app, node, () -> app.updateResolution(2560, 1600, 4.0f, false), "wqhd 16:10", 10);
|
wqhdButton10 = new ButtonRight(app, node, () -> updateResolution(2560, 1600, 4.0f, false), "wqhd 16:10", 10);
|
||||||
|
|
||||||
float offset = 2.8f;
|
float offset = 2.8f;
|
||||||
|
|
||||||
@@ -76,7 +81,6 @@ protected void onShow() {
|
|||||||
|
|
||||||
fullscreenButton.show();
|
fullscreenButton.show();
|
||||||
backButton.show();
|
backButton.show();
|
||||||
restartButton.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -101,4 +105,12 @@ public void update() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateResolution(int width, int height, float imageFactor, boolean isFullscreen) {
|
||||||
|
if(width != prefs.getInt("width", 1280) || height != prefs.getInt("height", 720) || isFullscreen != prefs.getBoolean("fullscreen", false)) {
|
||||||
|
restartButton.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
app.updateResolution(width, height, imageFactor, isFullscreen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user