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