当前位置: 首页>>代码示例>>Java>>正文


Java DisplayMode.getHeight方法代码示例

本文整理汇总了Java中org.lwjgl.opengl.DisplayMode.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java DisplayMode.getHeight方法的具体用法?Java DisplayMode.getHeight怎么用?Java DisplayMode.getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.lwjgl.opengl.DisplayMode的用法示例。


在下文中一共展示了DisplayMode.getHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Window

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
protected Window(Context context, WindowBuilder settings) {
	this.fpsCap = settings.getFpsCap();
	try {
		getSuitableFullScreenModes();
		DisplayMode resolution = getStartResolution(settings);
		Display.setInitialBackground(1, 1, 1);
		this.aspectRatio = (float) resolution.getWidth() / resolution.getHeight();
		setResolution(resolution, settings.isFullScreen());
		if (settings.hasIcon()) {
			Display.setIcon(settings.getIcon());
		}
		Display.setVSyncEnabled(settings.isvSync());
		Display.setTitle(settings.getTitle());
		Display.create(new PixelFormat().withDepthBits(24).withSamples(4), context.getAttribs());
		GL11.glViewport(0, 0, resolution.getWidth(), resolution.getHeight());
	} catch (LWJGLException e) {
		e.printStackTrace();
	}
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:20,代码来源:Window.java

示例2: getDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
public static DisplayMode getDisplayMode(Dimension p_getDisplayMode_0_) throws LWJGLException
{
    DisplayMode[] adisplaymode = Display.getAvailableDisplayModes();

    for (int i = 0; i < adisplaymode.length; ++i)
    {
        DisplayMode displaymode = adisplaymode[i];

        if (displaymode.getWidth() == p_getDisplayMode_0_.width && displaymode.getHeight() == p_getDisplayMode_0_.height && (desktopDisplayMode == null || displaymode.getBitsPerPixel() == desktopDisplayMode.getBitsPerPixel() && displaymode.getFrequency() == desktopDisplayMode.getFrequency()))
        {
            return displaymode;
        }
    }

    return desktopDisplayMode;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:17,代码来源:Config.java

示例3: getDisplayModes

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
private static DisplayMode[] getDisplayModes(DisplayMode[] p_getDisplayModes_0_, Dimension p_getDisplayModes_1_)
{
    List list = new ArrayList();

    for (int i = 0; i < p_getDisplayModes_0_.length; ++i)
    {
        DisplayMode displaymode = p_getDisplayModes_0_[i];

        if ((double)displaymode.getWidth() == p_getDisplayModes_1_.getWidth() && (double)displaymode.getHeight() == p_getDisplayModes_1_.getHeight())
        {
            list.add(displaymode);
        }
    }

    DisplayMode[] adisplaymode = (DisplayMode[])((DisplayMode[])list.toArray(new DisplayMode[list.size()]));
    return adisplaymode;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:Config.java

示例4: getDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
public static DisplayMode getDisplayMode(Dimension p_getDisplayMode_0_) throws LWJGLException
{
    DisplayMode[] adisplaymode = getDisplayModes();

    for (int i = 0; i < adisplaymode.length; ++i)
    {
        DisplayMode displaymode = adisplaymode[i];

        if (displaymode.getWidth() == p_getDisplayMode_0_.width && displaymode.getHeight() == p_getDisplayMode_0_.height)
        {
            return displaymode;
        }
    }

    return desktopDisplayMode;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:Config.java

示例5: Window

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
protected Window(Context context, WindowBuilder settings) {
    this.fpsCap = settings.getFpsCap();
    try {
        getSuitableFullScreenModes();
        DisplayMode resolution = getStartResolution(settings);
        Display.setInitialBackground(0f, 0f, 0f);
        this.aspectRatio = (float) resolution.getWidth() / resolution.getHeight();
        setResolution(resolution, settings.isFullScreen());
        if (settings.hasIcon()) {
            Display.setIcon(settings.getIcon());
        }
        Display.setVSyncEnabled(settings.isvSync());
        Display.setTitle(settings.getTitle());
        Display.create(new PixelFormat().withDepthBits(24).withSamples(4), context.getAttribs());
        GL11.glViewport(0, 0, resolution.getWidth(), resolution.getHeight());
    } catch (LWJGLException e) {
        e.printStackTrace();
    }
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:20,代码来源:Window.java

示例6: findFullscreenDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
/**
 * from org.newdawn.slick.AppGameContainer#setDisplayMode
 */
public static DisplayMode findFullscreenDisplayMode(int targetBPP, int targetFrequency, int width, int height) throws LWJGLException {
	DisplayMode[] modes = Display.getAvailableDisplayModes();
	DisplayMode foundMode = null;
	int freq = 0;
	int bpp = 0;

	for (DisplayMode current : modes) {
		if (current.getWidth() != width || current.getHeight() != height) {
			continue;
		}

		if (current.getBitsPerPixel() == targetBPP && current.getFrequency() == targetFrequency) {
			return current;
		}

		if (current.getFrequency() >= freq && (foundMode == null || current.getBitsPerPixel() >= bpp)) {
			foundMode = current;
			freq = foundMode.getFrequency();
			bpp = foundMode.getBitsPerPixel();
		}
	}
	return foundMode;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:27,代码来源:GLHelper.java

示例7: getFullscreenDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
protected DisplayMode getFullscreenDisplayMode(int width, int height, int bpp, int freq){
    try {
        DisplayMode[] modes = Display.getAvailableDisplayModes();
        for (DisplayMode mode : modes){
            if (mode.getWidth() == width
             && mode.getHeight() == height
             && (mode.getBitsPerPixel() == bpp || (bpp==24&&mode.getBitsPerPixel()==32))
             && mode.getFrequency() == freq){
                return mode;
            }
        }
    } catch (LWJGLException ex) {
        listener.handleError("Failed to acquire fullscreen display mode!", ex);
    }
    return null;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:LwjglDisplay.java

示例8: notifyTimeOnFullScreen

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
public void notifyTimeOnFullScreen() {
    if (!FzConfig.show_time_on_fullscreen) return;
    if (interval <= 0) return;
    long now = getNow();
    if (now == old_now || now == -1) return;
    old_now = now;
    Minecraft mc = Minecraft.getMinecraft();
    if (!mc.isFullScreen()) {
        DisplayMode desktop = Display.getDesktopDisplayMode();
        if (desktop.getWidth() != mc.displayWidth || desktop.getHeight() != mc.displayHeight) {
            return;
        }
    }
    DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
    String msg = df.format(new Date());
    if (!mentioned_disabling) {
        msg += " (via FZ)";
        mentioned_disabling = true;
    }
    ChatStyle style = new ChatStyle().setItalic(true).setColor(EnumChatFormatting.GRAY);
    mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(msg).setChatStyle(style), 20392);
    last_msg = msg;
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:24,代码来源:MiscClientTickHandler.java

示例9: compare

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
@Override
public int compare(DisplayMode a, DisplayMode b)
{
	if (a.getWidth() != b.getWidth())
	{
		return (a.getWidth() > b.getWidth()) ? 1 : -1;
	}
	if (a.getHeight() != b.getHeight())
	{
		return (a.getHeight() > b.getHeight()) ? 1 : -1;
	}
	if (a.getBitsPerPixel() != b.getBitsPerPixel())
	{
		return (a.getBitsPerPixel() > b.getBitsPerPixel()) ? 1 : -1;
	}
	if (a.getFrequency() != b.getFrequency())
	{
		return (a.getFrequency() > b.getFrequency()) ? 1 : -1;
	}
	return 0;
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:22,代码来源:DisplayModeComparator.java

示例10: getDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
public static DisplayMode getDisplayMode(Dimension dim) throws LWJGLException
{
    DisplayMode[] modes = Display.getAvailableDisplayModes();

    for (int i = 0; i < modes.length; ++i)
    {
        DisplayMode dm = modes[i];

        if (dm.getWidth() == dim.width && dm.getHeight() == dim.height && (desktopDisplayMode == null || dm.getBitsPerPixel() == desktopDisplayMode.getBitsPerPixel() && dm.getFrequency() == desktopDisplayMode.getFrequency()))
        {
            return dm;
        }
    }

    return desktopDisplayMode;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:17,代码来源:Config.java

示例11: findBestDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
public static DisplayMode findBestDisplayMode(int width, int height) {
    DisplayMode desktopMode = Display.getDesktopDisplayMode();
    if (width == desktopMode.getWidth() && height == desktopMode.getHeight()) {
        return desktopMode;
    }
    DisplayMode bestMode = null;
    try {
        for (DisplayMode m : Display.getAvailableDisplayModes()) {
            if (width == m.getWidth() && height == m.getHeight()) {
                if (null == bestMode
                        || (m.isFullscreenCapable() && !bestMode.isFullscreenCapable())
                        || (m.getBitsPerPixel() > bestMode.getBitsPerPixel())
                        || m.getFrequency() > bestMode.getFrequency()) {
                    bestMode = m;
                }
            }
        }
        if (null != bestMode) {
            return bestMode;
        }
    } catch (LWJGLException ex) {
        Logger.getLogger(LwjglHelper.class.getName()).log(Level.SEVERE, null, ex);
    }
    return new DisplayMode(width, height);
}
 
开发者ID:devnewton,项目名称:jnuit,代码行数:26,代码来源:LwjglHelper.java

示例12: isDisplayModeBetter

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
public static boolean isDisplayModeBetter(DisplayMode current, DisplayMode isBetter){

        //Formatted weirdly to quickly see what the preferred settings are
        if(
           isBetter.getWidth() >= current.getWidth() &&
           isBetter.getHeight() >= current.getHeight() &&
           isBetter.getFrequency() >= current.getFrequency() &&
           isBetter.getBitsPerPixel() >= current.getBitsPerPixel() &&
           isBetter.isFullscreenCapable()
          ){

            return true;
        }

        return false;
    }
 
开发者ID:CryoGenesis,项目名称:GGU,代码行数:17,代码来源:DisplayUtility.java

示例13: doesDisplayModeExist

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
public static DisplayMode doesDisplayModeExist(EngineConfiguration config) throws LWJGLException{

        DisplayMode[] modes = Display.getAvailableDisplayModes();
        DisplayMode chosen = null;

        for(DisplayMode mode : modes){
            int width = mode.getWidth();
            int height = mode.getHeight();

            if(width == config.DISPLAY_WIDTH && height == config.DISPLAY_HEIGHT){
                if(chosen == null){
                    chosen = mode;
                }else{
                    if(isDisplayModeBetter(chosen, mode)){
                        chosen = mode;
                    }
                }
            }

        }

        return chosen;

    }
 
开发者ID:CryoGenesis,项目名称:GGU,代码行数:25,代码来源:DisplayUtility.java

示例14: isSuitableFullScreenResolution

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
private boolean isSuitableFullScreenResolution(DisplayMode resolution, DisplayMode desktopResolution) {
	if (resolution.getBitsPerPixel() == desktopResolution.getBitsPerPixel()) {
		if (resolution.getFrequency() == desktopResolution.getFrequency()) {
			float desktopAspect = (float) desktopResolution.getWidth() / desktopResolution.getHeight();
			float resAspect = (float) resolution.getWidth() / resolution.getHeight();
			float check = resAspect / desktopAspect;
			if (check > 0.95f && check < 1.05f) {
				return resolution.getHeight() > MIN_HEIGHT;
			}
		}
	}
	return false;
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:14,代码来源:Window.java

示例15: getFullScreenDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入方法依赖的package包/类
private DisplayMode getFullScreenDisplayMode(int width, int height) {
	for (DisplayMode potentialMode : availableResolutions) {
		if (potentialMode.getWidth() == width && potentialMode.getHeight() == height) {
			return potentialMode;
		}
	}
	return null;
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:9,代码来源:Window.java


注:本文中的org.lwjgl.opengl.DisplayMode.getHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。