I am new to SDL2, and I wonder if this is something possible to be done by code only?
I assume you’re refering to the background, which are switching from a grayscale image to a red/white image whenever the mouse pointer is inside the canvas. I guess you can accomplish this by using the SDL_SetTextureColorMod()
and change the red color channel on a texture, or perhaps blend between two different SDL_Texture
objects (one grayscale image and one color image), using the SDL_SetTextureAlphaMod()
function. There might be other better solutions but those are the one I can come up with at the moment. But it is certainly possible using SDL.
Sorry for the ambiguity.
I met the node(dot) connecting to other nodes (dots).
Welcome to the forum btw!
No worries. I realized I forgot to run the actual script. I tried to run it now and it should be possible to create such effect using a combination of the SDL_RenderDrawPoint()
/ SDL_RenderDrawPoints()
functions and SDL_RenderDrawLine()
/ SDL_RenderDrawLines()
functions, with the dots and lines connected to each other, where the first dot is connected to a line, which is then connected to the next dot, then to the next line etc.
It looks like each dot moves in a random direction/angle and as soon as a dot leaves the canvas, it respawns on a random position in the canvas and is then connected to the “swarm” again.
Thank you very much!
Let me know if you got any issues implementing the effect and I can try helping you out, and/or might be able to throw together a small test application containing it.