From ca4e05f75b62a24c4890d509e62d9e7fb111da70 Mon Sep 17 00:00:00 2001 From: Caspian Rychlik-Prince Date: Sun, 22 Dec 2002 19:52:15 +0000 Subject: [PATCH] New DisplayMode code --- src/java/org/lwjgl/Display.java | 14 ++++---------- src/java/org/lwjgl/DisplayMode.java | 24 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/java/org/lwjgl/Display.java b/src/java/org/lwjgl/Display.java index ebd61810..b0e0304c 100644 --- a/src/java/org/lwjgl/Display.java +++ b/src/java/org/lwjgl/Display.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002 Lightweight Java Game Library Project + * Copyright (c) 2002 Light Weight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -81,18 +81,12 @@ public final class Display { * destroyed. * * @param displayMode a display mode to choose - * @param alpha_bits number of alpha bits required - * @param depth_bits number of depth bits required - * @param stencil_bits number of stencil bits required * @param fullscreen whether to create the display fullscreen * @throws Exception if the display mode could not be set * @see #destroy() */ public static void create( DisplayMode displayMode, - int alpha_bits, - int depth_bits, - int stencil_bits, boolean fullscreen) throws Exception { @@ -103,9 +97,9 @@ public final class Display { displayMode.height, displayMode.bpp, displayMode.freq, - alpha_bits, - depth_bits, - stencil_bits, + displayMode.alpha, + displayMode.depth, + displayMode.stencil, fullscreen)) throw new Exception("Failed to set display mode to " + displayMode); diff --git a/src/java/org/lwjgl/DisplayMode.java b/src/java/org/lwjgl/DisplayMode.java index c0f10b49..52cb4670 100644 --- a/src/java/org/lwjgl/DisplayMode.java +++ b/src/java/org/lwjgl/DisplayMode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002 Lightweight Java Game Library Project + * Copyright (c) 2002 Light Weight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,18 +43,21 @@ package org.lwjgl; public final class DisplayMode { - public final int width, height, bpp, freq; + public final int width, height, bpp, freq, alpha, depth, stencil; /** * Construct a display mode. * * @see Display */ - public DisplayMode(int width, int height, int bpp, int freq) { + private DisplayMode(int width, int height, int bpp, int freq, int alpha, int depth, int stencil) { this.width = width; this.height = height; this.bpp = bpp; this.freq = freq; + this.alpha = alpha; + this.depth = depth; + this.stencil = stencil; } @@ -69,14 +72,17 @@ public final class DisplayMode { return dm.width == width && dm.height == dm.height && dm.bpp == bpp - && dm.freq == freq; + && dm.freq == freq + && dm.alpha == alpha + && dm.depth == depth + && dm.stencil == stencil; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ public int hashCode() { - return width ^ height ^ freq ^ bpp; + return width ^ height ^ freq ^ bpp ^ alpha ^ (depth << 8) ^ (stencil << 24); } /* (non-Javadoc) @@ -91,7 +97,13 @@ public final class DisplayMode { sb.append(bpp); sb.append(" @"); sb.append(freq); - sb.append("Hz"); + sb.append("Hz "); + sb.append(alpha); + sb.append("bit alpha, "); + sb.append(depth); + sb.append("bit depth, "); + sb.append(stencil); + sb.append("bit stencil"); return sb.toString(); }