Screen Saver Programs: Difference between revisions
No edit summary |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 17: | Line 17: | ||
{{CodeStart}} | {{CodeStart}} | ||
S& = {{Cl|_SCREENIMAGE}} 'get the image of the desktop | S& = {{Cl|_SCREENIMAGE}} 'get the image of the desktop | ||
{{Cl|RANDOMIZE}} {{Cl|TIMER}} | {{Cl|RANDOMIZE}} {{Cl|TIMER (function)|TIMER}} | ||
screenx = {{Cl|_WIDTH (function)|_WIDTH}}(S&) 'use current screen resolution dimensions | screenx = {{Cl|_WIDTH (function)|_WIDTH}}(S&) 'use current screen resolution dimensions | ||
screeny = {{Cl|_HEIGHT}}(S&) | screeny = {{Cl|_HEIGHT}}(S&) | ||
Line 43: | Line 43: | ||
{{Cl|SYSTEM}} 'close screen saver immediately | {{Cl|SYSTEM}} 'close screen saver immediately | ||
{{CodeEnd}} | {{CodeEnd}} | ||
{{ | {{Small|Code by DSMan}} | ||
{{PageSeeAlso}} | |||
* [[_MOUSEMOVEMENTX]], [[_MOUSEMOVEMENTY]] | * [[_MOUSEMOVEMENTX]], [[_MOUSEMOVEMENTY]] | ||
* [[SCREEN]], [[_SCREENIMAGE]] | * [[SCREEN]], [[_SCREENIMAGE]] | ||
* [[ | * [[SaveImage SUB]] | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 20:08, 5 January 2024
Screen savers are simply graphics EXE programs renamed with the SCR file extension. The program should NOT use a lot of Window's CPU resources! To check the CPU usage, open Task Manager by pressing Ctrl + Alt + Delete keys and look for the QB64 program running in the Processes tab list. CPU usage should be less than 50% and ideally less than 20%. Use _LIMIT or SLEEP when needed.
The program can be renamed several ways using a program or batch file you make or doing it manually in Windows. In Windows you can open an Explorer window select the Tools menu and click Folder Options.... Select the View tab and uncheck the Hide extensions for known file types box. Then you can simply rename the program file changing the extension. Then either move the file or Install it as explained below:
- Install the program in the SCR file Right click pop-up menu.
- Copy the SCR program to the C:\Windows\System32 folder so that Windows will list it in the Desktop Properties. Select the Screensaver tab's drop-down Menu List and select the new screensaver from the list.
Example: A screen saver that un-organizes the Desktop.
S& = _SCREENIMAGE 'get the image of the desktop RANDOMIZE TIMER screenx = _WIDTH(S&) 'use current screen resolution dimensions screeny = _HEIGHT(S&) SCREEN _NEWIMAGE(screenx, screeny, 32) _FULLSCREEN _DISPLAY temp& = _NEWIMAGE(40, 40, 32) DO: _LIMIT 10 x1 = INT(RND * screenx) y1 = INT(RND * screeny) x2 = x1 + 40 y2 = y1 + 40 _PUTIMAGE , S&, temp&, (x1, y1)-(x2, y2) 'place partial image into page box xoff1 = INT(40 - RND * 81) + x1 yoff1 = INT(40 - RND * 81) + y1 xoff2 = INT(40 - RND * 81) + x2 yoff2 = INT(40 - RND * 81) + y2 _PUTIMAGE (xoff1, yoff1)-(xoff2, yoff2), temp&, 0 'place image on the screen _DISPLAY DO WHILE _MOUSEINPUT 'check for mouse movement mx = mx + _MOUSEMOVEMENTX my = my + _MOUSEMOVEMENTY LOOP LOOP UNTIL INKEY$ > "" OR mx <> 0 OR my <> 0 'check for any key press SYSTEM 'close screen saver immediately |
See also