Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CoordMode "Mouse", "Screen"
- CoordMode "ToolTip", "Screen"
- #R::Reload
- SetWinDelay 0
- MyGui := Gui(, "")
- MyGui.Opt("ToolWindow -Sysmenu +AlwaysOnTop")
- MyGui.SetFont "s36 w700"
- MyGui.BackColor := "dddddd"
- MyGui.Add("Text", "x4 y-24", ".!.")
- MyGui.SetFont "s16 w400"
- MyGui.Add("Text", "w12 xp+16 yp+41", "^")
- WinSetStyle("0x800000", MyGui)
- MyGui.Show("w50 h40 Center NoActivate")
- OnMessage(0x201, WM_MouseDown)
- ; OnMessage(0x202, WM_MouseUp)
- lastX := 0
- lastY := 0
- dx := 0
- dy := 0
- falling := false
- grabbed := false
- enableMove := true
- 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
- if grabbed {
- grabbed := false
- fall
- }
- }
- acc := 1.0
- vel := 0.0
- pos := 0.0
- fall() {
- global vel
- global acc
- global pos
- global falling
- offset := 82
- falling := true
- WinGetPos ,&startPos,,, MyGui
- pos := startPos
- while (abs(vel) > 0.5 or (A_ScreenHeight - abs(pos+offset) > 2)) {
- if grabbed {
- break
- }
- Sleep 1
- vel += acc
- pos += vel
- WinGetPos &xpos,,,, MyGui
- if (pos+offset > A_ScreenHeight) {
- WinMove xpos, A_ScreenHeight-offset,,, MyGui
- vel := -0.8*abs(vel)
- } else
- WinMove xpos, pos,,, MyGui
- }
- WinGetPos &endpos,,,, MyGui
- if (!grabbed) {
- WinMove endPos, A_ScreenHeight-offset,,, MyGui
- }
- vel := 0
- pos := 0
- SetTimer () => falling := false, -50
- }
- sleep 100
- fall()
- 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 && enableMove) {
- WinMove winx+dx, winy+dy,,, MyGui
- }
- sleep 0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement