This commit is contained in:
Caspian Rychlik-Prince 2004-04-04 13:39:10 +00:00
parent bd0091b8d9
commit 0e733a1fb7
2 changed files with 9 additions and 8 deletions

View File

@ -208,7 +208,7 @@ public final class Window {
* If you are writing a straightforward game rendering loop and simply paint
* every frame regardless, you can ignore this flag altogether. If you are
* trying to be kind to other processes you can check this flag and only
* redraw when it returns true. The flag is cleared when you call paint().
* redraw when it returns true. The flag is cleared when swapBuffers() is caleld.
*
* @return true if the window has been damaged by external changes
* and needs to repaint itself
@ -229,13 +229,15 @@ public final class Window {
public static void update() {
if (!isCreated())
throw new IllegalStateException("Cannot update uncreated window");
nUpdate();
// We paint only when the window is visible, and either dirty or active.
if (isVisible() && (isDirty() || isActive())) {
// We paint only when the window is visible or dirty
if (isVisible() || isDirty()) {
Util.checkGLError();
swapBuffers();
}
nUpdate();
// Poll the input devices while we're here
if (Mouse.isCreated()) {
Mouse.poll();

View File

@ -68,6 +68,7 @@ static int current_width;
static bool input_released;
static bool isUndecorated;
static bool dirty;
static bool vsync_enabled;
static bool minimized;
@ -462,7 +463,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate
bool fscreen = false;
if (fullscreen == JNI_TRUE)
fscreen = true;
bool isUndecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated");
isUndecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated");
if (!extgl_Open()) {
throwException(env, "Could not load gl libs");
@ -526,9 +527,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_swapBuffers(JNIEnv * env, jc
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsDirty
(JNIEnv *env, jclass clazz) {
bool result = dirty;
dirty = false;
return result ? JNI_TRUE : JNI_FALSE;
return dirty ? JNI_TRUE : JNI_FALSE;
}
/*