Author Topic: Prank program that shakes your desktop.  (Read 3871 times)

0 Members and 1 Guest are viewing this topic.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Prank program that shakes your desktop.
« on: August 01, 2020, 02:43:21 pm »
I dug this up from an old HD.  It was posted the old QB64 when QB64 was using SDL.  I updated the code and post it here.

It's a simple joke program that simply shakes your desktop like it has an earthquake.  Any key exits.  A little nonsense now and then can be fun....

- Dav

Code: QB64: [Select]
  1. '================
  2. 'SHAKEDESKTOP.BAS
  3. '================
  4. 'Shakes desktop until a keypress.
  5. 'Coded for fun by Dav in QB64GL 1.4
  6.  
  7. 'WARNING: THIS PROGRAM PRODUCES FAST MOVING IMAGES.
  8.  
  9. 'NOTE: ANY KEY STOPS PROGRAM
  10.  
  11.  
  12. _SCREENHIDE 'hide program
  13.  
  14. desktop& = _SCREENIMAGE 'grab image of the desktop
  15.  
  16. _SCREENSHOW 'make program visible again
  17.  
  18. 'setup screen based on desktop image size
  19. SCREEN _NEWIMAGE(_WIDTH(desktop&), _HEIGHT(desktop&), 32)
  20.  
  21. _SCREENMOVE 0, -30  'move it up a little to hide titlebar
  22.  
  23. '_FULLSCREEN  'use _fullscreen if taskbar not covered on your desktop.
  24. '             'if using _fullscreen, you won't need _screenmove above.
  25.  
  26.     _PUTIMAGE (RND * 16, RND * 8), desktop&, 0
  27.     _LIMIT 20
  28.  
  29. _FREEIMAGE desktop&
  30.  
  31.  
« Last Edit: August 01, 2020, 02:44:43 pm by Dav »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Prank program that shakes your desktop.
« Reply #1 on: August 01, 2020, 03:54:10 pm »
Hey I used that in Battleship when your ship got hit! except I think I used _SCREENMOVE.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Prank program that shakes your desktop.
« Reply #2 on: August 01, 2020, 06:45:40 pm »
Umm... All I got on my machine was a full screen sized black image... No changes made. Copy, paste and run...
Logic is the beginning of wisdom.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Prank program that shakes your desktop.
« Reply #3 on: August 01, 2020, 07:40:28 pm »
Umm... All I got on my machine was a full screen sized black image... No changes made. Copy, paste and run...

Linux doesn’t work with _SCREENIMAGE, I don’t think.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Prank program that shakes your desktop.
« Reply #4 on: August 01, 2020, 07:56:48 pm »
Oh yes, I had forgotten _SCREENIMAGE is Win only.  Sorry @johnno56

Is there another way to grab desktop image in linux or mac?

- Dav

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Prank program that shakes your desktop.
« Reply #5 on: August 01, 2020, 08:53:00 pm »
Now that you mention it... Not a clue as I have never had the need to... No. Not entirely true. I have used the keyboard "PrtScn" for a full screen capture and Alt+PrtScn for current window capture. But how to use that via QB64? I have no idea. I can live with this prank working only on Windows... lol
Logic is the beginning of wisdom.