I’m currently developping a game, initially coded with SDL 1.2. But lately, I felt the need to translate everything to SDL 2, and that’s what I did.
First, I’d like to congratulate the developpers for this incredible job, it is much more faster than SDL 1.2 and it really makes the game much more fun to play.
But I still have some questions:
In my game there are two worlds, the normal world, and the world of the deads. So of course, when you die, you are teleported into the world of the deads.
To make a difference between those two worlds, I decided that the world of the deads would be the same as the normal world, excepted that it is in black & white (Grayscale).
Until now, with SDL 1.2, in order to realize that effect, I had no choice but to copy every image of the decor twice in the RAM, and to modify them at the loading of the game, in order to draw them on screen when you’re dead, without doing any operations.
It’s not the best solution in my opinion, because it uses more ram, and it’s very static, I can’t add more effects, etc.
But I had already try operating every pixels of the screen each frame before refreshing the screen, and my CPU went crazy (It was really slow).
But… here I am with SDL 2, and I was wondering what is the best way to realize those effects ?
I know that It would probably be with shaders, but I prefer not to use them, because I don’t want to use OpenGL, and most of all, shaders can’t be used by everyone, and I want my game to be accessible (even if nowadays it’s pretty rare to have computers that don’t handle shaders).
I would like to know a way to do operations to every pixels of the screen (except for some images like HUD and stuff) each frame, but fasterer than before.
Because it is much more convinient than the other way, insofar as I can do more than one effect (grayscale for example), and I can animate the effect. Because currently, when you die, the decor becomes instantly gray. It would be nicer if it turned gray slowly, and with the current way to realize this effect, it’s not possible.
Moreover, I’d like to realise others effects in the same style. For instance, my game has a day/night system, and actually, it’s just a filter blended with alpha that does the effect. But it’s not beautiful, it would be really nice if the color could change during night, instead of being only darker.
I don’t know if you understood my point or what I’m trying to do, but I’d really appreciate if you could help me and show me a good way to do this: without using OpenGL, and a way faster enough not to turn my CPU crazy
I thank everyone in advance !