Merge work #7
@@ -15,12 +15,19 @@ public class MdgaApp extends SimpleApplication {
|
||||
MdgaView view = null;
|
||||
private MdgaState state = MdgaState.MAIN;
|
||||
|
||||
private static float resolutionFactor = 1;
|
||||
|
||||
public static void main(String[] args) {
|
||||
AppSettings settings = new AppSettings(true);
|
||||
settings.setSamples(128);
|
||||
settings.setCenterWindow(true);
|
||||
settings.setWidth(1280);
|
||||
settings.setHeight(720);
|
||||
|
||||
int width = (int)(1280 * resolutionFactor);
|
||||
int height = (int)(720 * resolutionFactor);
|
||||
|
||||
settings.setWidth(width);
|
||||
settings.setHeight(height);
|
||||
|
||||
settings.setVSync(false);
|
||||
|
||||
MdgaApp app = new MdgaApp();
|
||||
@@ -83,4 +90,8 @@ public AcousticHandler getAcousticHandler() {
|
||||
}
|
||||
|
||||
public MdgaState getState() {return state; }
|
||||
|
||||
public float getResolutionFactor() {
|
||||
return resolutionFactor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Dialog;
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
@@ -10,6 +10,8 @@
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
import static com.jme3.math.FastMath.floor;
|
||||
|
||||
public abstract class Dialog {
|
||||
protected final ColorRGBA COLOR_DEFAULT = ColorRGBA.Gray;
|
||||
protected final ColorRGBA COLOR_HOVER = ColorRGBA.DarkGray;
|
||||
@@ -22,6 +24,8 @@ public abstract class Dialog {
|
||||
protected final float vertical_step;
|
||||
protected final float horitontal_step;
|
||||
|
||||
protected float fontSize = 35;
|
||||
|
||||
public Dialog(MdgaApp app, Node node) {
|
||||
this.app = app;
|
||||
this.node = node;
|
||||
@@ -29,6 +33,9 @@ public Dialog(MdgaApp app, Node node) {
|
||||
|
||||
this.horitontal_step = app.getCamera().getWidth() / 16;
|
||||
this.vertical_step = app.getCamera().getHeight() / 9;
|
||||
|
||||
int val = (int) (32 * Math.min(app.getResolutionFactor() * 0.9f, 1));
|
||||
fontSize = val;
|
||||
}
|
||||
|
||||
public void show() {
|
||||
@@ -42,7 +49,7 @@ public void hide () {
|
||||
protected void createButton(String label, Runnable action, Vector3f size) {
|
||||
Button button = new Button(label);
|
||||
button.addClickCommands(source -> action.run());
|
||||
button.setFontSize(35);
|
||||
button.setFontSize(fontSize);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
button.setPreferredSize(size);
|
||||
@@ -50,12 +57,12 @@ protected void createButton(String label, Runnable action, Vector3f size) {
|
||||
button.setTextVAlignment(VAlignment.Center);
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
background.setMargin(5, 5);
|
||||
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
button.setBackground(background);
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
|
||||
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
|
||||
hoverBackground.setMargin(5, 5);
|
||||
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(hoverBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
@@ -63,7 +70,7 @@ protected void createButton(String label, Runnable action, Vector3f size) {
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
|
||||
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
normalBackground.setMargin(5, 5);
|
||||
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(normalBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Dialog;
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
@@ -16,7 +16,7 @@ public InputButtonDialog(MdgaApp app, Node node) {
|
||||
super(app, node);
|
||||
|
||||
QuadBackgroundComponent quad1 = new QuadBackgroundComponent(ColorRGBA.Gray);
|
||||
quad1.setMargin(100, 50);
|
||||
quad1.setMargin(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor());
|
||||
container.setBackground(quad1);
|
||||
|
||||
Texture texture = app.getAssetManager().loadTexture("mdga_logo.png");
|
||||
@@ -29,12 +29,12 @@ public InputButtonDialog(MdgaApp app, Node node) {
|
||||
container.addChild(imagePanel).setPreferredSize(new Vector3f(texture.getImage().getWidth() / 4, texture.getImage().getHeight() / 4, 0));
|
||||
|
||||
//abstandshalter
|
||||
container.addChild(new Panel(100, 50, ColorRGBA.Gray));
|
||||
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
|
||||
createTextField();
|
||||
|
||||
//abstandshalter
|
||||
container.addChild(new Panel(100, 50, ColorRGBA.Gray));
|
||||
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,14 +61,14 @@ private void createTextField() {
|
||||
Container subContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||
|
||||
Label nameLabel = new Label("Name:\t");
|
||||
nameLabel.setFontSize(35);
|
||||
nameLabel.setFontSize(fontSize);
|
||||
nameLabel.setColor(ColorRGBA.Black);
|
||||
|
||||
nameInput = new TextField("");
|
||||
|
||||
nameInput.setColor(ColorRGBA.Black);
|
||||
nameInput.setTextHAlignment(HAlignment.Left);
|
||||
nameInput.setFontSize(35);
|
||||
nameInput.setFontSize(fontSize);
|
||||
nameInput.setSingleLine(true);
|
||||
|
||||
QuadBackgroundComponent grayBackground = new QuadBackgroundComponent(ColorRGBA.DarkGray);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Dialog;
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
@@ -12,7 +12,7 @@ public LobbyButtonDialog(MdgaApp app, Node node, String label, Runnable action,
|
||||
|
||||
this.pos = pos;
|
||||
|
||||
createButton(label, action, new Vector3f(170, 250, 0));
|
||||
createButton(label, action, new Vector3f(170 * app.getResolutionFactor(), 250 * app.getResolutionFactor(), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
public class MenuDialog {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
public class NetworkDialog {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Dialog;
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
@@ -19,9 +19,9 @@ public SettingsButtonDialog(MdgaApp app, Node node, String label, Runnable actio
|
||||
super(app, node);
|
||||
|
||||
icon = new IconComponent("zahnrad.png");
|
||||
icon.setIconScale(0.1f);
|
||||
icon.setIconScale(0.1f * app.getResolutionFactor());
|
||||
|
||||
createButton(label, action, new Vector3f(60, 60, 0));
|
||||
createButton(label, action, new Vector3f(60 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,7 +43,7 @@ public void hide() {
|
||||
protected void createButton(String label, Runnable action, Vector3f size) {
|
||||
Button button = new Button(label);
|
||||
button.addClickCommands(source -> action.run());
|
||||
button.setFontSize(35);
|
||||
button.setFontSize(fontSize);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
button.setPreferredSize(size);
|
||||
@@ -51,13 +51,13 @@ protected void createButton(String label, Runnable action, Vector3f size) {
|
||||
button.setTextVAlignment(VAlignment.Center);
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
background.setMargin(5, 5);
|
||||
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
button.setBackground(background);
|
||||
button.setIcon(icon);
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
|
||||
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
|
||||
hoverBackground.setMargin(5, 5);
|
||||
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(hoverBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
@@ -66,7 +66,7 @@ protected void createButton(String label, Runnable action, Vector3f size) {
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
|
||||
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
normalBackground.setMargin(5, 5);
|
||||
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(normalBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Dialog;
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
@@ -8,7 +8,7 @@ public class SingleButtonLeftDialog extends Dialog {
|
||||
public SingleButtonLeftDialog(MdgaApp app, Node node, String label, Runnable action) {
|
||||
super(app, node);
|
||||
|
||||
createButton(label, action, new Vector3f(170, 60, 0));
|
||||
createButton(label, action, new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Dialog;
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
@@ -8,7 +8,7 @@ public class SingleButtonRightDialog extends Dialog {
|
||||
public SingleButtonRightDialog(MdgaApp app, Node node, String label, Runnable action) {
|
||||
super(app, node);
|
||||
|
||||
createButton(label, action, new Vector3f(170, 60, 0));
|
||||
createButton(label, action, new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package pp.mdga.client.view;
|
||||
|
||||
import com.jme3.scene.Geometry;
|
||||
import pp.mdga.client.Dialog.SingleButtonLeftDialog;
|
||||
import pp.mdga.client.Dialog.SingleButtonRightDialog;
|
||||
import pp.mdga.client.dialog.SingleButtonLeftDialog;
|
||||
import pp.mdga.client.dialog.SingleButtonRightDialog;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.client.MdgaState;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package pp.mdga.client.view;
|
||||
|
||||
import pp.mdga.client.board.BoardHandler;
|
||||
import pp.mdga.client.Dialog.SingleButtonRightDialog;
|
||||
import pp.mdga.client.dialog.SingleButtonRightDialog;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.client.MdgaState;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package pp.mdga.client.view;
|
||||
|
||||
import com.jme3.scene.Geometry;
|
||||
import pp.mdga.client.Dialog.LobbyButtonDialog;
|
||||
import pp.mdga.client.Dialog.SingleButtonLeftDialog;
|
||||
import pp.mdga.client.Dialog.SingleButtonRightDialog;
|
||||
import pp.mdga.client.dialog.LobbyButtonDialog;
|
||||
import pp.mdga.client.dialog.SingleButtonLeftDialog;
|
||||
import pp.mdga.client.dialog.SingleButtonRightDialog;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.client.MdgaState;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package pp.mdga.client.view;
|
||||
|
||||
import com.jme3.scene.Geometry;
|
||||
import pp.mdga.client.Dialog.InputButtonDialog;
|
||||
import pp.mdga.client.dialog.InputButtonDialog;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.client.MdgaState;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.scene.shape.Quad;
|
||||
import com.jme3.texture.Texture;
|
||||
import pp.mdga.client.Dialog.SettingsButtonDialog;
|
||||
import pp.mdga.client.dialog.SettingsButtonDialog;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public abstract class MdgaView {
|
||||
|
||||
Reference in New Issue
Block a user