Jump to content

PONG SANTA


peter1234
 Share

Recommended Posts

I was curious about how to move transparent background regions so I wrote this test script. Attachments need to be in same folder as script when it is executed. Push ESC key to terminate. Merry Christmas.

;**********************************************************************************************
;   PONG SANTA - moving transparent region (all of the real code is from posts by Larry)
;**********************************************************************************************
#include <GUIConstants.au3>
HotKeySet("{ESC}", "Terminate")

Func Terminate()
    GUIDelete ( $gui )
    Exit 
EndFunc

Func SetWindowRgn($h_win, $rgn)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFunc

$X_start = 50
$Y_start = 100

$gui = GUICreate("",350,120,$X_start,$Y_start,$WS_POPUP)  
GUICtrlCreatePic(".\Santa.bmp",0,0,350,120 )   
$a = DLLCall(".\BMP2RGN.dll","int","BMP2RGN", _
            "str",".\Santa.bmp", _              
            "int",255, _
            "int",255, _
            "int",255)  
SetWindowRgn($gui, $a[0])
GUISetState(@SW_SHOW,$gui ) 
$sx=1
$x=$X_start
$sy=1
$y=$Y_start

while 1
    If $x > (@DesktopWidth-350) then $sx = -($sx) 
    If $x < 0 then $sx = -($sx) 
    $x = $x + ($sx*4)
    If $y > (@Desktopheight-120) then $sy = -($sy) 
    If $y < 0 then $sy = -($sy) 
    $y = $y + ($sy*4)
    WinMove ( $gui, "", $x, $y )
    Sleep(20)
wend

Santa.bmp

BMP2RGN.dll

Edited by peter1234
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...