当前位置: 首页>>代码示例>>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;未经允许,请勿转载。