summaryrefslogtreecommitdiffstats
path: root/src/glut/dos/state.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2002-02-23 17:11:27 +0000
committerBrian Paul <[email protected]>2002-02-23 17:11:27 +0000
commite0193a9425807cc61779c3b8680c5b551685ba65 (patch)
treeb3dacd48e37032f60b2b450a68d406d9deee2e1e /src/glut/dos/state.c
parentc7a3356746b8751fa0f04c8c0b674e26d73fdb76 (diff)
DOS updates from Daniel Borca
Diffstat (limited to 'src/glut/dos/state.c')
-rw-r--r--src/glut/dos/state.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/glut/dos/state.c b/src/glut/dos/state.c
index 9e5624deb4c..94ef0cac795 100644
--- a/src/glut/dos/state.c
+++ b/src/glut/dos/state.c
@@ -19,7 +19,7 @@
*/
/*
- * DOS/DJGPP glut driver v0.1 for Mesa 4.0
+ * DOS/DJGPP glut driver v0.2 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : [email protected]
@@ -28,6 +28,21 @@
#include "GL/glut.h"
+#include "internal.h"
+
+
+#define FREQUENCY 100
+
+
+static int timer_installed;
+static volatile int ticks;
+
+static void ticks_timer (void *p)
+{
+ (void)p;
+ ticks++;
+} ENDOFUNC(ticks_timer)
+
int APIENTRY glutGet (GLenum type)
@@ -35,6 +50,14 @@ int APIENTRY glutGet (GLenum type)
switch (type) {
case GLUT_WINDOW_RGBA:
return 1;
+ case GLUT_ELAPSED_TIME:
+ if (!timer_installed) {
+ timer_installed = !timer_installed;
+ LOCKDATA(ticks);
+ LOCKFUNC(ticks_timer);
+ pc_install_int(ticks_timer, NULL, FREQUENCY);
+ }
+ return ticks*1000/FREQUENCY;
default:
return 0;
}