From: Pete S. <pe...@vi...> - 2000-09-11 17:45:52
|
> I'm having some small problems with PySDL, but I'm not sure this is the > correct forum. The regular discussion forums at SourceForge seemed a bit > quiet, so I decided to try this instead. > > Ok, here goes. > > How do I get a proper list of all accepted video modes using PySDL? I just > want to verify that a specific mode can be used with a certain depth. I > tried the following code to get some info: this is the best place to come for pysdl help and info. (unless i'm seriously missing out on something :] ) sdl.video_list_modes(...) will return 0 if the call to SDL_ListModes(...) returns NULL. my guess is that the "C" version takes an entire PixelFormat structure, which is more information that just bpp. because pysdl video_list_modes is not setting the rest of the PixelFormat structure, SDL is returning no results. ugh, this is one of my beefs with current pysdl, the "C" versions of the functions are usually a lot more flexible (taking NULL pointers for default/best argument in many cases, it would be great if pysdl could take "None" as a substitute. owell, it will likely happen one day) well jan, i'm guessing you're one of the first person even using the video_list_modes. the good news is that SDL does a really good job of emulating any requested video modes you ask for (ie, setting a slightly larger resolution and just using a black border to make up the difference. also handling bpp differences for you automatically.) unlike using directx or related libraries, with SDL you can just request any mode and SDL will likely do it, adjusting what it needs to automatic, but keeping everything on the programmer end exactly what you wanted. at this point, i'm not sure what's up with Mark Baker (the pysdl maintainer) it's been awhile since i've gotten anything back from him. if SDL 1.1.5 comes out with no word from Mark i'm going to take a stab at updating the pysdl source with all the new features. (i'll probably look deeper into this routine for you also) for now, i'd just hardcode a small list of screen modes for your app. just pick the standards, and assume you won't have any problems. (likely, you wont) def fake_list_modes(bpp, flags): "substitute this until sdl.video_list_modes is working, sorry" return [(0, 0, 640, 680), (0, 0, 600, 800), (0, 0, 1024, 768)] |