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


Java DisplayMode.getFrequency方法代碼示例

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


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

示例1: 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

示例2: getDisplayMode

import org.lwjgl.opengl.DisplayMode; //導入方法依賴的package包/類
private static DisplayMode getDisplayMode(DisplayMode[] p_getDisplayMode_0_, DisplayMode p_getDisplayMode_1_)
{
    if (p_getDisplayMode_1_ != null)
    {
        for (int i = 0; i < p_getDisplayMode_0_.length; ++i)
        {
            DisplayMode displaymode = p_getDisplayMode_0_[i];

            if (displaymode.getBitsPerPixel() == p_getDisplayMode_1_.getBitsPerPixel() && displaymode.getFrequency() == p_getDisplayMode_1_.getFrequency())
            {
                return displaymode;
            }
        }
    }

    if (p_getDisplayMode_0_.length <= 0)
    {
        return null;
    }
    else
    {
        Arrays.sort(p_getDisplayMode_0_, new DisplayModeComparator());
        return p_getDisplayMode_0_[p_getDisplayMode_0_.length - 1];
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:26,代碼來源:Config.java

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: getBits

import org.lwjgl.opengl.DisplayMode; //導入方法依賴的package包/類
private List<Integer> getBits()
{
	List<DisplayMode> modes = resolutionMap.get(getSelectedResolution());
	List<Integer> bits = new ArrayList<Integer>();
	
	if (modes != null)
	{
		for (DisplayMode mode:modes)
		{
			if (getSelectedFrequency()<0 ||  mode.getFrequency() == getSelectedFrequency())
			{
				if (!bits.contains(mode.getBitsPerPixel()))
					bits.add(mode.getBitsPerPixel());
			}
		}
	}
	Collections.sort(bits);
	return bits;
}
 
開發者ID:sambayless,項目名稱:golems,代碼行數:20,代碼來源:DisplayModeTab.java

示例8: 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

示例9: 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

示例10: 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

示例11: getFullscreenDisplayModes

import org.lwjgl.opengl.DisplayMode; //導入方法依賴的package包/類
public static DisplayMode[] getFullscreenDisplayModes()
{
    try
    {
        DisplayMode[] adisplaymode = Display.getAvailableDisplayModes();
        List list = new ArrayList();

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

            if (desktopDisplayMode == null || displaymode.getBitsPerPixel() == desktopDisplayMode.getBitsPerPixel() && displaymode.getFrequency() == desktopDisplayMode.getFrequency())
            {
                list.add(displaymode);
            }
        }

        DisplayMode[] adisplaymode1 = (DisplayMode[])((DisplayMode[])list.toArray(new DisplayMode[list.size()]));
        Comparator comparator = new Comparator()
        {
            public int compare(Object p_compare_1_, Object p_compare_2_)
            {
                DisplayMode displaymode1 = (DisplayMode)p_compare_1_;
                DisplayMode displaymode2 = (DisplayMode)p_compare_2_;
                return displaymode1.getWidth() != displaymode2.getWidth() ? displaymode2.getWidth() - displaymode1.getWidth() : (displaymode1.getHeight() != displaymode2.getHeight() ? displaymode2.getHeight() - displaymode1.getHeight() : 0);
            }
        };
        Arrays.sort(adisplaymode1, comparator);
        return adisplaymode1;
    }
    catch (Exception exception)
    {
        exception.printStackTrace();
        return new DisplayMode[] {desktopDisplayMode};
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:37,代碼來源:Config.java

示例12: 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:GryPLOfficial,項目名稱:EcoSystem-Official,代碼行數:14,代碼來源:Window.java

示例13: getFullScreenResolution

import org.lwjgl.opengl.DisplayMode; //導入方法依賴的package包/類
@Override
public Coordinate getFullScreenResolution() {
	Array<DisplayMode> shortList = new Array<>();

	try {
		DisplayMode[] modes = Display.getAvailableDisplayModes(720, 480, 1920, 1080, 32, 32, 30, 120);

		double longestHypotenuse = 0;
		for (int i = 0; i < modes.length; i++) {
			DisplayMode current = modes[i];
			double hypot = hypot(current);
			if (hypot > longestHypotenuse){
				shortList.clear();
				shortList.add(current);
				longestHypotenuse = hypot;
			} else if (hypot == longestHypotenuse)
				shortList.add(current);
		}
	}catch (LWJGLException e){

	}


	System.out.println(shortList);
	DisplayMode best = null;
	for (DisplayMode displayMode : shortList){
		if (best == null || displayMode.getFrequency() > best.getFrequency()){
			best = displayMode;
		}
	}
	if (best != null){
		return new Coordinate(best.getWidth(), best.getHeight());
	}
	return null;
}
 
開發者ID:cypherdare,項目名稱:SpaceShift,代碼行數:36,代碼來源:DesktopLauncher.java

示例14: getCurrentDisplayMode

import org.lwjgl.opengl.DisplayMode; //導入方法依賴的package包/類
/**
 * Gets the current display mode.
 *
 * @param modes
 *            the modes
 * @return the current display mode
 */
public DisplayMode getCurrentDisplayMode(DisplayMode[] modes)
{
	for (DisplayMode m : modes)
	{
		if ((m.getHeight() == prefs.getHeight()) && (m.getWidth() == prefs.getWidth()) && (m.getBitsPerPixel() == prefs.getBitsPerPixel()) && (m.getFrequency() == prefs.getFrequency()))
		{
			return m;
		}
	}

	return null;
}
 
開發者ID:synergynet,項目名稱:synergynet3.1,代碼行數:20,代碼來源:DisplayConfigPanel.java

示例15: getCurrentDisplayModeIndex

import org.lwjgl.opengl.DisplayMode; //導入方法依賴的package包/類
/**
 * Gets the current display mode index.
 *
 * @param modes
 *            the modes
 * @return the current display mode index
 */
private int getCurrentDisplayModeIndex(DisplayMode[] modes)
{
	for (int i = 0; i < modes.length; i++)
	{
		DisplayMode m = modes[i];

		if ((m.getHeight() == prefs.getHeight()) && (m.getWidth() == prefs.getWidth()) && (m.getBitsPerPixel() == prefs.getBitsPerPixel()) && (m.getFrequency() == prefs.getFrequency()))
		{
			return i;
		}
	}

	return -1;
}
 
開發者ID:synergynet,項目名稱:synergynet3.1,代碼行數:22,代碼來源:DisplayConfigPanel.java


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