RISC OS Screen Savers
Richard Ashbery (495) 163 posts |
RISC OS users have a small number of screen-savers in the !Boot configure program. Is there a template that could be used to ‘merge’ simple graphic BASIC programs and thus extend the range? The only and quite limited programming I’ve done is in BASIC so writing screen-savers from scratch would be nigh on impossible. |
Steve Fryatt (216) 2105 posts |
Looking at the BASIC screensavers, it seems that they’re just a Wimp task which initialises, then does its stuff on Null polls until receiving a PollwordNonZero or Message_Quit. As such, your simple graphic program would need to be able to time-slice its operation: do a couple of hundred milliseconds of drawing, then yield and repeat on the next poll. So no, you won’t be able to wrap up an existing program “just like that”, but the work needed isn’t going to be significant, I’d have thought. |
Rick Murray (539) 13851 posts |
There lies the main question – what will actually be drawn? When that question is answered, you’ll know how best to proceed. Consider one of the many AmCog games (and quite a number of games in general). The basic loop is:
It would therefore be possible to have automatic input (random or scripted) to remove the part where the keys are read, and instead just call Wimp_Poll at that point. Thus a game could become a screensaver. It’s only a rough idea (for instance games typically set the display geometry while screensavers need to run in whatever the current mode is) but it suggests that making a screensaver, if you have experience of some games, isn’t going to be impossible. Obviously things may be a little different if you would like to program a Rob Ross screensaver. ;-) Don’t worry too much about the time slice either. The AmCog games get respectable display redraw speeds and that’s pure BASIC. You will be the only task “visible”, so redraws of several centiseconds is no big deal – as long as the machine appears to wake up when the user moves the mouse… |
Stuart Painting (5389) 714 posts |
Not always. The user may have MoonFish (or even a web server) running in the background and may get annoyed if application performance suffers when the screen saver is activated. It’ll have to be a balancing act between producing a pleasant display and avoiding unwanted outcomes elsewhere. Slightly off-topic: The problem exists on other operating systems. With Mac OSX Lion, activating a screen saver would nearly always kick the MacBook’s cooling fan up to maximum speed, indicating a substantial increase in power consumption. Not a good idea for a laptop… Of course, if writing the screen saver is just for your own personal education/amusement, go for it :-) |
Richard Ashbery (495) 163 posts |
Thanks for the replies. I’ll have a look at one of the BASIC ones and see if I can get my head round the WIMP. |
GavinWraith (26) 1563 posts |
Back in 2006 on September 2nd Drobe published an article by David Llewellyn Jones How to write a screensaver . I am pretty sure that Foundation Risc User published an article on that topic, but all their archives were on CDs and it is over a decade since I had any computers that could read that medium. |
Andrew Conroy (370) 740 posts |
The drobe article Gavin refers to is here It’s for C rather than BASIC though. |
Robert Hampton (1923) 57 posts |
Way back when RISC OS 4 was released there was a guide written, in the style of Acorn’s Application Notes, for screensavers, but I can’t lay my hands on it now. I don’t think the API has changed at all in the interim. I did write a couple of screensavers for RO4 but none of them were interesting enough to release. However, from what I remember:
|
Richard Coleman (3190) 54 posts |
I did a RISC OS 4 screensaver which drew a pretty pattern on the screen which had been a single tasking program converted into a multi-tasking screensaver. It’s all in BASIC and should be straightforward to understand. Most of the code handles the WIMP stuff, and should only need minor tweaking to change things like hard-coded directory names, but there are 3 procedures at the end of the !RunImage which you’ll need to re-write with your own drawing code. The main thing is to store where you’ve got up to in your drawing code before exiting the drawing procedure and polling the WIMP. It’s a zip file on my website: http://coleman.orpheusweb.co.uk/ |