SFML community forums

Help => General => Topic started by: Viruses on January 04, 2012, 10:45:29 pm

Title: SFML Special effects and stuff?
Post by: Viruses on January 04, 2012, 10:45:29 pm
Ok so as the title might suggest, and im no where near this i still want to know how you can do special effects with SFML. Is it advanced enough for like cool special effects? E.g. particle systems,explosions,etc.   And also, where does shaders come into play here?
Title: SFML Special effects and stuff?
Post by: Mario on January 05, 2012, 12:31:52 am
Check the documentation for sf::Shader (included in Graphics). Only thing missing right now (I think) are point clouds, making particles a bit harder to do (depending on how you'd like to do them).
Title: SFML Special effects and stuff?
Post by: Viruses on January 05, 2012, 04:25:02 pm
Wait isnt it supposed to be done in GLSL if opengl and this other for Directx? Why does SFML have a shader class..
Title: SFML Special effects and stuff?
Post by: Mario on January 05, 2012, 04:27:47 pm
It's a simple wrapper around GLSL functions. sf::Shader will load your vertex and pixel shaders (beginning with SFML 2.0) and allow you to apply them to other stuff being drawn. You don't have to hassle with OpenGL's shader objects, shader programs, etc.

Also keep in mind that SFML uses OpenGL on Windows too, so you can't use HLSL, only GLSL.
Title: SFML Special effects and stuff?
Post by: Viruses on January 05, 2012, 10:44:20 pm
Alright. I have a question about SFML coding. I have been using keypressed() function of sf::Keyboard. But i want to check for just a single
key press. So not if its pressed, but if it was pressed and released. How would i do that?
Title: SFML Special effects and stuff?
Post by: Tex Killer on January 06, 2012, 12:31:36 am
http://www.sfml-dev.org/tutorials/1.6/window-events.php

In SFML2, use PollEvent instead of GetEvent.
Title: SFML Special effects and stuff?
Post by: Nexus on January 06, 2012, 11:45:24 am
By the way, I have written a particle system and an event system for uniform event/input handling in my library, maybe they help you too (see signature).