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


Java Display.setFullscreen方法代码示例

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


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

示例1: setFullscreen

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
/**
 * Indicate whether we want to be in fullscreen mode. Note that the current
 * display mode must be valid as a fullscreen mode for this to work
 * 
 * @param fullscreen True if we want to be in fullscreen mode
 * @throws SlickException Indicates we failed to change the display mode
 */
public void setFullscreen(boolean fullscreen) throws SlickException {
	if (isFullscreen() == fullscreen) {
		return;
	}
	
	if (!fullscreen) {
		try {
			Display.setFullscreen(fullscreen);
		} catch (LWJGLException e) {
			throw new SlickException("Unable to set fullscreen="+fullscreen, e);
		}
	} else {
		setDisplayMode(width, height, fullscreen);
	}
	getDelta();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:24,代码来源:AppGameContainer.java

示例2: setResolution

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public void setResolution(DisplayMode resolution, boolean fullscreen) {
	try {
		Display.setDisplayMode(resolution);
		this.resolution = resolution;
		if (fullscreen && resolution.isFullscreenCapable()) {
			Display.setFullscreen(true);
			this.fullScreen = fullscreen;
		}
	} catch (LWJGLException e) {
		e.printStackTrace();
	}
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:13,代码来源:Window.java

示例3: setInitialDisplayMode

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private void setInitialDisplayMode() throws LWJGLException
{
    if (this.fullscreen)
    {
        Display.setFullscreen(true);
        DisplayMode displaymode = Display.getDisplayMode();
        this.displayWidth = Math.max(1, displaymode.getWidth());
        this.displayHeight = Math.max(1, displaymode.getHeight());
    }
    else
    {
        Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:Minecraft.java

示例4: setInitialDisplayMode

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private void setInitialDisplayMode() throws LWJGLException {
	if (this.fullscreen) {
		Display.setFullscreen(true);
		DisplayMode displaymode = Display.getDisplayMode();
		this.displayWidth = Math.max(1, displaymode.getWidth());
		this.displayHeight = Math.max(1, displaymode.getHeight());
	} else {
		Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight));
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:Minecraft.java

示例5: setResolution

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public void setResolution(DisplayMode resolution, boolean fullscreen) {
    try {
        Display.setDisplayMode(resolution);
        this.resolution = resolution;
        if (fullscreen && resolution.isFullscreenCapable()) {
            Display.setFullscreen(true);
            this.fullScreen = fullscreen;
        }
    } catch (LWJGLException e) {
        e.printStackTrace();
    }
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:13,代码来源:Window.java

示例6: setFullscreen

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public void setFullscreen(boolean fullscreen) throws SlickException {
   if (fullscreen == isFullscreen()) {
      return;
   }

   try {
      if (fullscreen) {
         // get current screen resolution
         int screenWidth = Display.getDisplayMode().getWidth();
         int screenHeight = Display.getDisplayMode().getHeight();

         // calculate aspect ratio
         float gameAspectRatio = (float) width / height;
         float screenAspectRatio = (float) screenWidth
               / screenHeight;

         int newWidth;
         int newHeight;

         // get new screen resolution to match aspect ratio

         if (gameAspectRatio >= screenAspectRatio) {
            newWidth = screenWidth;
            newHeight = (int) (height / ((float) width / screenWidth));
         } else {
            newWidth = (int) (width / ((float) height / screenHeight));
            newHeight = screenHeight;
         }

         // center new screen
         int xoffset = (screenWidth - newWidth) / 2;
         int yoffset = (screenHeight - newHeight) / 2;

         // scale game to match new resolution
         GL11.glViewport(xoffset, yoffset, newWidth, newHeight);

         enterOrtho();

         // fix input to match new resolution
         this.getInput().setOffset(
               -xoffset * (float) width / newWidth,
               -yoffset * (float) height / newHeight);

         this.getInput().setScale((float) width / newWidth,
               (float) height / newHeight);

         width = screenWidth;
         height = screenHeight;
         Display.setFullscreen(true);
      } else {
         // restore input
         this.getInput().setOffset(0, 0);
         this.getInput().setScale(1, 1);
         width = AppletGameContainer.this.getWidth();
         height = AppletGameContainer.this.getHeight();
         GL11.glViewport(0, 0, width, height);

         enterOrtho();

         Display.setFullscreen(false);
      }
   } catch (LWJGLException e) {
      Log.error(e);
   }

}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:67,代码来源:AppletGameContainer.java

示例7: toggleFullscreen

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
/**
 * Toggles fullscreen mode.
 */
public void toggleFullscreen()
{
    try
    {
        this.fullscreen = !this.fullscreen;
        this.gameSettings.fullScreen = this.fullscreen;

        if (this.fullscreen)
        {
            this.updateDisplayMode();
            this.displayWidth = Display.getDisplayMode().getWidth();
            this.displayHeight = Display.getDisplayMode().getHeight();

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

            if (this.displayHeight <= 0)
            {
                this.displayHeight = 1;
            }
        }
        else
        {
            Display.setDisplayMode(new DisplayMode(this.tempDisplayWidth, this.tempDisplayHeight));
            this.displayWidth = this.tempDisplayWidth;
            this.displayHeight = this.tempDisplayHeight;

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

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

        if (this.currentScreen != null)
        {
            this.resize(this.displayWidth, this.displayHeight);
        }
        else
        {
            this.updateFramebufferSize();
        }

        Display.setFullscreen(this.fullscreen);
        Display.setVSyncEnabled(this.gameSettings.enableVsync);
        this.updateDisplay();
    }
    catch (Exception exception)
    {
        logger.error((String)"Couldn\'t toggle fullscreen", (Throwable)exception);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:62,代码来源:Minecraft.java

示例8: toggleFullscreen

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
/**
 * Toggles fullscreen mode.
 */
public void toggleFullscreen() {
	try {
		this.fullscreen = !this.fullscreen;
		this.gameSettings.fullScreen = this.fullscreen;

		if (this.fullscreen) {
			this.updateDisplayMode();
			this.displayWidth = Display.getDisplayMode().getWidth();
			this.displayHeight = Display.getDisplayMode().getHeight();

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

			if (this.displayHeight <= 0) {
				this.displayHeight = 1;
			}
		} else {
			Display.setDisplayMode(new DisplayMode(this.tempDisplayWidth, this.tempDisplayHeight));
			this.displayWidth = this.tempDisplayWidth;
			this.displayHeight = this.tempDisplayHeight;

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

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

		if (this.currentScreen != null) {
			this.resize(this.displayWidth, this.displayHeight);
		} else {
			this.updateFramebufferSize();
		}

		Display.setFullscreen(this.fullscreen);
		Display.setVSyncEnabled(this.gameSettings.enableVsync);
		this.updateDisplay();
	} catch (Exception exception) {
		logger.error((String) "Couldn\'t toggle fullscreen", (Throwable) exception);
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:48,代码来源:Minecraft.java

示例9: toggleFullscreen

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
/**
 * Toggles fullscreen mode.
 */
public void toggleFullscreen()
{
    try
    {
        this.fullscreen = !this.fullscreen;
        this.gameSettings.fullScreen = this.fullscreen;

        if (this.fullscreen)
        {
            this.updateDisplayMode();
            this.displayWidth = Display.getDisplayMode().getWidth();
            this.displayHeight = Display.getDisplayMode().getHeight();

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

            if (this.displayHeight <= 0)
            {
                this.displayHeight = 1;
            }
        }
        else
        {
            Display.setDisplayMode(new DisplayMode(this.tempDisplayWidth, this.tempDisplayHeight));
            this.displayWidth = this.tempDisplayWidth;
            this.displayHeight = this.tempDisplayHeight;

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

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

        if (this.currentScreen != null)
        {
            this.resize(this.displayWidth, this.displayHeight);
        }
        else
        {
            this.updateFramebufferSize();
        }

        Display.setFullscreen(this.fullscreen);
        Display.setVSyncEnabled(this.gameSettings.enableVsync);
        this.updateDisplay();
    }
    catch (Exception exception)
    {
        LOGGER.error((String)"Couldn\'t toggle fullscreen", (Throwable)exception);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:62,代码来源:Minecraft.java


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