Mercurial > fife-parpg
comparison engine/python/fife/extensions/fife_timer.py @ 487:7f1c42b66aa4
Moved the shooter demo Timer() class to helpers.py.
Changed the formula that calculates the length of the audio clip to be correct.
The shooter demo now demonstrates the use of the audio clip callbacks correctly.
Fixed the fife_timer extension to actually work.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 03 May 2010 19:58:16 +0000 |
parents | 64738befdf3b |
children | 23d01971e9c2 |
comparison
equal
deleted
inserted
replaced
486:2aaa22475acd | 487:7f1c42b66aa4 |
---|---|
20 # Free Software Foundation, Inc., | 20 # Free Software Foundation, Inc., |
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
22 # #################################################################### | 22 # #################################################################### |
23 | 23 |
24 from fife import fife | 24 from fife import fife |
25 from fife.extensions.pychan.tools import callbackWithArguments as cbwa | |
25 | 26 |
26 """ | 27 """ |
27 Convenient timers | 28 Convenient timers |
28 ================= | 29 ================= |
29 | 30 |
90 @param callback The function to call. | 91 @param callback The function to call. |
91 | 92 |
92 @return The timer. | 93 @return The timer. |
93 """ | 94 """ |
94 timer = Timer(delay) | 95 timer = Timer(delay) |
95 def cbwa(c, *args): | 96 |
96 c(*args) | |
97 def real_callback(c, t): | 97 def real_callback(c, t): |
98 t.stop() | 98 t.stop() |
99 c() | 99 c() |
100 | 100 |
101 timer.callback = cbwa(real_callback, callback, timer) | 101 timer.callback = cbwa(real_callback, callback, timer) |