Clickthrough overlay
Clickthrough overlay
Has anyone actually managed to create a clickthrough overlay yet?
Re: Clickthrough overlay
depends...
just a guess
just a guess
Code: Select all
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
Et cetera is my worst enemy
Re: Clickthrough overlay
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
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
Re: Clickthrough overlay
Using another window as overlay only works as long as your program is not a fullscreen game (DirectX, OpenGL, ...)k10k10 wrote:I am basically talking about something that you can use as a fullscreen overlay
For everything else you could use a maximized borderless window drawn with UpdateLayeredWindow (#WS_EX_LAYERED) and made click-through with #WS_EX_TRANSPARENT
Et cetera is my worst enemy
Re: Clickthrough overlay
Yeah, the game would obviously also run in a windowed mode.
Could you provide a little example?
(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)
Could you provide a little example?
Code: Select all
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
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)
Re: Clickthrough overlay
not reallyk10k10 wrote:Could you provide a little example?
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 soundsk10k10 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!
Et cetera is my worst enemy