Skip to content

Commit d81abbe

Browse files
committed
Add more detailed technical docs
1 parent 5e43ef5 commit d81abbe

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed

README.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# Arcade Screen Saver Framework
22

3-
A very simple Python framework for making screen savers for Windows. Uses the [Arcade](https://github.com/pythonarcade/arcade) 2D video game library.
3+
A very simple Python framework that allows you to write official Windows screen savers using
4+
Python and the [Arcade](https://github.com/pythonarcade/arcade) 2D video game library.
45

5-
Most Arcade applications that use the class-centric Arcade API (ex: derive a window from `arcade.Window`) can be made into a Windows screen saver.
6-
Usually, it is as simple as adding the framework import to your existing application and creating your window with `window = screensaver_framework.create_saver_win(MyGameClass)`
6+
Most Arcade applications that use the class-centric Arcade API (ex: derive a window from `arcade.Window`)
7+
can be made into a Windows screen saver. Usually, it is as simple as adding the framework import to your
8+
existing application and creating your window with `window = screensaver_framework.create_saver_win(MyGameClass)`
79

810
This framework provides your app:
911
* What it needs to interface with Windows so your Arcade application is seen as an official Windows screen saver.
1012
* Input event handling to automatically exit the application when any keyboard or mouse input is detected.
11-
* Handling of multi-monitor setups (draws screen saver on largest screen)
13+
* Handling of multi-monitor setups (draws screen saver visuals on largest monitor)
1214
* An included installation script that takes your Arcade application and:
13-
* Bundles it into a one-file executable (via PyInstaller) necessary for Windows screen savers
15+
* Bundles it into a one-file .exe (via PyInstaller) necessary for Windows screen savers
1416
* Installs the bundle in the appropriate place with the appropriate name so that Windows can find it.
1517

1618
# Quick start
@@ -35,8 +37,15 @@ Must run this command from a Command Prompt that was opened with "Run as adminis
3537
install_screensaver venv\Lib\site-packages\arcade_screensaver_framework\examples\minimal_saver.py
3638

3739
After installation, you need to go into Window's "Screen Saver Settings" dialog and
38-
select your newly installed screen saver. Click the "Preview" button on the dialog
39-
and you should see your screen saver appear after a couple seconds.
40+
select your newly installed screen saver. This is usually accomplished by following steps similar to:
41+
42+
* Right click on the Windows desktop
43+
* Select "Personalilze"
44+
* Click "Lock screen" in left pane
45+
* Scroll to the bottom of the dialog and click link labeled "Screen saver settings"
46+
* In the "Screen Saver Settings" dialog, select your screen saver from the "dropdown"
47+
* Enter a "Wait" time for how long your computer must be idle before it starts the screen saver
48+
* Click the "Preview" button to see your screen saver
4049

4150
*Note: The "Screen Saver Settings" dialog will feel very sluggish while your have a custom
4251
screen saver selected. This is because Windows is running the screen saver application
@@ -78,11 +87,11 @@ Open a Command Prompt terminal with "Run as administrator", make sure the proper
7887

7988
As the `arcade_screensaver_framework` handles input events, your code shouldn't have any `on_keyboard_press`, `on_mouse_press`, `on_mouse_motion` event handlers.
8089

81-
# Technical reference
90+
# Reference
8291

83-
## What is required in a screen saver
92+
## What is required in a screen saver?
8493

85-
To write an Arcade script that can be used as a screen saver, just a few things need to be done.
94+
To write an Arcade script that can be used as a screen saver, just a few things need to be done in the code.
8695
Refer to the `my_test.py` example above for a concrete illustration of the points below.
8796

8897
First, import the module at the top of your script:
@@ -116,7 +125,7 @@ try to provide input event handlers like `on_mouse_motion` or `on_keyboard_press
116125
as these could interfere with arcade_screensaver_framework's operation.
117126

118127
### Resolution selection
119-
When the screensaver is run in fullscreen mode, the framework chooses the most
128+
When the screen saver is run in fullscreen mode, the framework chooses the most
120129
appropriate screen resolution. This way, your application can run on computers
121130
with screens of any size. This means your screen saver should query the size of
122131
the screen when it starts with a function like `.get_size()` and adjust to the
@@ -130,4 +139,17 @@ height and width dynamically.
130139
- second parameter (optional): can specify keyword arguments that will be passed to the
131140
`Windows` constructor
132141

142+
### Windows screen saver interface
143+
144+
For an application to be an official Windows screen saver, it must do the following things:
145+
146+
| Requirements | How framework fulfills it |
147+
|--------------|---------------------------|
148+
| Must be a Windows .exe file. | The `install_screensaver.bat` script uses [PyInstaller](https://www.pyinstaller.org/) to bundle the Python script into an .exe. |
149+
| The .exe must be renamed to have a `.scr` extension and be saved into a specific Windows system directory. | Handled by `install_screensaver.bat` script. |
150+
| Must handle a few command line flags when run. This is how Windows controls the screen saver. | This framework parses the command line flags and responds appropriately. |
151+
| Executable must exit when it receives keyboard or mouse input events. | Input handling is taken care of by the framework. |
152+
153+
Reference: Windows [Screen Saver command line arguments](https://docs.microsoft.com/en-us/troubleshoot/windows/win32/screen-saver-command-line)
154+
133155
![Hits](http://cc.amazingcounters.com/counter.php?i=3245831&c=9737806)

0 commit comments

Comments
 (0)