saturn client branding
This commit is contained in:
@@ -2,7 +2,9 @@ package org.saturnclient.saturnclient;
|
|||||||
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
||||||
|
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
|
||||||
import org.saturnclient.modules.ModManager;
|
import org.saturnclient.modules.ModManager;
|
||||||
import org.saturnclient.saturnclient.auth.Auth;
|
import org.saturnclient.saturnclient.auth.Auth;
|
||||||
@@ -11,6 +13,12 @@ import org.saturnclient.saturnclient.cosmetics.Emotes;
|
|||||||
import org.saturnclient.saturnclient.cosmetics.Hats;
|
import org.saturnclient.saturnclient.cosmetics.Hats;
|
||||||
import org.saturnclient.saturnclient.cosmetics.cloaks.Cloaks;
|
import org.saturnclient.saturnclient.cosmetics.cloaks.Cloaks;
|
||||||
import org.saturnclient.saturnclient.event.KeyInputHandler;
|
import org.saturnclient.saturnclient.event.KeyInputHandler;
|
||||||
|
import org.saturnclient.saturnclient.mixin.DrawContextAccessor;
|
||||||
|
import org.saturnclient.ui2.RenderScope;
|
||||||
|
import org.saturnclient.ui2.SaturnScreen;
|
||||||
|
import org.saturnclient.ui2.elements.ImageTexture;
|
||||||
|
import org.saturnclient.ui2.resources.Textures;
|
||||||
|
import org.saturnclient.ui2.screens.TitleMenu;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -37,6 +45,32 @@ public class SaturnClient implements ModInitializer {
|
|||||||
SpecialModelLoaderEvents.LOAD_SCOPE.register(() -> {
|
SpecialModelLoaderEvents.LOAD_SCOPE.register(() -> {
|
||||||
return (resourceManager, location) -> MOD_ID.equals(location.getNamespace());
|
return (resourceManager, location) -> MOD_ID.equals(location.getNamespace());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> {
|
||||||
|
if (screen != null && !(screen instanceof TitleMenu)) {
|
||||||
|
if (screen instanceof SaturnScreen) {
|
||||||
|
((SaturnScreen) screen).draw(new ImageTexture(Textures.LOGO_TEXT_BIG).dimensions(180, 18).position(screen.width - 180 - 20, screen.height - 18 - 20));
|
||||||
|
} else {
|
||||||
|
ScreenEvents.afterRender(screen).register((screen1, context, mouseX, mouseY, tickDelta) -> {
|
||||||
|
RenderScope renderScope = new RenderScope(context.getMatrices(),
|
||||||
|
((DrawContextAccessor) context).getVertexConsumers());
|
||||||
|
|
||||||
|
int width = context.getScaledWindowWidth();
|
||||||
|
int height = context.getScaledWindowHeight();
|
||||||
|
|
||||||
|
float scaleX = (float) screen1.width / width;
|
||||||
|
float scaleY = (float) screen1.height / height;
|
||||||
|
|
||||||
|
MatrixStack matrixStack = context.getMatrices();
|
||||||
|
matrixStack.push();
|
||||||
|
matrixStack.translate(width - 95, height - 14, 0);
|
||||||
|
matrixStack.scale(0.5f / scaleX, 0.5f / scaleY, 1.0f);
|
||||||
|
renderScope.drawTexture(Textures.LOGO_TEXT_BIG, 0, 0, 0, 0, 180, 18);
|
||||||
|
matrixStack.pop();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
KeyInputHandler.register();
|
KeyInputHandler.register();
|
||||||
Emotes.initialize();
|
Emotes.initialize();
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class Textures {
|
|||||||
public static final Identifier LOGO = Identifier.of("saturnclient", "textures/logo/logo.png");
|
public static final Identifier LOGO = Identifier.of("saturnclient", "textures/logo/logo.png");
|
||||||
public static final Identifier REALISTIC_LOGO = Identifier.of("saturnclient", "textures/logo/realistic.png");
|
public static final Identifier REALISTIC_LOGO = Identifier.of("saturnclient", "textures/logo/realistic.png");
|
||||||
public static final Identifier LOGO_TEXT = Identifier.of("saturnclient", "textures/logo/text.png");
|
public static final Identifier LOGO_TEXT = Identifier.of("saturnclient", "textures/logo/text.png");
|
||||||
|
public static final Identifier LOGO_TEXT_BIG = Identifier.of("saturnclient", "textures/logo/text_big.png");
|
||||||
|
|
||||||
// Widgets
|
// Widgets
|
||||||
public static final Identifier BUTTON_BORDER = Identifier.of("saturnclient", "button_border");
|
public static final Identifier BUTTON_BORDER = Identifier.of("saturnclient", "button_border");
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import org.saturnclient.modules.Module;
|
|||||||
import org.saturnclient.ui2.SaturnScreen;
|
import org.saturnclient.ui2.SaturnScreen;
|
||||||
import org.saturnclient.ui2.components.SaturnModule;
|
import org.saturnclient.ui2.components.SaturnModule;
|
||||||
import org.saturnclient.ui2.components.Sidebar;
|
import org.saturnclient.ui2.components.Sidebar;
|
||||||
|
import org.saturnclient.ui2.elements.ImageTexture;
|
||||||
import org.saturnclient.ui2.elements.Scroll;
|
import org.saturnclient.ui2.elements.Scroll;
|
||||||
|
import org.saturnclient.ui2.resources.Textures;
|
||||||
|
|
||||||
public class ModMenu extends SaturnScreen {
|
public class ModMenu extends SaturnScreen {
|
||||||
public ModMenu() {
|
public ModMenu() {
|
||||||
@@ -38,5 +40,7 @@ public class ModMenu extends SaturnScreen {
|
|||||||
draw(scroll.dimensions(scrollWidth, 350).center(width, height));
|
draw(scroll.dimensions(scrollWidth, 350).center(width, height));
|
||||||
|
|
||||||
draw(new Sidebar(0, this::close).centerOffset(width, height, -(scrollWidth / 2 + 20), 0));
|
draw(new Sidebar(0, this::close).centerOffset(width, height, -(scrollWidth / 2 + 20), 0));
|
||||||
|
|
||||||
|
draw(new ImageTexture(Textures.LOGO_TEXT_BIG).dimensions(180, 18).position(width - 180 - 20, height - 18 - 20));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user