Transparent Background?

For questions about using Classic.

Post » Wed Oct 13, 2010 2:46 pm

Sorry to bother the good people of Scirra again ,I want to know if i can create an application or game similar to widgets,For instance like a round desktop clock but the background must be transparent.
B
22
S
3
G
6
Posts: 1,356
Reputation: 7,141

Post » Wed Oct 13, 2010 5:22 pm

No.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Wed Oct 13, 2010 8:07 pm

you could do it the way they did before accelerated desktop compositing.

That is:

-Window with no frame (no problem!)
-Drag window to move (events, no problem!)
-On move, capture background and composite within application (Uhm.. python? :s I'm sure desktop capturing has been discussed before in the forums.)

That said, capturing background isn't fast, so you shouldn't update each frame. This means that the captured background will not reflect changes until you move the window forcing an update.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Thu Oct 14, 2010 11:37 am

It's pretty simple from python, but it will require the ctypes library so you'll have to install python to get it to work.
Add a Window object to your cap and run this at the start of the layout:
[code:36plvr02]from ctypes import *
hwnd=Window.AppWindow
region=windll.gdi32.CreateEllipticRgn(0,0,640,480)
windll.user32.SetWindowRgn(hwnd,region,0)[/code:36plvr02]
B
79
S
24
G
54
Posts: 4,749
Reputation: 40,761

Post » Thu Oct 14, 2010 11:46 am

Thank you RojoHound,I do have python installed already,Will try out the code and see what happens.
B
22
S
3
G
6
Posts: 1,356
Reputation: 7,141

Post » Thu Oct 14, 2010 11:53 am

Works like a charm thanks rojohound.

B
22
S
3
G
6
Posts: 1,356
Reputation: 7,141

Post » Sat Oct 16, 2010 7:30 pm

do share :)
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sat Oct 16, 2010 9:31 pm

Since your asking so nicely sure ,Here's the cap.

[url:em5njitd]http://dl.dropbox.com/u/7658043/clock.cap[/url:em5njitd]
B
22
S
3
G
6
Posts: 1,356
Reputation: 7,141

Post » Mon Dec 06, 2010 7:02 am

[quote="R0J0hound":1jv5c9ha]It's pretty simple from python, but it will require the ctypes library so you'll have to install python to get it to work.
Add a Window object to your cap and run this at the start of the layout:
[code:1jv5c9ha]from ctypes import *
hwnd=Window.AppWindow
region=windll.gdi32.CreateEllipticRgn(0,0,640,480)
windll.user32.SetWindowRgn(hwnd,region,0)[/code:1jv5c9ha][/quote:1jv5c9ha]
Excelent ;)
thanks for info

just a question...if i want to make it back after to the 'normal' window form, how do I make?
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Mon Dec 06, 2010 6:51 pm

To be able to restore the window change the script to:
[code:297le7j1]from ctypes import *
hwnd=Window.AppWindow
region=windll.gdi32.CreateEllipticRgn(0,0,640,480)
oldRegion=windll.user32.SetWindowRgn(hwnd,region,0)[/code:297le7j1]
then later when you want to restore the window shape run this:
[code:297le7j1]windll.user32.SetWindowRgn(hwnd,oldRegion,0)[/code:297le7j1]
B
79
S
24
G
54
Posts: 4,749
Reputation: 40,761

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests