當前位置: 首頁>>代碼示例>>Java>>正文


Java Display.getHeight方法代碼示例

本文整理匯總了Java中org.lwjgl.opengl.Display.getHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java Display.getHeight方法的具體用法?Java Display.getHeight怎麽用?Java Display.getHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.lwjgl.opengl.Display的用法示例。


在下文中一共展示了Display.getHeight方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: resizeIfNeeded

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
/**
 * Resizes the window and the Minecraft rendering if necessary. Set renderWidth and renderHeight first.
 */
private void resizeIfNeeded()
{
    // resize the window if we need to
    int oldRenderWidth = Display.getWidth(); 
    int oldRenderHeight = Display.getHeight();
    if( this.renderWidth == oldRenderWidth && this.renderHeight == oldRenderHeight )
        return;
    
    try {
        Display.setDisplayMode(new DisplayMode(this.renderWidth, this.renderHeight));
        System.out.println("Resized the window");
    } catch (LWJGLException e) {
        System.out.println("Failed to resize the window!");
        e.printStackTrace();
    }
    forceResize(this.renderWidth, this.renderHeight);
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:21,代碼來源:VideoHook.java

示例2: drawScreen

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public void drawScreen(int x, int y, float par3) {
    GL11.glPushMatrix();
    ScaledResolution scaledRes = new ScaledResolution(this.mc);
    float scale = (float)scaledRes.getScaleFactor() / (float)Math.pow(scaledRes.getScaleFactor(), 2.0);
    GL11.glScalef((float)scale, (float)scale, (float)scale);
    int mouseX = Mouse.getX();
    int mouseY = Display.getHeight() - Mouse.getY();
    Gui.instance.update(mouseX, mouseY);
    Gui.instance.render();
    GL11.glPopMatrix();
    if (Mouse.hasWheel()) {
        int wheel = Mouse.getDWheel();
        this.scrollVelocity = wheel < 0 ? -120 : (wheel > 0 ? 120 : 0);
    }
    Gui.instance.mouseScroll(this.scrollVelocity);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:17,代碼來源:GuiGrabber.java

示例3: checkWindowResize

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
protected void checkWindowResize()
{
    if (!this.fullscreen && Display.wasResized())
    {
        int i = this.displayWidth;
        int j = this.displayHeight;
        this.displayWidth = Display.getWidth();
        this.displayHeight = Display.getHeight();

        if (this.displayWidth != i || this.displayHeight != j)
        {
            if (this.displayWidth <= 0)
            {
                this.displayWidth = 1;
            }

            if (this.displayHeight <= 0)
            {
                this.displayHeight = 1;
            }

            this.resize(this.displayWidth, this.displayHeight);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:26,代碼來源:Minecraft.java

示例4: createProjectionMatrix

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
private void createProjectionMatrix() {
	float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
	float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))) * aspectRatio);
	float x_scale = y_scale / aspectRatio;
	float frustum_length = FAR_PLANE - NEAR_PLANE;

	projectionMatrix = new Matrix4f();
	projectionMatrix.m00 = x_scale;
	projectionMatrix.m11 = y_scale;
	projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustum_length);
	projectionMatrix.m23 = -1;
	projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_length);
	projectionMatrix.m33 = 0;
}
 
開發者ID:DevipriyaSarkar,項目名稱:Terrain,代碼行數:15,代碼來源:MasterRenderer.java

示例5: toWorld

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
/**
 * Converts the specified X, Y, and Z screen positions
 * to a position in the world, that through some fancy
 * maths (raytracing) can be used get the actual block
 * position of the conversion
 *
 * @return World projected coordinates
 */
public static Vec3 toWorld(double x, double y, double z) {
    FloatBuffer screenCoords = BufferUtils.createFloatBuffer(3);
    boolean result = GLU.gluUnProject((float) x, (float) y, (float) z, MODELVIEW, PROJECTION, VIEWPORT, screenCoords);
    if (result) {
        return new Vec3(screenCoords.get(0), Display.getHeight() - screenCoords.get(1), screenCoords.get(2));
    }
    return null;
}
 
開發者ID:ImpactDevelopment,項目名稱:ClientAPI,代碼行數:17,代碼來源:GLUtils.java

示例6: scissor

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public static void scissor(int x, int y, int x2, int y2, boolean clickGui) {
    if (x == 0 && y == 0 && x2 == 0 && y2 == 0) {
        GL11.glEnable(GL11.GL_SCISSOR_TEST);
        return;
    }
    if (Wrapper.currentScreen() == null) return;
    int width = x2 - x;
    int height = y2 - y;
    int factor = clickGui ? 2 : getScaleFactor();
    int bottomY = (clickGui ? Display.getHeight() / 2 : Wrapper.currentScreen().field_146295_m) - y2;
    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    GL11.glScissor(x * factor, bottomY * factor, width * factor, height * factor);
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:14,代碼來源:RenderUtil.java

示例7: func_146286_b

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
@Override
protected void func_146286_b(int mouseXx, int mouseYy, int button) {
    if (Bit.getInstance() == null) {
        return;
    }
    int mouseX = (Mouse.getX() / 2);
    int mouseY = ((Display.getHeight() - Mouse.getY()) / 2);

    Iterator<Window> iter = Bit.getInstance().getClickGui().getWindows().iterator();
    while (iter.hasNext()) {
        Window comp = iter.next();
        comp.mouseRelease(mouseX, mouseY, button);
    }
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:15,代碼來源:ClickGuiDisplayer.java

示例8: createProjectionMatrix

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
private static Matrix4f createProjectionMatrix() {
	Matrix4f projectionMatrix = new Matrix4f();
	float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
	float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))));
	float x_scale = y_scale / aspectRatio;
	float frustum_length = FAR_PLANE - NEAR_PLANE;

	projectionMatrix.m00 = x_scale;
	projectionMatrix.m11 = y_scale;
	projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustum_length);
	projectionMatrix.m23 = -1;
	projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_length);
	projectionMatrix.m33 = 0;
	return projectionMatrix;
}
 
開發者ID:TheThinMatrix,項目名稱:LowPolyTerrain,代碼行數:16,代碼來源:Camera.java

示例9: update

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public void update() {
    if (Bit.getInstance() == null) return;
    int mouseX = (Mouse.getX() / 2);
    int mouseY = ((Display.getHeight() - Mouse.getY()) / 2);
    Iterator<Window> iter = Bit.getInstance().getClickGui().getWindows().iterator();
    int wheel = Mouse.hasWheel() ? Mouse.getDWheel() : 0;
    if (Bit.getInstance().getClickGui().getTopMost() != null)
        Bit.getInstance().getClickGui().getTopMost().mouseScroll(wheel < 0 ? -1 : (wheel > 0 ? 1 : 0));
    while (iter.hasNext()) {
        Window comp = iter.next();
        comp.update(mouseX, mouseY);
    }
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:14,代碼來源:ClickGuiDisplayer.java

示例10: createProjectionMatrix

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
/**
 * Creates matrix for perspective + camera
 */
private void createProjectionMatrix() {
    float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
    float y_scale = (float) ((1f / Math.tan(Math.toRadians(Reference.FOV / 2f))) * aspectRatio);
    float x_scale = y_scale / aspectRatio;
    float frustum_length = Reference.FAR_PLANE - Reference.NEAR_PLANE;

    projectionMatrix = new Matrix4f();
    projectionMatrix.m00 = x_scale;
    projectionMatrix.m11 = y_scale;
    projectionMatrix.m22 = -((Reference.FAR_PLANE + Reference.NEAR_PLANE) / frustum_length);
    projectionMatrix.m23 = -1;
    projectionMatrix.m32 = -((2 * Reference.NEAR_PLANE * Reference.FAR_PLANE) / frustum_length);
    projectionMatrix.m33 = 0;
}
 
開發者ID:Essentria,項目名稱:Elgin-Plant-Game,代碼行數:18,代碼來源:MasterRenderer.java

示例11: mouseClicked

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public void mouseClicked(int mX, int mY, int button) {
    int mouseX = Mouse.getX();
    int mouseY = Display.getHeight() - Mouse.getY();
    Gui.instance.mousePress(mouseX, mouseY, button);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:6,代碼來源:GuiGrabber.java

示例12: getProperScaleFactor

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public static float getProperScaleFactor() {
    ScaledResolution scaledResolution = new ScaledResolution(Wrapper.getMinecraft(), Display.getWidth(),
            Display.getHeight());
    float scaleF = scaledResolution.func_78325_e();
    return scaleF == 1 ? 2 : scaleF == 2 ? 1 : scaleF == 3 ? 0.666666667f : 0.4999999f;
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:7,代碼來源:RenderUtil.java

示例13: getDisplayWidth_scaled

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public static int getDisplayWidth_scaled() {
    ScaledResolution scaledResolution = new ScaledResolution(Wrapper.getMinecraft(), Display.getWidth(),
            Display.getHeight());
    return scaledResolution.func_78326_a();
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:6,代碼來源:RenderUtil.java

示例14: getDisplayScreenHeight

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
protected int getDisplayScreenHeight() {
	return Display.getHeight();
}
 
開發者ID:Moudoux,項目名稱:EMC,代碼行數:4,代碼來源:IGuiScreen.java

示例15: getScaleFactor

import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public static int getScaleFactor() {
    ScaledResolution scaledResolution = new ScaledResolution(Wrapper.getMinecraft(), Display.getWidth(),
            Display.getHeight());
    return scaledResolution.func_78325_e();
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:6,代碼來源:RenderUtil.java


注:本文中的org.lwjgl.opengl.Display.getHeight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。