refresh on resize
This commit is contained in:
@@ -7,6 +7,7 @@ import org.saturnclient.ui.animations.FadeIn;
|
|||||||
import org.saturnclient.ui.animations.Slide;
|
import org.saturnclient.ui.animations.Slide;
|
||||||
import org.saturnclient.ui.widgets.SaturnButton;
|
import org.saturnclient.ui.widgets.SaturnButton;
|
||||||
import org.saturnclient.ui.widgets.SaturnImage;
|
import org.saturnclient.ui.widgets.SaturnImage;
|
||||||
|
|
||||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||||
import net.minecraft.client.gui.screen.option.OptionsScreen;
|
import net.minecraft.client.gui.screen.option.OptionsScreen;
|
||||||
import net.minecraft.client.gui.screen.world.SelectWorldScreen;
|
import net.minecraft.client.gui.screen.world.SelectWorldScreen;
|
||||||
@@ -23,7 +24,7 @@ public class SaturnTitleScreen extends SaturnUi {
|
|||||||
|
|
||||||
int logoSize = 49;
|
int logoSize = 49;
|
||||||
int bX = (width - 150) / 2;
|
int bX = (width - 150) / 2;
|
||||||
int bY = height / 2 - logoSize - 24;
|
int bY = height / 2 - logoSize - 27;
|
||||||
|
|
||||||
draw(
|
draw(
|
||||||
new SaturnImage(SaturnClientConfig.getLogo())
|
new SaturnImage(SaturnClientConfig.getLogo())
|
||||||
@@ -31,9 +32,9 @@ public class SaturnTitleScreen extends SaturnUi {
|
|||||||
.setY(bY)
|
.setY(bY)
|
||||||
.setWidth(logoSize)
|
.setWidth(logoSize)
|
||||||
.setHeight(logoSize)
|
.setHeight(logoSize)
|
||||||
.setAnimations(new Slide(2, 14)));
|
.setAnimations(new Slide(3, 14)));
|
||||||
|
|
||||||
bY += 41;
|
bY += 44;
|
||||||
|
|
||||||
draw(
|
draw(
|
||||||
new SaturnImage(Textures.LOGO_TEXT)
|
new SaturnImage(Textures.LOGO_TEXT)
|
||||||
@@ -41,9 +42,9 @@ public class SaturnTitleScreen extends SaturnUi {
|
|||||||
.setY(bY)
|
.setY(bY)
|
||||||
.setWidth(logoSize)
|
.setWidth(logoSize)
|
||||||
.setHeight(8)
|
.setHeight(8)
|
||||||
.setAnimations(new FadeIn(2)));
|
.setAnimations(new FadeIn(3)));
|
||||||
|
|
||||||
bY += 12;
|
bY += 15;
|
||||||
|
|
||||||
draw(new SaturnButton("SINGLEPLAYER", () -> {
|
draw(new SaturnButton("SINGLEPLAYER", () -> {
|
||||||
client.setScreen(new SelectWorldScreen(new SaturnTitleScreen()));
|
client.setScreen(new SelectWorldScreen(new SaturnTitleScreen()));
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.util.concurrent.Executors;
|
|||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gl.PostEffectProcessor;
|
import net.minecraft.client.gl.PostEffectProcessor;
|
||||||
import net.minecraft.client.gui.CubeMapRenderer;
|
import net.minecraft.client.gui.CubeMapRenderer;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
@@ -29,6 +30,8 @@ public class SaturnUi extends Screen {
|
|||||||
private float f = 0.0f;
|
private float f = 0.0f;
|
||||||
public boolean blur = true;
|
public boolean blur = true;
|
||||||
public boolean titleBackground = false;
|
public boolean titleBackground = false;
|
||||||
|
public List<SaturnWidget> widgets = new ArrayList<>();
|
||||||
|
private int tick = 0;
|
||||||
|
|
||||||
protected static final CubeMapRenderer PANORAMA_RENDERER = new CubeMapRenderer(
|
protected static final CubeMapRenderer PANORAMA_RENDERER = new CubeMapRenderer(
|
||||||
Identifier.of("saturnclient", "textures/gui/title/background/panorama"));
|
Identifier.of("saturnclient", "textures/gui/title/background/panorama"));
|
||||||
@@ -96,9 +99,6 @@ public class SaturnUi extends Screen {
|
|||||||
(color & 0x00FFFFFF);
|
(color & 0x00FFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SaturnWidget> widgets = new ArrayList<>();
|
|
||||||
private int tick = 0;
|
|
||||||
|
|
||||||
public SaturnUi(Text title) {
|
public SaturnUi(Text title) {
|
||||||
super(title);
|
super(title);
|
||||||
}
|
}
|
||||||
@@ -120,6 +120,18 @@ public class SaturnUi extends Screen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void refresh() {
|
||||||
|
synchronized (widgets) {
|
||||||
|
widgets.clear();
|
||||||
|
|
||||||
|
f = 0.0f;
|
||||||
|
tick = 0;
|
||||||
|
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void render(
|
public void render(
|
||||||
DrawContext context,
|
DrawContext context,
|
||||||
@@ -301,4 +313,10 @@ public class SaturnUi extends Screen {
|
|||||||
tick++;
|
tick++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resize(MinecraftClient client, int width, int height) {
|
||||||
|
super.resize(client, width, height);
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user