It is currently Tue Aug 21, 2018 10:34 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Clickthrough overlay
PostPosted: Sat Apr 28, 2018 4:28 pm 
Offline
New User
New User

Joined: Sat Apr 28, 2018 4:23 pm
Posts: 3
Has anyone actually managed to create a clickthrough overlay yet?


Top
 Profile  
Reply with quote  
 Post subject: Re: Clickthrough overlay
PostPosted: Sat Apr 28, 2018 4:44 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat May 05, 2007 5:31 pm
Posts: 472
Location: Linz, Austria
depends...

just a guess
Code:
OpenWindow(0, 0, 0, 320, 200, "", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
TextGadget(0, 10, 10, 300, 30, "depends...")

SetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE, GetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE)|#WS_EX_LAYERED|#WS_EX_TRANSPARENT)
SetLayeredWindowAttributes_(WindowID(0), 0, 150, #LWA_ALPHA)

StickyWindow(0, 1)

While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend


Top
 Profile  
Reply with quote  
 Post subject: Re: Clickthrough overlay
PostPosted: Sat Apr 28, 2018 5:08 pm 
Offline
New User
New User

Joined: Sat Apr 28, 2018 4:23 pm
Posts: 3
kinda like this, except that you should be able to use the drawing functions in an efficient way (like in a screen)
and you can still see the window borders (& it is not fully transparent),

I am basically talking about something that you can use as a fullscreen overlay


Top
 Profile  
Reply with quote  
 Post subject: Re: Clickthrough overlay
PostPosted: Sat Apr 28, 2018 7:33 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat May 05, 2007 5:31 pm
Posts: 472
Location: Linz, Austria
k10k10 wrote:
I am basically talking about something that you can use as a fullscreen overlay
Using another window as overlay only works as long as your program is not a fullscreen game (DirectX, OpenGL, ...)
For everything else you could use a maximized borderless window drawn with UpdateLayeredWindow (#WS_EX_LAYERED) and made click-through with #WS_EX_TRANSPARENT


Top
 Profile  
Reply with quote  
 Post subject: Re: Clickthrough overlay
PostPosted: Sat Apr 28, 2018 9:17 pm 
Offline
New User
New User

Joined: Sat Apr 28, 2018 4:23 pm
Posts: 3
Yeah, the game would obviously also run in a windowed mode.
Could you provide a little example?

Code:
InitSprite()
OpenWindow(0, 10, 10, 200, 200, "", #PB_Window_SystemMenu|#PB_Window_ScreenCentered | #PB_Window_BorderLess | #PB_Window_Tool)
OpenWindowedScreen(WindowID(0), 0, 0, 200, 200)

SetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE, GetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE)|#WS_EX_LAYERED|#WS_EX_TRANSPARENT)
SetLayeredWindowAttributes_(WindowID(0), 0, 55, #LWA_ALPHA)

StickyWindow(0, 1)

While WaitWindowEvent() <> #PB_Event_CloseWindow
  StartDrawing(WindowOutput(0))
    Circle(100, 100, 5, RGB(0, 255, 0))
  StopDrawing()
Wend


(didnt maximize it yet, but thats easy)

The main problem I would have with this code is, that I can not make the window itself fully transparent, without also making the things drawn on it transparent!

(Also on win10 borderless doesnt work the same way it did on win7 and when making the window fully transparent, it is not sticky on top anymore)


Top
 Profile  
Reply with quote  
 Post subject: Re: Clickthrough overlay
PostPosted: Sat Apr 28, 2018 10:05 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat May 05, 2007 5:31 pm
Posts: 472
Location: Linz, Austria
k10k10 wrote:
Could you provide a little example?
not really

k10k10 wrote:
The main problem I would have with this code is, that I can not make the window itself fully transparent, without also making the things drawn on it transparent!
UpdateLayeredWindow wont work with PB's sprite engine. You have to create a 32bit image (rgba(0,0,0,0)) and draw on it (needs premultiplied alpha) and send it to UpdateLayeredWindow to render the window... Not as simple to code as it sounds ;)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye