ウィンドウの上に乗れるように.

このコミットが含まれているのは:
2023-06-06 00:24:53 +09:00
コミット 75653f452f
+47 -5
ファイルの表示
@@ -7,8 +7,8 @@
#const NIZIKA_WIDTH 300 #const NIZIKA_WIDTH 300
#const NIZIKA_HEIGHT 300 #const NIZIKA_HEIGHT 300
#const NIZIKA_BASE 240 #const NIZIKA_BASE 236
#const NIZIKA_LEFT 60 #const NIZIKA_LEFT 100
#const NIZIKA_RIGHT 250 #const NIZIKA_RIGHT 250
@@ -17,6 +17,8 @@
SetWindowLong hWnd, GWL_EXSTYLE, GetWindowLong (hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED SetWindowLong hWnd, GWL_EXSTYLE, GetWindowLong (hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetLayeredWindowAttributes hWnd, RGBCOLOUR_LIME, False, True SetLayeredWindowAttributes hWnd, RGBCOLOUR_LIME, False, True
HWND_DESKTOP = GetDesktopWindow () ; デスクトップ取得
Color COLOUR_LIME Color COLOUR_LIME
BoxF BoxF
@@ -34,8 +36,38 @@
moving = False moving = False
falling = True falling = True
base = gInfo_dispY
Repeat 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 GetKey2 (KEY_MOUSE_L) {
If moving { If moving {
nizikaX = LimitF (mouseX - offsetX, -NIZIKA_LEFT, gInfo_dispX - NIZIKA_RIGHT) nizikaX = LimitF (mouseX - offsetX, -NIZIKA_LEFT, gInfo_dispX - NIZIKA_RIGHT)
@@ -55,12 +87,22 @@
fallVel = 0. fallVel = 0.
} }
Else: If falling { Else: If falling {
nizikaY = LimitF (nizikaY + fallVel, Null, gInfo_dispY - NIZIKA_BASE) nizikaY = LimitF (nizikaY + fallVel, Null, base - NIZIKA_BASE)
fallVel += 9.8 fallVel += 9.8
If nizikaY >= gInfo_dispY - NIZIKA_BASE { If nizikaY >= base - NIZIKA_BASE {
falling = False 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 ReDraw False