[…]
Unfortunately, I can't use OpenGL in my game for various
reasons. One of them is that I don’t know OpenGL good enough yet
(what a shame! ). It’s not hard to learn it, I suppose, but my
time is very limited, and I can’t rebuild whole project. So, I
think I must stay with pure 2D SDL.
Well, you can avoid that problem by using glSDL (the wrapper or
preferably the just released backend patch) - but if you rely on it
for playable performance (rather than just using it for some extra
speed where OpenGL is available), you still have the OpenGL
requirement problem. You can snap it in and give it a try, but I
suspect that it’s more important to get the best out of the other
backends first, since OpenGL is not available on every machine.
[…]
Sure, I can tell artist to do that, but poor guy has too much
work last time :) You said something about the filter, what did
you mean?
Something that scans the alpha channel pixel by pixel, setting nearly
transparent pixels to transparent and setting nearly opaque pixels to
opaque. You can also add some scaling and offset, to get an “alpha
contrast” filter.
Are there any small examples how to achieve that
result? (Though, if you don’t have a time for writing examples, I
think I’ll go with your second suggestion.)
There is code for that, and some other filters, in Kobo Deluxe. That’s
very far from a small example, though!
I’ve optimized and cleaned up some things since the last release, but
I just don’t have time to finish it. (The radar screen is broken -
but at least the rest should work with double buffered page flipping
OpenGL displays now… And there are some new sounds, bug fixes and
stuff.) I guess I should release it as is for now.
[…]
To get the best of both worlds, you can ask for a double buffered
hardware surface, and if you get one (not always possible; check
after init)
Sure, I do this after SDL_SetVideoMode:
"if (0 == screen->flags & SDL_HWSURFACE)"
It always worked good, but I want to be sure: is this a
correct way to check that?
Well, you can leave out the “0 ==” part, since if() takes any non-zero
value as “true”…
Note that when checking for the true condition, it’s recommended to do
it like this:
if((screen->flags & SDL_SOMEFLAG) == SDL_SOMEFLAG)
…
This is because a #define (or enum) like that could be a set of bits
and not just one bit. (I usually avoid that when I design APIs,
though. Using bit flags is messy enough as it is. )
…set up a third software surface for rendering.
Looks like kinda tripple buffering, doesn't it?
Almost, but since the extra buffer is different from the page flipping
pair, I prefer to refer to it as “semitripple buffering”, to
distinguish it from “normal” tripple buffering, which uses three
actual hardware pages to cut the application and/or rendering
hardware some extra slack.
//David Olofson - Programmer, Composer, Open Source Advocate
.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
— http://olofson.net — http://www.reologica.se —On Monday 27 December 2004 09.51, Flashback wrote: