Created
May 15, 2011 22:15
-
-
Save ShaRose/973606 to your computer and use it in GitHub Desktop.
MCPified GuiWidgetScreen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.minecraft.src; | |
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. | |
// Jad home page: http://www.kpdus.com/jad.html | |
// Decompiler options: packimports(3) braces deadcode | |
import de.matthiasmann.twl.GUI; | |
import de.matthiasmann.twl.Widget; | |
import de.matthiasmann.twl.input.lwjgl.LWJGLInput; | |
import de.matthiasmann.twl.renderer.lwjgl.LWJGLRenderer; | |
import de.matthiasmann.twl.theme.ThemeManager; | |
import java.net.URL; | |
import net.minecraft.client.Minecraft; | |
public class GuiWidgetScreen extends Widget | |
{ | |
public static GuiWidgetScreen getInstance() | |
{ | |
if(instance != null) | |
{ | |
return instance; | |
} | |
try | |
{ | |
instance = new GuiWidgetScreen(); | |
instance.renderer = new LWJGLRenderer(); | |
String s = "twlGuiTheme.xml"; | |
instance.gui = new GUI(instance, instance.renderer, new LWJGLInput()); | |
ModSettings.dbgout((GuiWidgetScreen.class).getClassLoader().getResource(s).toString()); | |
instance.theme = ThemeManager.createThemeManager((GuiWidgetScreen.class).getClassLoader().getResource(s), instance.renderer); | |
if(instance.theme == null) | |
{ | |
throw new RuntimeException("I don't think you installed the theme correctly ..."); | |
} | |
instance.gui.applyTheme(instance.theme); | |
instance.setTheme(""); | |
instance.mcinstance = ModLoader.getMinecraftInstance(); | |
instance.screensize = new ScreenScaleProxy(instance.mcinstance.displayWidth, instance.mcinstance.displayHeight); | |
} | |
catch(Throwable throwable) | |
{ | |
throwable.printStackTrace(); | |
RuntimeException runtimeexception = new RuntimeException("error loading theme"); | |
runtimeexception.initCause(throwable); | |
throw runtimeexception; | |
} | |
return instance; | |
} | |
public GuiWidgetScreen() | |
{ | |
gui = null; | |
renderer = null; | |
currentwidget = null; | |
theme = null; | |
screensize = null; | |
} | |
public void setScreen(Widget widget) | |
{ | |
gui.resyncTimerAfterPause(); | |
gui.clearKeyboardState(); | |
gui.clearMouseState(); | |
removeAllChildren(); | |
add(widget); | |
currentwidget = widget; | |
} | |
public void resetScreen() | |
{ | |
removeAllChildren(); | |
currentwidget = null; | |
} | |
public void layout() | |
{ | |
screensize = new ScreenScaleProxy(mcinstance.displayWidth, mcinstance.displayHeight); | |
if(currentwidget != null) | |
{ | |
screenwidth = screensize.getScaledWidth(); | |
screenheight = screensize.getScaledHeight(); | |
currentwidget.setSize(screenwidth, screenheight); | |
currentwidget.setPosition(0, 0); | |
} | |
} | |
public static GuiWidgetScreen instance; | |
public GUI gui; | |
public LWJGLRenderer renderer; | |
public Widget currentwidget; | |
public ThemeManager theme; | |
public Minecraft mcinstance; | |
public ScreenScaleProxy screensize; | |
public static int screenwidth; | |
public static int screenheight; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment