-
Notifications
You must be signed in to change notification settings - Fork 1
genericSprite
genericSprite
is a abstraction class of pyglet.sprite.Sprite that adds additional functionality on top. All iriginal functionality is still there, just some helpers along the way.
- texture - Anything supported by ImageObject will work.
- parent - Not used as of now
- moveable - Currently not in use
- *args / **kwargs - Are passed to
pyglet.sprite.Sprite
filtered by what is defined in the docs
Resizes the object using scale for itself and resizes fonts etc accordingly inside.
- width - the new width in pixels
- height - the new height in pixels
Called before each render-frame
Called just before each render()
call.
When the sprite contains no renderable content, this function replaces render()
.
This is so that we can preserve the behavior of the sprite (rotate, move, collisions etc, without having to render it)
Rotates the sprite additional deg
from the current rotation.
By default, adjust_anchor
tells the sprite to rotate from the center and adjust the anchor to the new position as well. TODO: This breaks mouse_inside
because it will have a offset on sprite.x
and sprite.y
to take into account.
Move the sprite a certain amount of pixels from the current position.
(Note: not absolute positioning, it's relative from the current x,y
)
- dx - Amount of pixels to move in the X direction, from the current position..
- dy - Amount of pixels to move in the Y direction, from the current position.
When mouse_inside()
triggers True
, this function is called whenever the mouse is moved over the object, and tells which position (absolute to the window's cordinates) the mouse is currently.
- x - Mouse absolute X position in the window.
- y - Mouse absolute Y position in the window.
When the mouse leaves the object (mouse_inside()
no longer triggers True
), this function is called.
- x - Mouse absolute X position in the window.
- y - Mouse absolute Y position in the window.
This function is called every time the mouse moves, the window
will iterate over every active sprite, and call the mouse_inside()
to determinate if we're over a object.
- x - Mouse absolute X position in the window.
- y - Mouse absolute Y position in the window.
- mouse_button - Which mouse button was pressed (if it's pressed)
Called every render-sequence, usually just do self.draw()
but can be overridden to do more.