Changed the name of the new function from "add_interval_timeout" to
"repeat_timeout", which is shorter and more accurately describes what it does. GLUT_STROKE_*_ROMAN in glut.h are defined as 0,1 on WIN32 to match the glut header files there. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1232 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
23594d8374
commit
1150141ead
6
FL/Fl.H
6
FL/Fl.H
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl.H,v 1.8.2.8 2000/06/20 05:47:32 bill Exp $"
|
||||
// "$Id: Fl.H,v 1.8.2.9 2000/06/21 17:36:33 bill Exp $"
|
||||
//
|
||||
// Main header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -91,7 +91,7 @@ public:
|
||||
static FL_EXPORT int run();
|
||||
static FL_EXPORT Fl_Widget* readqueue();
|
||||
static FL_EXPORT void add_timeout(double t, Fl_Timeout_Handler,void* = 0);
|
||||
static FL_EXPORT void add_interval_timeout(double t, Fl_Timeout_Handler,void* = 0);
|
||||
static FL_EXPORT void repeat_timeout(double t, Fl_Timeout_Handler,void* = 0);
|
||||
static FL_EXPORT int has_timeout(Fl_Timeout_Handler, void* = 0);
|
||||
static FL_EXPORT void remove_timeout(Fl_Timeout_Handler, void* = 0);
|
||||
static FL_EXPORT void add_fd(int fd, int when, void (*cb)(int,void*),void* =0);
|
||||
@ -214,5 +214,5 @@ public:
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl.H,v 1.8.2.8 2000/06/20 05:47:32 bill Exp $".
|
||||
// End of "$Id: Fl.H,v 1.8.2.9 2000/06/21 17:36:33 bill Exp $".
|
||||
//
|
||||
|
@ -303,23 +303,25 @@ Add a one-shot timeout callback. The function will be called by
|
||||
<tt>Fl::wait()</tt> at <i>t</i> seconds after this function is called.
|
||||
The optional <tt>void*</tt> argument is passed to the callback.
|
||||
|
||||
<h3><A name=add_interval_timeout>static void Fl::add_interval_timeout(float t, void (*cb)(void*),void*v=0)</A></h3>
|
||||
<h3><A name=repeat_timeout>static void Fl::repeat_timeout(float t, void (*cb)(void*),void*v=0)</A></h3>
|
||||
|
||||
Add a one-shot timeout callback. The difference from <a
|
||||
href=#add_timeout>add_timeout</a> is that the time is measured from
|
||||
when the last timeout callback was called, rather than from the moment
|
||||
this function is called (if no timeout has been called recently the
|
||||
time is measured from the next call to Fl::wait). This is designed
|
||||
for making regularly-spaced timeouts at high speed (like for movie
|
||||
playback), it also has slightly less system-call overhead than
|
||||
add_timeout.
|
||||
Inside a timeout callback you can call this to add another timeout.
|
||||
Rather than the time being measured from "now", it is measured from
|
||||
when the system call elapsed that caused this timeout to be called. This
|
||||
will result in far more accurate spacing of the timeout callbacks, it
|
||||
also has slightly less system call overhead. (It will also use all
|
||||
your machine time if your timeout code and fltk's overhead take more
|
||||
than <i>t</i> seconds, as the real timeout will be reduced to zero).
|
||||
|
||||
<p>It is undefined what this does if called from outside a timeout
|
||||
callback.
|
||||
|
||||
<P>This code will print "TICK" each second on stdout, with a
|
||||
fair degree of accuracy:
|
||||
|
||||
<UL><PRE>void callback(void*) {
|
||||
printf("TICK\n");
|
||||
Fl::add_interval_timeout(1.0,callback);
|
||||
Fl::repeat_timeout(1.0,callback);
|
||||
}
|
||||
|
||||
main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl.cxx,v 1.24.2.29 2000/06/20 15:20:34 carl Exp $"
|
||||
// "$Id: Fl.cxx,v 1.24.2.30 2000/06/21 17:36:36 bill Exp $"
|
||||
//
|
||||
// Main event handling code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -198,10 +198,10 @@ int Fl::ready() {
|
||||
|
||||
void Fl::add_timeout(double t, Fl_Timeout_Handler cb, void *v) {
|
||||
elapse_timeouts();
|
||||
add_interval_timeout(t, cb, v);
|
||||
repeat_timeout(t, cb, v);
|
||||
}
|
||||
|
||||
void Fl::add_interval_timeout(double t, Fl_Timeout_Handler cb, void *v) {
|
||||
void Fl::repeat_timeout(double t, Fl_Timeout_Handler cb, void *v) {
|
||||
|
||||
if (numtimeouts >= timeout_array_size) {
|
||||
timeout_array_size = 2*timeout_array_size+1;
|
||||
@ -729,5 +729,5 @@ void Fl_Window::flush() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl.cxx,v 1.24.2.29 2000/06/20 15:20:34 carl Exp $".
|
||||
// End of "$Id: Fl.cxx,v 1.24.2.30 2000/06/21 17:36:36 bill Exp $".
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user