[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] pygame fullscreen help and joystick hat issue



Hello!

I've been using pygame for a very long time in an settop emulator frontend I've written.  It works great, but there's one thing I haven't been able to do well and I'm looking for ideas on how I might be able to improve it.  The pygame program runs in fullscreen and launches *other* fullscreen programs.  I've tried many different techniques (different python calls, flags, etc) for launching to have everything work cleanly and each thing I've tried has issues. 

What I'm doing now is before launching I set my pygame program to go back to windowed mode before launching the fullscreen program.  This works but is clunky in that it sometimes causes issues with Windows window focus, timing, etc.  The program also supports pre launching a program before the emulator (and is done async).  This is mostly for joystick/keyboard mapping.

Is anyone else doing stuff like this, and if so how are you doing it?  I use a frontend on my MAME cabinet called AdvanceMenu which is C++ and uses SDL and it works perfectly and just calls system().
Any ideas to try would be greatly appreciated.

If it helps, I've put my program here, relevant code starts @ line 1483:

https://www.dropbox.com/s/wq2t2rl6irmbysn/frontend.py?dl=0

Unrelated, there's a specific pygame method, joy.get_hat(), which seems to have an enabled debug print (it also could be compiled into the SDL library itself).  I tried using a trick I found online to suppress it by mucking with the file descriptors, but it didn't seem to help.

Here's a screenshot of it

https://www.dropbox.com/s/dpf0sbydol7fvc5/sdlhat.jpg?dl=0

One of the prints is mine (the one with "DEBUG:"), but the other is from SDL/pygame.  It's not a huge deal, but calling that in the event loop causes that to show up a LOT and could be a potential performance thing.

~brian
-- 
.-------------------------------------------------------.
| Brian Sturk ------- http://www.briansturk.com  ------ | .>   )\,^a__
|-------------------------.  _______ Ethical Hacker ___ |(  _ _)/ /-."~
| --- C/C++/Python/ASM     `----------------------------| `( )_ )/
| Linux/BSD/OSX/Windows embedded/system programming --- |_<_s_<_s
`-------------------------------------------------------'