sync pyglet
This commit is contained in:
parent
10b89a1919
commit
98106ccd08
@ -681,6 +681,21 @@ class BaseWindow(with_metaclass(_WindowMetaclass, EventDispatcher)):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError('abstract')
|
raise NotImplementedError('abstract')
|
||||||
|
|
||||||
|
def draw(self, dt: float):
|
||||||
|
"""Redraw the Window contents.
|
||||||
|
|
||||||
|
This method will first call the :py:meth:`~pyglet.window.Window.`switch_to`
|
||||||
|
method to make the GL context current. It then dispatches the
|
||||||
|
:py:meth:`~pyglet.window.Window.on_draw` and
|
||||||
|
:py:meth:`~pyglet.window.Window.on_refresh`
|
||||||
|
events. Finally, it calls the :py:meth:`~pyglet.window.Window.flip`
|
||||||
|
method to swap the front and back OpenGL buffers.
|
||||||
|
"""
|
||||||
|
self.switch_to()
|
||||||
|
self.dispatch_event('on_draw')
|
||||||
|
self.dispatch_event('on_refresh', dt)
|
||||||
|
self.flip()
|
||||||
|
|
||||||
def draw_mouse_cursor(self):
|
def draw_mouse_cursor(self):
|
||||||
"""Draw the custom mouse cursor.
|
"""Draw the custom mouse cursor.
|
||||||
|
|
||||||
@ -1411,15 +1426,13 @@ class BaseWindow(with_metaclass(_WindowMetaclass, EventDispatcher)):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def on_draw(self):
|
def on_draw(self):
|
||||||
"""The window contents must be redrawn.
|
"""The window contents should be redrawn.
|
||||||
|
|
||||||
The `EventLoop` will dispatch this event when the window
|
The `EventLoop` will dispatch this event when the `draw`
|
||||||
should be redrawn. This will happen during idle time after
|
method has been called. The window will already have the
|
||||||
any window events and after any scheduled functions were called.
|
GL context, so there is no need to call `switch_to`. The window's
|
||||||
|
`flip` method will be called immediately after this event,
|
||||||
The window will already have the GL context, so there is no
|
so your event handler should not.
|
||||||
need to call `switch_to`. The window's `flip` method will
|
|
||||||
be called after this event, so your event handler should not.
|
|
||||||
|
|
||||||
You should make no assumptions about the window contents when
|
You should make no assumptions about the window contents when
|
||||||
this event is triggered; a resize or expose event may have
|
this event is triggered; a resize or expose event may have
|
||||||
@ -1601,11 +1614,11 @@ class BaseWindow(with_metaclass(_WindowMetaclass, EventDispatcher)):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def on_mouse_leave(self, x, y):
|
def on_mouse_leave(self, x, y):
|
||||||
"""The mouse was moved outside of the window.
|
"""The mouse was moved outside the window.
|
||||||
|
|
||||||
This event will not be triggered if the mouse is currently being
|
This event will not be triggered if the mouse is currently being
|
||||||
dragged. Note that the coordinates of the mouse pointer will be
|
dragged. Note that the coordinates of the mouse pointer will be
|
||||||
outside of the window rectangle.
|
outside the window rectangle.
|
||||||
|
|
||||||
:Parameters:
|
:Parameters:
|
||||||
`x` : int
|
`x` : int
|
||||||
@ -1632,14 +1645,13 @@ class BaseWindow(with_metaclass(_WindowMetaclass, EventDispatcher)):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def on_refresh(self, dt):
|
def on_refresh(self, dt):
|
||||||
"""The window contents must be redrawn.
|
"""The window contents should be redrawn.
|
||||||
|
|
||||||
The `EventLoop` will dispatch this event when the window
|
The `EventLoop` will dispatch this event when the `draw`
|
||||||
should be redrawn.
|
method has been called. The window will already have the
|
||||||
|
GL context, so there is no need to call `switch_to`. The window's
|
||||||
The window will already have the GL context, so there is no
|
`flip` method will be called immediately after this event, so your
|
||||||
need to call `switch_to`. The window's `flip` method will
|
event handler should not.
|
||||||
be called after this event, so your event handler should not.
|
|
||||||
|
|
||||||
You should make no assumptions about the window contents when
|
You should make no assumptions about the window contents when
|
||||||
this event is triggered; a resize or expose event may have
|
this event is triggered; a resize or expose event may have
|
||||||
|
Loading…
Reference in New Issue
Block a user