Desktop Carousel

by Alan Wrigley


This is an updated version of an application first published in RISC User 7:6 which enables you to display a sequence of sprites in a continuous carousel in a multi-tasking window on the desktop.

Before you can use the application, you must copy it onto a separate disc and decide which pictures will form the display. These should take the form of sprite files (type &FF9), or Squash files (&FCA) which contain squashed sprite files. The first sprite in each file will be displayed. The files should be placed inside the Pics sub-directory of the !Carousel application directory, and should be named Pic01, Pic02, Pic03 and so on, in the order in which you want them to be displayed. There should be no other files inside the Pics directory other than those which form the display, and there should be no gaps in the numbering.

The sprites may be created in any screen mode, since colour translation is performed before they are displayed. Bear in mind, however, that 32000 and 16 million colour sprites created on a new Acorn machine cannot be displayed on older machines (pre-RISC OS 3.5) since the old ColourTrans module does not recognise the new formats.

Running the application opens a window in the centre of the screen with the first sprite in the sequence displayed. The other sprites in the sequence are then shown in turn, with an initial time interval of 5 seconds (this can be altered, as described later). When the last picture has been displayed, the sequence wraps round again to the first. The window may be moved around as usual, and also re-sized. Although at first sight it may appear that the window cannot be made larger, since the scroll bars are fully extended, clicking on the window's Adjust size icon and holding the mouse button down will cause the sprite window to go blank and the scroll bars to shorten. You can now resize the window over the whole screen area. When you release the mouse button, the picture will be re-displayed at the new size.

Clicking Menu over the window opens a menu with one item, namely Controls. This allows you to open or close the control panel - the item is ticked when the panel is open. The control panel is in two sections. The lower section controls the time interval. To alter the interval, type a value in seconds into the writable icon and then either press Return or click on the Set delay icon.

The upper section of the control panel has 5 toolbox-style icons. From the left, these are the Full-screen tool, the Aspect tool, the Pause tool, the Back tool and the Next tool. Clicking on the Full-screen tool causes the carousel display to take over the entire screen. To return to the original windowed display, simply click on the mouse. The Aspect tool enables you to preserve the original aspect ratio of each sprite. If this is turned off (the default state), each sprite is always resized to fit the current window size exactly, regardless of the aspect ratio. If it is turned on, the original aspect ratio of the sprite is preserved. This means that if the x:y ratio of the window is greater than that of the sprite, the picture will not completely fill the window in the horizontal direction, while if it is less, the same will be true in the vertical direction. Clicking on the tool toggles the setting on or off.

Clicking on the Pause tool pauses the carousel at the currently displayed sprite. When Pause mode is on, the Back and Next tools can be used to display the previous or next sprite in the sequence respectively. When Pause mode is off, these twotools are inoperative.

Clicking on the main window's Close icon terminates the application.

This updated version allows you to use squashed sprite files as well as standard ones, as mentioned earlier. For details of how to use the Squash module to compress and decompress files, see the Wimp Topics article in this month's RISC User magazine. The new version loads a new sprite into memory as soon as the previous one is displayed, to allow time for the decompression process before the sprite is required by the display. This means that this version requires more memory than the previous one, which will be particularly noticeable if you are displaying large images. You may also find that if you reduce the delay setting significantly, it may take longer to decompress large sprites than the configured delay, and so the actual delay may be greater than it should be.

Copyright  RISC User 1994, 1996
