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

RE: [pygame] Game played over the desktop?



Your first issue would be that unless you used hardware acceleration,
running a Pygame app at the native desktop resolution may result in serious
slowdown. However, others on this list may know more than this than I do,
since controlling fps is an area in which I lack knowledge :)

However, I'm a wxPython nutball, so I know of a few things that may help
you... Basically, your original ideas are logically sound, but only the
second idea would be the most feasible.

There's a recipe on the wxPython wiki that demonstrates transparent windows
by changing the alpha value of the frame through win32api calls, but this
changes the alpha of everything in the frame, so that throw it out the
window (haha). http://wiki.wxpython.org/index.cgi/Transparent_Frames_on_MSW

The second method is exactly as you describe it. A quick search revealed
this small recipe:
http://mail.python.org/pipermail/python-list/2003-June/166806.html.

It basically screengrabs the current desktop and saves it as a bmp (although
I'm certain you could easily run it through PIL or whatever to convert it to
something less huge).

If you didn't want to use wxPython and remain with straight Pygame, you
could easily build a wx application that lived in the system tray (since a
wxPython main thread doesn't die if the app loads itself into the system
tray) whilst the game was running, and updated the dekstop bitmap every X
seconds/minutes/whatever (since you can't access wx functionality without
starting an application loop).

The only problem with the second method would be that a user would not be
able to use their desktop icons (as it's just a picture), unless you built a
procedure that recognised what an icon looked like and extracted their
positional information which could then handle icon events if and when a
user decides to try and use their desktop stuff.

Hope some of my waffling helps you with your ideas :)

~Chris

-----Original Message-----
From: owner-pygame-users@xxxxxxxx [mailto:owner-pygame-users@xxxxxxxx]On
Behalf Of Myles Grant
Sent: Tuesday, September 19, 2006 17:20
To: pygame-users@xxxxxxxx
Subject: [pygame] Game played over the desktop?


Pygame hackers,

I'm envisioning a game played on top of the user's screen/desktop/etc.  
As far as I can tell, there's two possible ways to do this:

1) Make the game fullscreen and set the background to be transparent.  
Not sure this is possible.

2) Take a screenshot before the game loads, and set that as the 
background -- fullscreen.  Is there a cross-platform way to do this?

Any other ideas?

Cheers,
Myles




CONFIDENTIAL NOTICE: This email including any attachments, contains 
confidential information belonging to the sender. It may also be 
privileged or otherwise protected by work product immunity or other 
legal rules. This information is intended only for the use of the 
individual or entity named above.  If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, 
distribution or the taking of any action in reliance on the contents 
of this emailed information is strictly prohibited.  If you have 
received this email in error, please immediately notify us by 
reply email of the error and then delete this email immediately.