home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 2 / RISC_DISC_2.iso / pd_share / mags / spectrum / spectrum3 / !Spectrum3 / Issue3 / Regulars / HDTDT?1 < prev    next >
Encoding:
Text File  |  1995-03-02  |  4.0 KB  |  13 lines

  1. {fh40060C0How _do_"" they do that?
  2. {fb1000000Well, we've all seen Lovell's "on the fly" sprite decompression working and Ian's amazing mini-dtp classified ads window. The total source code for Spectrum issue three has almost topped the 140Kb mark (well over 6500 lines of code). But just how *did* they do that?
  3. {sdes
  4. Ian : From the very start Spectrum issue three was going to be in machine code, so my code had to be able to include Lovell's code easily. I started off a basic "shell" which initialised an area for the heap and claimed 512 bytes to the Wimp{_Poll block. Next I added the code just to poll and quit if quit from the Task manager (wow!). I then added an animated icon on the iconbar and then the menu. As we had decided on a Risc PC look, I had to do a small amount of code to allocate font handles and change the handles on a mode change which was relatively simple. Next came the info window which was again relatively easy, but it meant having marbled backgrounds and outline fonts for that Risc PC look. The marbled effect is just a couple of marble sprites as icons behind the text icons. I added the code to handle fonts in the info window which, as the code was already there for the menus, was no trouble at all.
  5.  
  6. I then added the small amount of code to open up the SpectFS viewer when it is selected from the menu or Adjust is pressed on the iconbar icon. The next part was a bit tricky. I designed a classified window in "!FormEd" and then transferred it into the Spectrum issue three source code. I now had an extra window with marbles and more font handling code, but it didn't do anything. I copied over my open window code and added the code to open the classified window which now opened up in the middle of the screen. I then added the "type of ad" menu which was very simple. Now when you click on the pop-up-menu icon the "type of ad" menu pops up and if you click on either options it changes the text in the icon next to it. I needed a save window and also another menu so I created a save window, again with "!FormEd", and added it to the Spectrum issue three source code. I then created another menu with "Info", "Save" and "Quit" for the classified window.
  7.  
  8. I now had the menu working, but the save window didn't do anything. Time it did, methinks. I added code to see if the filename that is entered is the right one when you press return or click on OK, and then added my error window routine, which opens up if you type in a filename that it can't use. As I had just added my error window routine I then added code to handle internal errors, which was simple. One little SWI called OS{_ChangeEnvironment did this for me. Now every time an error occurs with Spectrum issue three, RISC OS allows us to handle it instead of just putting up an error window and quitting Spectrum, which is what had previously happened.
  9.  
  10. I was then told to change the speed of the animated icon, before I was just changing the icon every time the Wimp returned a null event which was too fast. I then decided on a slower speed and used SWI Wimp{_PollIdle instead of Wimp{_Poll. Lovell then suggested that I do a mini-DTP feature with the classified window, so after a couple of hundred lines of code later (well almost) I had the mini-DTP working. I achieved this by adding the KN validation into the icons that needed them so the Wimp will tell Spectrum every time a key is pressed inside one of the icons. Spectrum then counts how many letters are in the icon and if it's full it reads backwards till it finds a space and copies the text after the space into a buffer and clears the text from the icon. Spectrum then moves the caret to the beginning of the next writable icon and copies the text to the icon by placing the copied text into the keyboard buffer which is why if the icon below is full it keeps repeating the process and it doesn't do as you were expecting, *sorry* but I can't be bothered to do it properly as it would mean a lot more code, maybe for issue four.
  11.  
  12. By now the source code was getting quite big and I kept getting
  13.