On my Linux machines, with the new Pyglet1.0, I can't import
pyglet.clock because the code ends up taking a Mac branch and so fails
to find a file '/usr/lib/libc.dylib'. So I added 4 lines to the if
at
about line 165 to handle the Linux case.
If preferred, I can file an official bug report and supply the fix as
a patch.
Gary Herron
if sys.platform in ('win32', 'cygwin'):
# Win32 Sleep function is only 10-millisecond resolution, so
instead
# use a waitable timer object, which has up to 100-nanosecond
resolution
# (hardware and implementation dependent, of course).
_kernel32 = ctypes.windll.kernel32
class _ClockBase(object):
def __init__(self):
self._timer =
_kernel32.CreateWaitableTimerA(ctypes.c_void_p(),
True, ctypes.c_void_p())
def sleep(self, microseconds):
delay = ctypes.c_longlong(int(-microseconds * 10))
_kernel32.SetWaitableTimer(self._timer,
ctypes.byref(delay),
0, ctypes.c_void_p(), ctypes.c_void_p(), False)
_kernel32.WaitForSingleObject(self._timer, 0xffffffff)
elif sys.platform == 'linux2': # <<<<<<<<<<<<<<<<<<<<< Add
these 4 lines
class _ClockBase(object):
def sleep(self, microseconds):
time.sleep(float(microseconds)/1000000.0)
else:
_c = pyglet.lib.load_library('c', darwin='/usr/lib/libc.dylib')
_c.usleep.argtypes = [ctypes.c_ulong]
class _ClockBase(object):
def sleep(self, microseconds):
_c.usleep(int(microseconds))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---