AddSpriteShader()
Syntax
AddSpriteShader(#Sprite, Shader [, Dynamic])Description
Adds a realtime shader to the specified sprite. If the same shader is already set for this sprite, it will replaced. Any number of shaders can be stacked on the sprite. The shader effect can be controlled by SpriteShaderAttribute().
Parameters
#Sprite The sprite use. Shader The shader to apply. It can be one of the following value: #PB_Shader_Blur : Add a blur effect to the sprite. #PB_Shader_Noise : Add a noise effect to the sprite. #PB_Shader_Pixelate : Add a pixelate effect to the sprite. #PB_Shader_Bevel : Add a bevel effect to the sprite (lighter/darker edges). #PB_Shader_BulgePinch: Add a bulge or pinch effect to the sprite. #PB_Shader_Adjustment: Allow to adjust color components like red, green, blue channels, alpha value and more.Dynamic (optional) Sets to #True if each sprite display (with DisplaySprite() or DisplayTransparentSprite()) needs to have its own shader attributes. If not specified, value is #False.
Return value
None.
Example
OpenScreen(800, 600, 32, "Shader Test") SetFrameRate(60) Procedure RenderFrame() Static x = -100 ClearScreen(RGB(0, 0, 0)) DisplaySprite(0, x, 100) If x > 800 : x = -100 : Else : x+1 : EndIf FlipBuffers() ; continue the rendering EndProcedure Procedure Loading(Type, Filename$) Static NbLoadedElements NbLoadedElements+1 If NbLoadedElements = 1 ; Finished the loading of all images and sounds, we can start the applications AddSpriteShader(0, #PB_Shader_Blur) FlipBuffers() ; start the rendering EndIf EndProcedure Procedure LoadingError(Type, Filename$) Debug Filename$ + ": loading error" EndProcedure ; Register the loading event before calling any resource load command BindEvent(#PB_Event_Loading, @Loading()) BindEvent(#PB_Event_LoadingError, @LoadingError()) BindEvent(#PB_Event_RenderFrame, @RenderFrame()) LoadSprite(0, "Data/Geebee.png")
See Also
RemoveSpriteShader(), SpriteShaderAttribute()
Supported OS
All