伊地知ニジカのデスクトップ・マスコットです.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.hsp 2.6 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #include "user32.as"
  2. #pack "start.ax" ; 暗号化防止
  3. #packopt hide 1
  4. #packopt name "nizika-desktop"
  5. #const NIZIKA_WIDTH 300
  6. #const NIZIKA_HEIGHT 300
  7. #const NIZIKA_BASE 236
  8. #const NIZIKA_LEFT 100
  9. #const NIZIKA_RIGHT 250
  10. ; 半透明スクリーン作成
  11. SCREEN_MAIN = BgScr2 (gInfo_dispX, gInfo_dispY, SCREEN_HIDE, 0, 0)
  12. SetWindowLong hWnd, GWL_EXSTYLE, GetWindowLong (hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED
  13. SetLayeredWindowAttributes hWnd, RGBCOLOUR_LIME, False, True
  14. HWND_DESKTOP = GetDesktopWindow () ; デスクトップ取得
  15. Color COLOUR_LIME
  16. BoxF
  17. SCREEN_NIZIKA = Buffer2 ()
  18. PicLoad "assets/nizika.png"
  19. GSel SCREEN_MAIN, 2
  20. frame = 0
  21. nizikaX = Double (-NIZIKA_LEFT)
  22. nizikaY = Double (gInfo_dispY - NIZIKA_BASE)
  23. direction = 1
  24. moving = False
  25. falling = True
  26. base = gInfo_dispY
  27. Repeat
  28. Dim hWindows, 1
  29. Dim windowRects, 4, 1
  30. hWindows.0 = GetTopWindow (HWND_DESKTOP)
  31. hWindowBefore = hWindows.0
  32. GetWindowRect hWindows.0, VarPtr (windowRects.0.0)
  33. windowCnt = 1
  34. Repeat
  35. hWindow = GetWindow (hWindowBefore, GW_HWNDNEXT)
  36. If hWindow = 0 {
  37. Break
  38. }
  39. buf = ""
  40. GetWindowText hWindow, VarPtr (buf), 256
  41. If (IsWindowVisible (hWindow) != False) And (StrLen (buf) != 0) {
  42. hWindows.windowCnt = hWindow
  43. GetWindowRect hWindow, VarPtr (windowRects.0.windowCnt)
  44. windowCnt++
  45. }
  46. hWindowBefore = hWindow
  47. Loop
  48. If GetKey2 (KEY_MOUSE_L) {
  49. If moving {
  50. nizikaX = LimitF (mouseX - offsetX, -NIZIKA_LEFT, gInfo_dispX - NIZIKA_RIGHT)
  51. nizikaY = LimitF (mouseY - offsetY, Null, gInfo_dispY - NIZIKA_BASE)
  52. }
  53. Else {
  54. moving = True
  55. offsetX = Double (mouseX - nizikaX)
  56. offsetY = Double (mouseY - nizikaY)
  57. }
  58. }
  59. Else: If moving {
  60. moving = False
  61. falling = True
  62. fallVel = 0.
  63. }
  64. Else: If falling {
  65. nizikaY = LimitF (nizikaY + fallVel, Null, base - NIZIKA_BASE)
  66. fallVel += 9.8
  67. If nizikaY >= base - NIZIKA_BASE {
  68. fallVel = 0.
  69. }
  70. base = gInfo_dispY
  71. Repeat windowCnt
  72. If (windowRects.0.cnt <= nizikaX + (NIZIKA_WIDTH - NIZIKA_LEFT)) And (nizikaX + NIZIKA_LEFT < windowRects.2.cnt) {
  73. If (nizikaY + NIZIKA_BASE <= windowRects.1.cnt) And (windowRects.1.cnt < base) {
  74. base = windowRects.1.cnt
  75. }
  76. }
  77. Loop
  78. }
  79. ReDraw False
  80. Color COLOUR_LIME
  81. BoxF
  82. Pos nizikaX, nizikaY
  83. GCopy SCREEN_NIZIKA, IIf (direction < 0, NIZIKA_WIDTH, 0), NIZIKA_HEIGHT * (frame \ 24), NIZIKA_WIDTH, NIZIKA_HEIGHT
  84. ReDraw True
  85. nizikaX += direction * 4
  86. If (nizikaX >= gInfo_dispX - NIZIKA_RIGHT) || (nizikaX < -NIZIKA_LEFT) {
  87. direction = -direction
  88. }
  89. Await 33
  90. frame++
  91. Loop