Click here to Skip to main content
15,893,161 members
Articles / Programming Languages / C#
Article

Andrew's CodeProject Screen Saver

Rate me:
Please Sign up or sign in to vote.
5.00/5 (10 votes)
20 May 20023 min read 215.7K   470   43   37
(Yet) another screen saver for the Code Project competition, with code in C# and (coming soon) some details about how certain aspects of the code involved work.

Introduction

Options panel

Yes folks, my secret is out! I've been developing a screen saver for the competition. "Huh?" I hear you all say. Well, I've been really busy of late, so didn't want to make a big fuss about it and then not deliver. Luckily, after several weeks of my C# screen saver sounding more like an F natural (groan), I managed to kick the little baby into touch in time to catch the voting form being put up.

Before I go any further, may I just give a big thanks to Chris, firstly for grabbing onto such a great idea for a CP competition, and secondly for building the final .exe on his machine to save me from those Beta 2 blues (oh, they just keep coming!).

Here's a rundown of the main features of the screensaver:

  • Downloads data in a separate thread so as not to block user interface
  • Detects if a user is offline
  • Will retry after five minutes should the connection to the server fail
  • Hair raising graphics
  • Customisable animation speed for users with slower machines etc.

Installation

Installation is as easy as pie:

  1. Copy CP Screensaver.scr into your Windows system folder.
  2. Copy the Images folder as a sub-folder of your Windows system folder.
  3. Select the CP Screensaver from your Display properties.

Done like a dinner!

How it works

Check back soon! Major areas to be covered will be:

  • Double buffering
  • Alpha blending (the fade effect)
  • State management
  • Multiple monitor support (presuming it actually works as I intended, see below).

Multiple Monitors

Unfortunately, I don't run a multi-monitor system, which means that, whilst I have added support for multiple monitors (not particularly efficient support, granted), I have been unable to test the saver on such a configuration. If you have been able to try the saver out with multiple monitors, I'd be interested to hear your successes/failures in the comments section at the bottom of the article.

To do

The screensaver certainly has some way to go in the future but I simply don't have time to do anything with it just yet; here is a list of stuff I plan to do, off the top of my head:

  • Subtly animated background with alpha blending on lights of lift platform
  • Caching of local data so if the user isn't connected they can still see a list of posts etc. from the last time the saver managed to connect.
  • Better handling of really high and really low resolutions (maybe utilise extra space somehow?)
  • Better multiple monitor support
  • Some bits of optimisations (there are a few loop invariants that need sorting out, but nothing that's too big of a problem)

Conclusion

Okay - so I hope you enjoy what is already here. The code isn't in the neatest of forms by any means because I used this project as a learn-C#-as-you go, so there may be the odd rough edge here and there, though on the whole it's pretty reasonable.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United Kingdom United Kingdom
Andrew is currently a student at the University of Cambridge, working towards a degree in Computer Science. The word 'working' is used here in a vague sense, with the hope that the reader will realise that the same sentence contained the word 'student'.

Aside from computing he has a strong interest in music, and enjoys the outdoors, particularly when the weather permits going out in them... To Andrew, cycling is fun, sailing is more fun, and the odd camping trip and walk is certainly what the doctor ordered.

In terms of programming experience, he first started writing programs for the Commodore Amiga using BASIC, after which he learned the joys of C and has never looked back. Since, he has added C++ and C# to his repotoire, along with a bunch of other crazy languages like ML that they like to teach in college.

Comments and Discussions

 
GeneralUnable to Connect to Server too Pin
silas_yao13-Jun-06 21:44
silas_yao13-Jun-06 21:44 
GeneralOne Suggestion Pin
Rob Edwards21-May-02 2:45
Rob Edwards21-May-02 2:45 
QuestionNot working... on my system... No C#? Pin
Boris Sundic20-May-02 16:11
Boris Sundic20-May-02 16:11 
AnswerRe: Not working... on my system... No C#? Pin
Nick Parker20-May-02 16:46
protectorNick Parker20-May-02 16:46 
GeneralNice, but here is an error Pin
Nick Parker20-May-02 12:58
protectorNick Parker20-May-02 12:58 
GeneralRe: Nice, but here is an error Pin
Rama Krishna Vavilala20-May-02 13:01
Rama Krishna Vavilala20-May-02 13:01 
GeneralRe: Nice, but here is an error Pin
Andrew Peace20-May-02 13:14
Andrew Peace20-May-02 13:14 
GeneralRe: Nice, but here is an error Pin
Christian Graus20-May-02 13:20
protectorChristian Graus20-May-02 13:20 
I just got it running here at work. Very nice, although the animation is a *little* chunky IMO. You obviously have more drawing skill than I do, that's for sure....

I'll have a look tonight and LYK how it runs on my multi monitor setup. I probably spent too much time on MM for our screensaver, given how few people will use it. I've not looked at your code, so I dunno how you're doing it, but I'll LYK the outcome.

I especially love the 'Donkey Kong' feel of the whole thing, I must say. These last few days have made me realise I *need* to write something to allow random running of a range of ss, most of the ones entered I would like to see running on my machine, and I'd prefer not to have to choose between them myself Smile | :)


Christian

The tragedy of cyberspace - that so much can travel so far, and yet mean so little.

And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
GeneralRe: Nice, but here is an error Pin
Andrew Peace20-May-02 13:36
Andrew Peace20-May-02 13:36 
GeneralRe: Nice, but here is an error Pin
Christian Graus20-May-02 13:42
protectorChristian Graus20-May-02 13:42 
GeneralRe: Nice, but here is an error Pin
Nick Parker20-May-02 14:34
protectorNick Parker20-May-02 14:34 
GeneralRe: Nice, but here is an error Pin
Andrew Peace20-May-02 14:42
Andrew Peace20-May-02 14:42 
GeneralRocks!!! Pin
Rama Krishna Vavilala20-May-02 12:44
Rama Krishna Vavilala20-May-02 12:44 
GeneralRe: Rocks!!! Pin
Andrew Peace20-May-02 13:04
Andrew Peace20-May-02 13:04 
GeneralRe: Rocks!!! Pin
Rama Krishna Vavilala20-May-02 13:06
Rama Krishna Vavilala20-May-02 13:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.