Help with my game - "desktop destructor"

For questions about using Classic.

Post » Thu Feb 04, 2010 9:16 pm

I'm creating game "Desktop Destructor". You can destroy your desktop with a many different weapons and tools... I have one imported screen of my desktop, but I don't know how to create screenshot of another desktop in a game.

Is it a way to create screenshot of another users screen, when game is starting?
B
1
G
2
Posts: 1
Reputation: 627

Post » Sat Feb 06, 2010 2:52 am

This question doesn't make any sense, which is probably why it is not being answered. Who is the other user and what screen do they have??

You could take a screenshot using Python and the "gtk.gdk" library.
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Sat Feb 06, 2010 3:08 am

It makes sense. He wants to take a screenshot of the player's desktop.

There's no way to do so with events that I'm aware of. If you can do it with Python then that's cool.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Feb 06, 2010 8:06 pm

[quote="scidave":29wtdxw9]You could take a screenshot using Python and the "gtk.gdk" library.[/quote:29wtdxw9]
Whoa. Thanks for that!
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun Feb 07, 2010 8:44 pm

oops.. sorry. After Deadeye posted, your question makes a lot of sense. The big problem I see is that you want the user to destroy the desktop and I am assuming this is the desktop as Windows first boots. He/she might have several windows open which even if you automated a screenshot using Python or something else you wouldn't get the "real" desktop.

One way to do it, arguably somewhat ghetto, is to have the player take the screenshot. You could flush the clipboard using the System action at the start of the layout, pop up a message box asking for the user to "goto the desktop" and take a screenshot, then save the image using the Image Manipulator. Then just use a while loop to confirm they actually saved it...before starting game.

Here is an example: http://www.box.net/shared/pi0gbddbdc

You could also do this with the PyQt4 module. Unfortunately, I can't get Construct to place nice with this even though it works flawlessly outside. You have to download the PyQt4 binary installer, Sip and MinGW to run this.

[code:3fk2egjr]
import sys
from PyQt4.QtGui import QPixmap, QApplication
app = QApplication(sys.argv)
QPixmap.grabWindow(QApplication.desktop().winId()).save('game.png', 'png')[/code:3fk2egjr]

Cheers!
B
8
S
3
G
7
Posts: 835
Reputation: 5,313


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests