Some minor GUI tweaks

Includes some items from #11
master
Treer 2018-06-17 03:07:04 +10:00
parent 6f62a0b27a
commit 23f3f764fa
4 changed files with 11 additions and 5 deletions

View File

@ -353,7 +353,7 @@ public class Actions {
+ (FeatureToggles.MINETEST_SUPPORT ? "Amidstest - Amidst for Minetest\n\n" : "\n")
+ amidstVersion.createVersionString() + "\n"
+ "Project page: https://github.com/Treer/amidstest\n"
+ "Forum thread: https://forum.minetest.net/viewtopic.php?f=14&t=19869");
+ "Forum thread: https://forum.minetest.net/viewtopic.php?t=19869");
}
@CalledOnlyBy(AmidstThread.EDT)

View File

@ -28,6 +28,7 @@ import amidst.gui.main.viewer.widget.SelectedIconWidget;
import amidst.gui.main.viewer.widget.Widget;
import amidst.gui.main.viewer.widget.Widget.CornerAnchorPoint;
import amidst.gui.main.viewer.widget.WidgetManager;
import amidst.minetest.world.MinetestVersionFeatures;
import amidst.mojangapi.world.World;
import amidst.mojangapi.world.export.WorldExporter;
import amidst.mojangapi.world.export.WorldExporterConfiguration;
@ -50,10 +51,13 @@ public class PerViewerFacadeInjector {
AmidstSettings settings,
Supplier<String> progressText) {
// @formatter:off
boolean isMinetest = world.getVersionFeatures() instanceof MinetestVersionFeatures; // don't have a clean way to get this yet
return Arrays.asList(
new ChangeableTextWidget( CornerAnchorPoint.CENTER, progressText),
new FpsWidget( CornerAnchorPoint.BOTTOM_LEFT, new FramerateTimer(2), settings.showFPS),
new ScaleWidget( CornerAnchorPoint.BOTTOM_CENTER, zoom, settings.showScale),
new ScaleWidget( CornerAnchorPoint.BOTTOM_CENTER, zoom, isMinetest, settings.showScale),
new SeedAndWorldTypeWidget( CornerAnchorPoint.TOP_LEFT, world.getWorldSeed(), world.getWorldType()),
new SelectedIconWidget( CornerAnchorPoint.TOP_LEFT, worldIconSelection),
new DebugWidget( CornerAnchorPoint.BOTTOM_RIGHT, graph, fragmentManager, settings.showDebug, accelerationCounter),

View File

@ -16,6 +16,7 @@ public class ScaleWidget extends Widget {
public static final int MARGIN = 8;
private final Zoom zoom;
private boolean isMinetest;
private final Setting<Boolean> isVisibleSetting;
private int scaleLengthOnScreen;
@ -23,9 +24,10 @@ public class ScaleWidget extends Widget {
private int textWidth;
@CalledOnlyBy(AmidstThread.EDT)
public ScaleWidget(CornerAnchorPoint anchor, Zoom zoom, Setting<Boolean> isVisibleSetting) {
public ScaleWidget(CornerAnchorPoint anchor, Zoom zoom, boolean isMinetest, Setting<Boolean> isVisibleSetting) {
super(anchor);
this.zoom = zoom;
this.isMinetest = isMinetest;
this.isVisibleSetting = isVisibleSetting;
setWidth(100);
setHeight(34);
@ -36,7 +38,7 @@ public class ScaleWidget extends Widget {
protected void doUpdate(FontMetrics fontMetrics, float time) {
int scaleLengthInWorld = getScaleLengthInWorld();
scaleLengthOnScreen = (int) zoom.worldToScreen(scaleLengthInWorld);
text = scaleLengthInWorld + " blocks";
text = scaleLengthInWorld + (isMinetest ? " nodes" : " blocks");
textWidth = fontMetrics.stringWidth(text);
setWidth(Math.max(scaleLengthOnScreen, textWidth) + (MARGIN * 2));
}

View File

@ -15,7 +15,7 @@ public class MinetestLauncherProfile extends LauncherProfile {
private final MinetestDirectory minetestDirectory;
public static MinetestLauncherProfile InternalDefault = new MinetestLauncherProfile(
null, "Minetest defaults");
null, "Minetest");
public MinetestLauncherProfile(MinetestDirectory minetestDirectory,
String profileName) {