SFML community forums
Help => Graphics => Topic started by: starkhorn on April 13, 2016, 07:24:24 am
-
I need some guidance on how to go about achieving the below outcome as I am at a bit of a loss on how to go about it. I am not looking for code but any pseudo-code or a general outline of the steps involved would be much appreciated.
So I can detect when my sprite is selected. What I want to do is to highlight the outline of the sprite with a specific colour which indicates that it is selected.
Also rather than having this just a static colour, is there is way to make the outline appear as shiny? Would this just involve changing the colour very quickly?
I know the above is vague but I am still new to sfml and graphics programming and I feel like I hit a bit of a wall with this one.
-
A simple way would be to just have two images. One with the normal sprite and one with a highlight, then just draw the right one dependin on whether or not it is selected.
Another option would be to use a shader.
-
You would probably want an outline shader. I have never done ot, but I'm sure Google can find you a GLSL shader for that.
-
Hi Folks,
Yeah ok doing a 2nd image with the outline is fairly straight-forward. However that is just a static image. How can I make that outline image appearing like it is flashing?
-
You could animate it manually with multiple images etc.
Or again, a shader can do it. ;)
-
For coloured outlines, you could replace your sf::Sprite with textured sf::RectangleShape (they can have customised but single-colour outlines).
Since this outline can be coloured separately, it's simple to animate it separately without affecting the actual texture.