diff --git a/main.hsp b/main.hsp index c66a9b3..ce8c725 100644 --- a/main.hsp +++ b/main.hsp @@ -7,8 +7,8 @@ #const NIZIKA_WIDTH 300 #const NIZIKA_HEIGHT 300 -#const NIZIKA_BASE 240 -#const NIZIKA_LEFT 60 +#const NIZIKA_BASE 236 +#const NIZIKA_LEFT 100 #const NIZIKA_RIGHT 250 @@ -17,6 +17,8 @@ SetWindowLong hWnd, GWL_EXSTYLE, GetWindowLong (hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED SetLayeredWindowAttributes hWnd, RGBCOLOUR_LIME, False, True + HWND_DESKTOP = GetDesktopWindow () ; デスクトップ取得 + Color COLOUR_LIME BoxF @@ -34,8 +36,38 @@ moving = False falling = True + base = gInfo_dispY Repeat + Dim hWindows, 1 + Dim windowRects, 4, 1 + + hWindows.0 = GetTopWindow (HWND_DESKTOP) + hWindowBefore = hWindows.0 + GetWindowRect hWindows.0, VarPtr (windowRects.0.0) + + windowCnt = 1 + + Repeat + hWindow = GetWindow (hWindowBefore, GW_HWNDNEXT) + + If hWindow = 0 { + Break + } + + buf = "" + GetWindowText hWindow, VarPtr (buf), 256 + + If (IsWindowVisible (hWindow) != False) And (StrLen (buf) != 0) { + hWindows.windowCnt = hWindow + GetWindowRect hWindow, VarPtr (windowRects.0.windowCnt) + + windowCnt++ + } + + hWindowBefore = hWindow + Loop + If GetKey2 (KEY_MOUSE_L) { If moving { nizikaX = LimitF (mouseX - offsetX, -NIZIKA_LEFT, gInfo_dispX - NIZIKA_RIGHT) @@ -55,12 +87,22 @@ fallVel = 0. } Else: If falling { - nizikaY = LimitF (nizikaY + fallVel, Null, gInfo_dispY - NIZIKA_BASE) + nizikaY = LimitF (nizikaY + fallVel, Null, base - NIZIKA_BASE) fallVel += 9.8 - If nizikaY >= gInfo_dispY - NIZIKA_BASE { - falling = False + If nizikaY >= base - NIZIKA_BASE { + fallVel = 0. } + + base = gInfo_dispY + + Repeat windowCnt + If (windowRects.0.cnt <= nizikaX + (NIZIKA_WIDTH - NIZIKA_LEFT)) And (nizikaX + NIZIKA_LEFT < windowRects.2.cnt) { + If (nizikaY + NIZIKA_BASE <= windowRects.1.cnt) And (windowRects.1.cnt < base) { + base = windowRects.1.cnt + } + } + Loop } ReDraw False