Author Topic: Sorry for the prank. Have PlasmaDoodle  (Read 2966 times)

0 Members and 1 Guest are viewing this topic.

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Sorry for the prank. Have PlasmaDoodle
« on: December 30, 2020, 10:45:47 am »
This program captures whatever you had on screen at the time of launch, and then draws it to make a "clear" window.

If you don't like where the window started, you can move it and press SPACE to re-center.

After that, click & drag anywhere.

Code: QB64: [Select]
  1.  
  2. _TITLE "PlasmaDoodle"
  3.  
  4. ' Hardware
  5. DIM ScreenOffsetX
  6. DIM ScreenOffsetY
  7. ScreenOffsetX = -3
  8. ScreenOffsetY = -26
  9.  
  10. Desktop = _SCREENIMAGE
  11. SCREEN _NEWIMAGE(INT(_WIDTH(Desktop) * .5), INT(_HEIGHT(Desktop) * .5), 32)
  12. _PUTIMAGE (-_SCREENX + ScreenOffsetX, -_SCREENY + ScreenOffsetY), Desktop
  13.  
  14. ' Constants
  15. pi = 4 * ATN(1)
  16.  
  17. ' Structures and variables
  18. TYPE ShadeVector
  19.     VelocityRed AS INTEGER
  20.     VelocityGreen AS INTEGER
  21.     VelocityBlue AS INTEGER
  22.  
  23. DIM SHARED MainPhase(_WIDTH, _HEIGHT) AS ShadeVector
  24.  
  25.  
  26.  
  27.  
  28.  
  29. 'FOR i = 1 TO 350
  30. '    p = RND * _WIDTH
  31. '    q = RND * _HEIGHT
  32. '    CIRCLE (p - 50, q - 50), 100, _RGB32(RND * 255, RND * 255, RND * 255, RND * 255)
  33. '    LINE (100, 100)-(300, 300), _RGB32(255, 155, 0, 255), BF
  34. 'NEXT
  35.  
  36.  
  37. FOR i = 1 TO _WIDTH
  38.     FOR j = 1 TO _HEIGHT
  39.         MainPhase(i, j).VelocityRed = 9
  40.         MainPhase(i, j).VelocityGreen = 8
  41.         MainPhase(i, j).VelocityBlue = 7
  42.     NEXT
  43.  
  44. DIM t2
  45. DIM mx
  46. DIM my
  47.  
  48. ' Main loop
  49.     IF _KEYHIT = ASC(" ") THEN
  50.         _PUTIMAGE (-_SCREENX + ScreenOffsetX, -_SCREENY + ScreenOffsetY), Desktop
  51.     END IF
  52.         mx = _MOUSEX
  53.         my = _MOUSEY
  54.         IF _MOUSEBUTTON(1) THEN
  55.             GOSUB DrawIt
  56.         END IF
  57.     LOOP
  58.     _DISPLAY
  59.     _LIMIT 60
  60.  
  61. ' Graphics
  62. DrawIt:
  63. FOR i = mx - 40 TO mx + 40
  64.     FOR j = my - 40 TO my + 40
  65.         IF ((i > 0) AND (i < _WIDTH) AND (j > 0) AND (j < _HEIGHT)) THEN
  66.             t2 = (i - mx) * (i - mx) + (j - my) * (j - my)
  67.             'IF (t2 < 1600) THEN
  68.             r = _RED32(POINT(i, j))
  69.             g = _GREEN32(POINT(i, j))
  70.             b = _BLUE32(POINT(i, j))
  71.             p = MainPhase(i, j).VelocityRed
  72.             q = MainPhase(i, j).VelocityGreen
  73.             w = MainPhase(i, j).VelocityBlue
  74.             r = r + p
  75.             IF (r > 255) OR (r < 1) THEN MainPhase(i, j).VelocityRed = -p
  76.             g = g + q
  77.             IF (g > 255) OR (g < 1) THEN MainPhase(i, j).VelocityGreen = -q
  78.             b = b + w
  79.             IF (b > 255) OR (b < 1) THEN MainPhase(i, j).VelocityBlue = -w
  80.             PSET (i, j), _RGB32(r, g, b, 255 * (1 - t2 / 1600))
  81.             'END IF
  82.         END IF
  83.     NEXT
  84.  



ss.png
* ss.png (Filesize: 2.73 MB, Dimensions: 1920x1080, Views: 248)
« Last Edit: December 30, 2020, 10:50:09 am by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Sorry for the prank. Have PlasmaDoodle
« Reply #1 on: December 30, 2020, 12:02:36 pm »
Well I am sorry for calling it a prank, because I could not figure a elegant way of escaping or preventing code from getting stuck in full screen.

It does make a pretty clever one! Perhaps I gave you too much credit :)

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Sorry for the prank. Have PlasmaDoodle
« Reply #2 on: December 30, 2020, 12:15:52 pm »
Nah man, it *was* a prank :-)

Protip: load in full screen, then color the bottom corner of the monitor as if it's been dropped....... and then just leave it for someone to find.
You're not done when it works, you're done when it's right.