本文整理汇总了Java中net.minecraft.client.gui.ScaledResolution.getScaledWidth方法的典型用法代码示例。如果您正苦于以下问题:Java ScaledResolution.getScaledWidth方法的具体用法?Java ScaledResolution.getScaledWidth怎么用?Java ScaledResolution.getScaledWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.gui.ScaledResolution
的用法示例。
在下文中一共展示了ScaledResolution.getScaledWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateAchievementWindowScale
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
private void updateAchievementWindowScale()
{
GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
this.width = this.mc.displayWidth;
this.height = this.mc.displayHeight;
ScaledResolution scaledresolution = new ScaledResolution(this.mc);
this.width = scaledresolution.getScaledWidth();
this.height = scaledresolution.getScaledHeight();
GlStateManager.clear(256);
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)this.width, (double)this.height, 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
}
示例2: drawScreen
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
drawDefaultBackground();
if (dataReceived) {
drawCard();
GL11.glColor4f(1f, 1f, 1f, 1f);
for (int i = 0; i < this.buttons.size(); ++i) {
this.buttons.get(i).drawButton(this.mc, mouseX, mouseY, partialTicks);
}
for (int i = 0; i < this.buttons.size(); ++i) {
if (this.buttons.get(i).isMouseOver()) {
drawHoveringText(TextFormatting.LIGHT_PURPLE + I18n.format(data.get(i).getUnlocalizedName()), mouseX, mouseY);
}
}
} else {
String reading = I18n.format("tarots.reading");
ScaledResolution sr = new ScaledResolution(mc);
int x = ((sr.getScaledWidth() - mc.fontRenderer.getStringWidth(reading)) / 2);
int y = ((sr.getScaledHeight() - mc.fontRenderer.FONT_HEIGHT) / 2);
mc.fontRenderer.drawString(reading, x, y, 0xFCD71C, false);
}
}
示例3: onRenderOverlay
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Post event)
{
if (event.getType() != ElementType.EXPERIENCE) return;
else
{
ScaledResolution sr = event.getResolution();
EntityPlayer player = mc.player;
if (!player.capabilities.isCreativeMode)
{
Stats statsCap = (Stats) player.getCapability(CapabilityPlayerStats.STATS, null);
if (statsCap != null)
{
if (statsCap.getMaxMana() != 0)
{
double manaBarWidth = (double) statsCap.getMana() / statsCap.getMaxMana() * 81.0;
int xPos = sr.getScaledWidth() / 2 + 10;
int yPos = sr.getScaledHeight() - 38;
mc.renderEngine.bindTexture(location);
//if (capMana.getMana() != capMana.getMaxMana())
//{
this.drawTexturedModalRect(xPos, yPos, 0, 18, 81, 6);
this.drawTexturedModalRect(xPos, yPos, 0, 24, (int) manaBarWidth, 5);
//}
}
}
}
}
}
示例4: initGui
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@Override
public void initGui()
{
super.initGui();
this.setGuiSize(mc.displayWidth, mc.displayHeight);
INotebookInfo cap = player.getCapability(INotebookInfo.CAP, null);
if (cap != null)
{
// MC Screen resolution based on GUI scale
ScaledResolution res = new ScaledResolution(mc);
// Size of the notebook when taking the larger scale into account
final int SCALED_NOTEBOOK_WIDTH = (int) (NOTEBOOK_WIDTH * scale);
final int SCALED_NOTEBOOK_HEIGHT = (int) (NOTEBOOK_HEIGHT * scale);
// The start x and y coords of the notebook on the screen
int screenX = (res.getScaledWidth() / 2) - (SCALED_NOTEBOOK_WIDTH / 2);
int screenY = (res.getScaledHeight() / 2) - (SCALED_NOTEBOOK_HEIGHT / 2);
this.searchField = new GuiTextFieldNoShadow(1, mc.fontRenderer, screenX + 27, screenY + 24, 88, 30);
this.searchField.setVisible(true);
this.searchField.setCanLoseFocus(false);
this.searchField.setFocused(true);
this.searchField.setMaxStringLength(50);
this.searchField.setEnableBackgroundDrawing(false);
this.searchField.setText(cap.getSearchKey());
this.searchField.setTextColor(0x000000);
}
}
示例5: centerControl
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
public static Point centerControl(LControl c) {
Point parentLoc = (c.getParent() != null)
&& (c.getParent() instanceof LControl)
&& !(c.getParent() instanceof LWindow) ? centerControl((LControl) c.getParent()) : Point.EMPTY;
if (c.getCentered() == LControl.CenterOptions.NONE) {
return new Point(parentLoc.getX() + c.getLocation().getX(), parentLoc.getY() + c.getLocation().getY());
}
ScaledResolution sr = ModCoderPackUtils.getScaledResolution();
int parentWidth = sr.getScaledWidth();
int parentHeight = sr.getScaledHeight();
int newX = parentLoc.getX()+c.getLocation().getX();
int newY = parentLoc.getY() + c.getLocation().getY();
int sizeW = c instanceof LPanel ? ((LPanel) c).getTotalWidth() : c.getSize().getWidth();
int sizeH = c instanceof LPanel ? ((LPanel) c).getTotalHeight() : c.getSize().getHeight();
if (c instanceof LTextLabel) {
sizeW = ModCoderPackUtils.getFontRenderer().getStringWidth(c.getText());
sizeH = ModCoderPackUtils.getFontRenderer().FONT_HEIGHT;
}
boolean centeredX = c.getCentered() != LControl.CenterOptions.NONE && c.getCentered() != LControl.CenterOptions.VERTICAL;
boolean centeredY = c.getCentered() != LControl.CenterOptions.NONE && c.getCentered() != LControl.CenterOptions.HORIZONTAL;
if (centeredX) {
newX = ((parentWidth / 2) - (sizeW / 2));
}
if (centeredY) {
newY = parentLoc.getY() + ((parentHeight / 2) - (sizeH / 2));
}
return new Point(newX, newY);
}
示例6: getAnimatedStat
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public IGuiAnimatedStat getAnimatedStat() {
if (powerStat == null) {
Minecraft minecraft = Minecraft.getMinecraft();
ScaledResolution sr = new ScaledResolution(minecraft);
powerStat = new GuiAnimatedStat(null, "Helmet Pressure: ", "", powerStatX != -1 ? powerStatX : sr.getScaledWidth() - 2, powerStatY, 0x3000AA00, null, powerStatLeftSided);
powerStat.setMinDimensionsAndReset(0, 0);
powerStat.openWindow();
}
return powerStat;
}
示例7: refreshScreen
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
protected void refreshScreen() {
ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
int i = scaledresolution.getScaledWidth();
int j = scaledresolution.getScaledHeight();
setWorldAndResolution(Minecraft.getMinecraft(), i, j);
for (IGuiWidget widget : widgets) {
if (widget instanceof GuiAnimatedStat) {
widget.update();
}
}
}
示例8: init
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
public static void init() {
instance = new GuiHelmetMainScreen();
Minecraft minecraft = FMLClientHandler.instance().getClient();
ScaledResolution scaledresolution = new ScaledResolution(minecraft);
int width = scaledresolution.getScaledWidth();
int height = scaledresolution.getScaledHeight();
instance.setWorldAndResolution(minecraft, width, height);
for (int i = 1; i < instance.upgradePages.size(); i++) {
page = i;
instance.initGui();
}
page = 0;
instance.inInitPhase = false;
}
示例9: GuiAnimatedStat
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
public GuiAnimatedStat(GuiScreen gui, String title, int xPos, int yPos, int backGroundColor,
IGuiAnimatedStat affectingStat, boolean leftSided) {
this.gui = gui;
baseX = xPos;
baseY = yPos;
this.affectingStat = affectingStat;
width = minWidth;
height = minHeight;
this.backGroundColor = backGroundColor;
setTitle(title);
texture = "";
this.leftSided = leftSided;
if (gui != null) {
ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
if (sr.getScaledWidth() < 520) {
textSize = (sr.getScaledWidth() - 220) * 0.0033F;
} else {
textSize = 1F;
}
} else {
textSize = 1;
}
affectedY = baseY;
if (affectingStat != null) {
affectedY += affectingStat.getAffectedY() + affectingStat.getHeight();
}
}
示例10: drawButton
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
ScaledResolution sr = new ScaledResolution(mc);
int left = ((sr.getScaledWidth() - 252) / 2);
int top = ((sr.getScaledHeight() - 192) / 2);
int mxn = mouseX - left;
int myn = mouseY - top;
this.hovered = mxn >= this.x && myn >= this.y && mxn < this.x + this.width && myn < this.y + this.height;
mc.renderEngine.bindTexture(background);
drawTexturedModalRect(left + this.x, top + this.y - (this.isMouseOver() ? 2 : 0), (pressed || this.isMouseOver()) ? 0 : 22, 192, 22, 26);
drawTexturedModalRect(left + this.x, top + this.y - (this.isMouseOver() ? 2 : 0), pressed ? 0 : 22, 218, 22, 26);
}
示例11: getMousePos
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
private static int[] getMousePos() {
ScaledResolution resolution = new ScaledResolution(MC);
int width = resolution.getScaledWidth();
int height = resolution.getScaledHeight();
int mouseX = Mouse.getX() * width / MC.displayWidth;
int mouseY = height - Mouse.getY() * height / MC.displayHeight - 1;
return new int[] {mouseX, mouseY};
}
示例12: renderOverlay
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
if (!ConfigHandler.BREW_HUD.hide && event.getType() == RenderGameOverlayEvent.ElementType.ALL) {
Optional<IBrewStorage> optional = BrewStorageHandler.getBrewStorage(Minecraft.getMinecraft().player);
if (optional.isPresent()) {
ScaledResolution res = event.getResolution();
int xOffset = res.getScaledWidth() - ConfigHandler.BREW_HUD.x;
int yOffset = ConfigHandler.BREW_HUD.y;
Minecraft mc = Minecraft.getMinecraft();
Collection<BrewEffect> effects = optional.get().getBrewEffects();
if (effects.isEmpty()) return;
for (BrewEffect effect : effects) {
IBrew brew = effect.getBrew();
if (brew.shouldRender()) {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
brew.renderHUD(xOffset, yOffset, mc, effect.getAmplifier());
if (ConfigHandler.BREW_HUD.orientation) {
yOffset += 22;
} else {
xOffset += 22;
}
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
}
}
}
}
示例13: onRenderTick
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent ev)
{
purgeExpiredFragments(null);
if (Minecraft.getMinecraft().currentScreen != null && !(Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu))
return;
int displayWidth = Minecraft.getMinecraft().displayWidth;
int displayHeight = Minecraft.getMinecraft().displayHeight;
ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft(), displayWidth, displayHeight);
int width = res.getScaledWidth();
int height = res.getScaledHeight();
float rx = (float) width / 1000f;
float ry = (float) height / 1000f;
synchronized(this.fragments)
{
for (TextCategory cat : TextCategory.values())
{
TextCategoryAttributes atts = this.attributes.get(cat);
if (atts != null && (!atts.flashing || ((System.currentTimeMillis() / 500) % 3 != 0)) && shouldDisplay(atts.displayLevel))
{
int x = Math.round(rx * (float) atts.xOrg);
int y = Math.round(ry * (float) atts.yOrg);
ArrayList<TextFragment> frags = this.fragments.get(cat);
if (frags != null && !frags.isEmpty())
{
for (TextFragment frag : frags)
{
drawText(frag.text, x, y, atts.colour);
y += 10;
}
}
}
}
}
}
示例14: handleMouseClick
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@Override
public void handleMouseClick(int mouseX, int mouseY, int mouseButton)
{
if(mouseButton != 0)
return;
if(!feature.getSettings().isEmpty()
&& mouseX > getX() + getWidth() - 12)
{
if(settingsWindow != null && !settingsWindow.isClosing())
{
settingsWindow.close();
settingsWindow = null;
return;
}
settingsWindow = new Window(feature.getName() + " Settings");
for(Setting setting : feature.getSettings())
settingsWindow.add(setting.getComponent());
settingsWindow.setClosable(true);
settingsWindow.setMinimizable(false);
settingsWindow.pack();
int scroll = getParent().isScrollingEnabled()
? getParent().getScrollOffset() : 0;
int x = getParent().getX() + getParent().getWidth() + 5;
int y = getParent().getY() + 12 + getY() + scroll;
ScaledResolution sr =
new ScaledResolution(Minecraft.getMinecraft());
if(x + settingsWindow.getWidth() > sr.getScaledWidth())
x = getParent().getX() - settingsWindow.getWidth() - 5;
if(y + settingsWindow.getHeight() > sr.getScaledHeight())
y -= settingsWindow.getHeight() - 14;
settingsWindow.setX(x);
settingsWindow.setY(y);
ClickGui gui = WurstClient.INSTANCE.getGui();
gui.addWindow(settingsWindow);
return;
}
feature.doPrimaryAction();
}
示例15: toScreen
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
/**
* Convert 3D coord into 2D coordinate projected onto the screen
*/
public static Plane toScreen(double x, double y, double z) {
Entity view = MC.getRenderViewEntity();
if(view == null) return new Plane(0.D, 0.D, false);
Vec3d camPos = FastReflection.Fields.ActiveRenderInfo_position.getStatic();
Vec3d eyePos = ActiveRenderInfo.projectViewFromEntity(view, MC.getRenderPartialTicks());
float vecX = (float) ((camPos.x + eyePos.x) - (float)x);
float vecY = (float) ((camPos.y + eyePos.y) - (float)y);
float vecZ = (float) ((camPos.z + eyePos.z) - (float)z);
Vector4f pos = new Vector4f(vecX, vecY, vecZ, 1.f);
modelMatrix.load(FastReflection.Fields.ActiveRenderInfo_MODELVIEW.getStatic().asReadOnlyBuffer());
projectionMatrix.load(FastReflection.Fields.ActiveRenderInfo_PROJECTION.getStatic().asReadOnlyBuffer());
VecTransformCoordinate(pos, modelMatrix);
VecTransformCoordinate(pos, projectionMatrix);
if (pos.w > 0.f) {
pos.x *= -100000;
pos.y *= -100000;
} else {
float invert = 1.f / pos.w;
pos.x *= invert;
pos.y *= invert;
}
ScaledResolution res = new ScaledResolution(MC);
float halfWidth = (float)res.getScaledWidth() / 2.f;
float halfHeight = (float)res.getScaledHeight() / 2.f;
pos.x = halfWidth + (0.5f * pos.x * res.getScaledWidth() + 0.5f);
pos.y = halfHeight - (0.5f * pos.y * res.getScaledHeight() + 0.5f);
boolean bVisible = true;
if(pos.x < 0 || pos.y < 0 || pos.x > res.getScaledWidth() || pos.y > res.getScaledHeight())
bVisible = false;
return new Plane(pos.x, pos.y, bVisible);
}