Unclear Documentation.
rickierich

Sprite.alwaysDraw (toggle)


Force a sprite to get drawn every frame, disabling potential optimizations. This does not happen by default, i.e. drawing optimizations are enabled by default.

boolean toggle (optional): Whether to draw the sprite every frame. If omitted or undefined, this parameter is assumed to be true.

 

This is really unclear what your trying to say in the first line.

1 Comment
Gio

Thanks for the feedback, I'll try to change it to something that's a bit less confusing.

Anyway here's what that means: by default Wade does not draw all your sprites every frame. It doesn't draw things that are not in the screen area, and generally it does not draw things that do not need to be re-drawn, for example if there is an area of the screen that has not changed it won't redraw it the next frame.

This is to ensure that things run fast even when you have lots of sprites, or sprites with complex draw functions and shaders.

However you can disable this optimization at any time, for individual sprites, by calling Sprite.alwaysDraw()

There are some valid reasons for doing it. Especially in situations where Wade cannot know that your sprite has changed, for example because a shader parameter is time-sensitive, so the appearance of your sprite changes over time because of some custom shader code. In that case, you want to tell Wade "disable any optimizations for this sprite, just draw it every frame", so that's what alwaysDraw does.

Post a reply
Add Attachment
Submit Reply
Login to Reply