DXGL r849 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r848
|
r849
|
r850
>
Date:
18:14, 1 September 2018
Author:
admin
Status:
new
Tags:
Comment:
Add functions to DXGLTimer to set and compare times.
Modified paths:
/ddraw/struct.h
(modified) (
history
)
/ddraw/timer.c
(modified) (
history
)
/ddraw/timer.h
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/struct.h
—
—
@@ -47,6 +47,7 @@
48
48
double monitor_period;
49
49
double timer_frequency;
50
50
LARGE_INTEGER timer_base;
51
+ LARGE_INTEGER lastdraw;
51
52
} DXGLTimer;
52
53
53
54
// OpenGL Extensions structure
Index: ddraw/timer.c
—
—
@@ -73,4 +73,23 @@
74
74
sync_pos /= timer->monitor_period;
75
75
sync_pos *= (double)timer->lines;
76
76
return (unsigned int)sync_pos;
77
+}
78
+
79
+void DXGLTimer_SetLastDraw(DXGLTimer *timer)
80
+{
81
+ if (timer->timertype == 1) QueryPerformanceCounter(&timer->lastdraw);
82
+ else timer->lastdraw.QuadPart = timeGetTime();
83
+}
84
+
85
+BOOL DXGLTimer_CheckLastDraw(DXGLTimer *timer, DWORD ms)
86
+{
87
+ LARGE_INTEGER timerpos;
88
+ double milliseconds;
89
+ if (timer->timertype == 1) QueryPerformanceCounter(&timerpos);
90
+ else timerpos.QuadPart = timeGetTime();
91
+ timerpos.QuadPart -= timer->timer_base.QuadPart;
92
+ if (timer->timertype == 1) milliseconds = ((double)timerpos.QuadPart / (double)timer->timer_frequency) * 1000.0;
93
+ else milliseconds = (double)timerpos.QuadPart;
94
+ if (milliseconds < ms) return FALSE;
95
+ else return TRUE;
77
96
}
\ No newline at end of file
Index: ddraw/timer.h
—
—
@@ -26,6 +26,8 @@
27
27
void DXGLTimer_Init(DXGLTimer *timer);
28
28
void DXGLTimer_Calibrate(DXGLTimer *timer, unsigned int lines, unsigned int frequency);
29
29
unsigned int DXGLTimer_GetScanLine(DXGLTimer *timer);
30
+void DXGLTimer_SetLastDraw(DXGLTimer *timer);
31
+BOOL DXGLTimer_CheckLastDraw(DXGLTimer *timer, DWORD ms);
30
32
31
33
#ifdef __cplusplus
32
34
}
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version