Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance Off
- CoordMode "Mouse", "Screen"
- CoordMode "ToolTip", "Screen"
- #R::Reload
- SetWinDelay 0
- guiW := 60
- guiH := 46
- MyGui := Gui(, "")
- MyGui.Opt("ToolWindow -Sysmenu +AlwaysOnTop")
- MyGui.SetFont "s36 w700"
- ;"ebad54"
- ; MyGui.BackColor := format("{1:x}", ((235 << 16) | (173 << 8) | 84) + ((random(-35,35) << 16) | (random(-30,30) << 8) | random(-20,20)))
- MyGui.BackColor := format("{1:x}", ((random(50,240) << 16) | (random(50,240) << 8) | random(50,240)))
- MyGui.Add("Text", "x" (guiW/2-21) " y" (guiH/2-44), ". .")
- MyGui.SetFont "cfff0ee s30", "Javanese Text"
- MyGui.Add("Text", "xp15 yp-1", "!")
- MyGui.SetFont "s16"
- MyGui.SetFont "c000000", "Courier New"
- MyGui.Add("Text", "w12 yp44", "^")
- WinSetStyle("-0xC00000", MyGui)
- OnMessage(0x201, WM_MouseDown)
- MyGui.Show("w" guiW " h" guiH " Center NoActivate")
- lastX := 0
- lastY := 0
- dx := 0
- dy := 0
- falling := false
- grabbed := false
- areaLeft := 0
- areaTop := 0
- areaRight := 0
- areaBottom := 0
- !P::ExitApp
- WM_MouseDown(wParam, lParam, msg, window) {
- global grabbed
- if (window != MyGui.Hwnd) {
- return
- }
- grabbed := true
- MouseGetPos &mouseX, &mouseY
- lastX := mouseX
- lastY := mouseY
- }
- ~LButton Up::MouseUp
- MouseUp() {
- global grabbed
- global dx
- global dy
- speedFactor := 0.2
- if grabbed {
- grabbed := false
- fall(dx*speedFactor, dy*speedFactor)
- }
- }
- velx := 0.0
- posx := 0.0
- accy := 0.1
- vely := 0.0
- posy := 0.0
- fall(xinit := 0, yinit := 0) {
- global velx
- global posx
- global vely
- global accy
- global posy
- global dx
- global dy
- global falling
- velX := xinit
- velY := yinit
- fric := 1
- bounce := 1
- falling := true
- WinGetPos &startX, &startY,,, MyGui
- posY := startY
- posX := startX
- MonitorGetWorkArea , &areaLeft, &areaTop, &areaRight, &areaBottom
- while (abs(velY) > 0.5 or (areaBottom - abs(posY+guiH) > 2)) {
- Sleep 1
- velY += accY
- posY += velY
- posX += velX
- WinGetPos &winx, &winy,,, MyGui
- if (posY+guiH > areaBottom) {
- ; WinMove winx, areaBottom-guiH,,, MyGui
- posY := areaBottom-guiH
- velY := -bounce*abs(velY)
- velX *= fric
- } else if (posY < areaTop) {
- ; WinMove winx, areaTop,,, MyGui
- posY := areaTop
- velY := bounce*abs(velY)
- velX *= fric
- }
- if (winX+guiW > areaRight) {
- ; WinMove areaRight-guiW, posY,,, MyGui
- posX := areaRight-guiW
- velX := -bounce*abs(velX)
- velY *= fric
- } else if (posX < areaLeft) {
- ; WinMove areaLeft, posY,,, MyGui
- posX := areaLeft
- velX := bounce*abs(velX)
- velY *= fric
- }
- WinMove posX, posY,,, MyGui
- if grabbed {
- break
- }
- }
- WinGetPos &endposX,,,, MyGui
- if (!grabbed) {
- WinMove endposX, areaBottom-guiH,,, MyGui
- }
- velY := 0
- posY := 0
- velX := 0
- posX := 0
- SetTimer () => falling := false, -5
- }
- fall(0, -3)
- while true {
- global dx
- global dy
- global lastX
- global lastY
- global grabbed
- WinGetPos &winx, &winy,,, MyGui
- MouseGetPos &x, &y
- dx := x-lastX
- dy := y-lastY
- lastX := x
- lastY := y
- if (!falling && grabbed) {
- WinMove winx+dx, winy+dy,,, MyGui
- }
- sleep 1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement