[AD] Improved Windows Screensaver test for the 4.1 WIP series

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


After having worked on my own screensaver for a while, I have decided to use
some of the things I learned along the way to improve the example Windows
screensaver that comes with Allegro. Seeing that many people who write
Allegro-based screensavers use the scrsave example as a starting point, I
thought I might add a few things that could be useful to learn from.

The zip file contains scrsave.c, scrsave.rc and scrsave.rh . The first two
files replace the existing files in tests/win, and the third is a new file
that goes in the same directory. The files are based on the ones from
Allegro 4.1.10 WIP. I have also back-ported these changes to the 4.0 branch
and I'll post the patches shortly.

The changes are as follows:
+ Added some options to the screensaver that can be changed by pressing the
'settings' button in the "Windows Display Properties"/"Screen Saver" dialog.
+ Added the ability to store the screensaver options in a configuration file
(scrsave.ini). The screensaver contains code that makes sure it always reads
in and writes out the configuration files in the same directory as the
screenaver is in. Windows has different ways of calling screensavers
(preview-mode, settings-mode, standard-mode, password-mode), and each way of
calling it is done by different processes that cause the scrsave.ini file to
be read-from/written-to a location in a different directory, and Allegro's
set_config_file() on it's own is not sufficient for preventing multiple INI
files for the screensaver from being scattered around. To solve this,
set_config_file() must be called with the absolute pathname of the INI file.
As Allegro's get_executable_name() does not work with the system driver
SYSTEM_NONE, I have used an equivalent call in the Windows API to help work
out the correct path of the INI file.

Also attatched are .diff files for docs/build/msvc.txt and
docs/build/mingw32.txt that add more detail to the bit about the screensaver
example. They now mention the correct place to copy the screensaver to
depending on which version of Windows you have.


AE.

Attachment: scrsave_4.1.zip
Description: Zip compressed data

Attachment: mingw32.txt.diff
Description: Binary data

Attachment: msvc.txt.diff
Description: Binary data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/