伊地知ニジカのデスクトップ・マスコットです.
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.7 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
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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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) {
  42. If StrLen (buf) != 0 {
  43. If hWindow != hWnd {
  44. hWindows.windowCnt = hWindow
  45. GetWindowRect hWindow, VarPtr (windowRects.0.windowCnt)
  46. windowCnt++
  47. }
  48. }
  49. }
  50. hWindowBefore = hWindow
  51. Loop
  52. If GetKey2 (KEY_MOUSE_L) {
  53. If gInfo_act = SCREEN_MAIN {
  54. If moving {
  55. nizikaX = LimitF (mouseX - offsetX, -NIZIKA_LEFT, gInfo_dispX - NIZIKA_RIGHT)
  56. nizikaY = LimitF (mouseY - offsetY, Null, gInfo_dispY - NIZIKA_BASE)
  57. }
  58. Else {
  59. moving = True
  60. offsetX = Double (mouseX - nizikaX)
  61. offsetY = Double (mouseY - nizikaY)
  62. }
  63. }
  64. }
  65. Else: If moving {
  66. moving = False
  67. falling = True
  68. fallVel = 0.
  69. }
  70. Else: If falling {
  71. nizikaY = LimitF (nizikaY + fallVel, Null, base - NIZIKA_BASE)
  72. fallVel += 9.8
  73. If nizikaY >= base - NIZIKA_BASE {
  74. fallVel = 0.
  75. }
  76. base = gInfo_dispY
  77. Repeat windowCnt
  78. If windowRects.LEFT.cnt > nizikaX + (NIZIKA_WIDTH - NIZIKA_LEFT) {
  79. Continue
  80. }
  81. If nizikaX + NIZIKA_LEFT >= windowRects.RIGHT.cnt {
  82. Continue
  83. }
  84. If nizikaY + NIZIKA_BASE > windowRects.TOP.cnt {
  85. Continue
  86. }
  87. If windowRects.TOP.cnt >= base {
  88. Continue
  89. }
  90. base = windowRects.TOP.cnt
  91. Loop
  92. }
  93. ReDraw False
  94. Color COLOUR_LIME
  95. BoxF
  96. Pos nizikaX, nizikaY
  97. GCopy SCREEN_NIZIKA, IIf (direction < 0, NIZIKA_WIDTH, 0), NIZIKA_HEIGHT * (frame * IIf (moving, 3, 1) \ 24), NIZIKA_WIDTH, NIZIKA_HEIGHT
  98. ReDraw True
  99. nizikaX += direction * 4
  100. If (nizikaX >= gInfo_dispX - NIZIKA_RIGHT) || (nizikaX < -NIZIKA_LEFT) {
  101. direction = -direction
  102. }
  103. Await 33
  104. frame++
  105. Loop