>From what I understand, its more or less like that, though I tend to
sub-class the window and use it as a root class for the program to pass
relevant data to other classes as needed, or for things like drawing a
cursor, etc. Example:
import pyglet
from pyglet.window import mouse
class Test(pyglet.window.Window):
def __init__(self):
super(Test, self).__init__(640, 480, resizable=False, fullscreen=
False, caption="Test")
self.set_exclusive_mouse(True)
self.clear()
#mouse cursor position
self.mouse = [0,0]
self.cursor = pyglet.image.load('cursor.png').get_texture()
pyglet.clock.get_fps()
self.fps_display = pyglet.clock.ClockDisplay()
pyglet.clock.schedule_interval(self.update, .01)
def update(self,dt):
self.draw()
def draw(self):
self.clear()
self.cursor.blit(self.mouse[0],self.mouse[1])
self.fps_display.draw()
def on_mouse_motion(self,x,y,dx,dy):
self.mouse[0] += dx
self.mouse[1] += dy
def on_mouse_drag(self,x,y,dx,dy,buttons,modifiers):
self.mouse[0] += dx
self.mouse[1] += dy
if __name__ == '__main__':
window = Test()
pyglet.app.run()
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.