Those who are following me on
GitHub might have already noticed my
Examples repository, for all the others (and the first ones too of course), I'm making this forum post.
Every now and then I help out some people or goof around with some ideas or code pieces and sometimes I end up with a small example that kind of looks cool, but I don't really have a purpose for it. So instead of just letting it rot somewhere on my harddisk, I thought it could be a inspiring thing to upload them to GitHub. But just reading code mostly isn't that interesting/inspiring thus I'll share here also some screenshots.
All the examples related to SFML can be found in the
SFML directory. Keep in mind that the code is provided as-is and isn't always suited for final products, since I didn't spend much time thinking about performance or nice code design decisions.
Fading DotsThis was originally created as a test for
this thread (or was it
this one?), but since I kind of liked the result I adjusted a few things and uploaded it.
FlashlightOut of nowhere came suddenly all those requests (starting with
this one) for subjective blending and I think, I could help a few people with my example on how to achieve what they wanted.
Hue ShiftAlthough I can't find the original SFML thread about this, I found the
StackOverflow question which was iirc created before the forum thread. This effect can definitely give a nice ambiance, but it probably could need some retouching.
Since the picture do not tell much: Starting off with one color the example automatically iterates through the whole RGB color spectrum in a smooth way.
LightningI had once read a tutorial in connection with SFML on how to create some nice 'laser' effect. Unfortunatly I don't remember which blog/site this was on, because he was using some texture moving which made everything look even better. While doing a search to possible find that tutorial again, I found another similar piece of code
on the forum, adapted it for SFML 2 and made a nicer class out of it.
RoadI'm not sure if there ever existed a forum post or if the whole conversation happend on IRC, but someone wanted to make a 'scrolling' road and since I really liked that idea, I went ahead and implemented an example. The code here is particularly not that nice, so keep that in mind when adapting it.
Simple AABBEvery month there's at least one question on simple collision detection testing the last 'bigger' one with in
this forum thread, which lead to this example. I've even implemented some
very simple physics, which will fail in most situations, but you can at least move around and jump.
Mixing SoundBuffersThe other day in #learnprogramming on freenode someone was trying to implement a way to mix two audio files without actually playing them back. I wondered how something like that would work with SFML and thus went ahead an wrote a small example. A quick Google search on audio sample mixing brought me to
this site and lead me to the current implementation.
Everything is under the zlib/png license and you can use it and reference it in whatever way you want.