本文整理匯總了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);
}
}