本文整理汇总了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();
}
示例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();
}
}
示例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));
}
}
示例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));
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}