home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / utilities / utilsp / riscosity / RISCOSity
Encoding:
Text File  |  1995-07-24  |  12.1 KB  |  259 lines

  1.         Riscosity Guide
  2.         ---------------
  3.     
  4.            (c) Software7 1995
  5.            ------------------
  6.          
  7.  
  8.  Introduction
  9.  ------------
  10.  This is basically a guide for programers giving ideas, hints tips
  11.  and some basic guide lines to follow. All the code examples are in
  12.  BASIC, as everyone has this and it is the most commonly used language
  13.  amongst the kind of programers who are likely to use this.
  14.  
  15.  Application directories
  16.  -----------------------
  17.  You may not be aware of this, but most programers who have a program
  18.  that they find usefull, open the programs directory up. They do this
  19.  so thay can:
  20.  a) See what language was used
  21.  b) Look at the sprites files (and steal any good ones for themselves)
  22.  c) See what extension modules you used
  23.  
  24.  Therefore it is good practice to keep your application directory tidy. 
  25.  Follow these simple guidelines to keep everything ship shape:
  26.  1; Have all file names in lower case with an upper case first character
  27.  3; Use a Resources directory which contains:
  28.      Messages (If appropriate)
  29.      Modules directory (Put all the non-system wide modules in here)
  30.      Sprites and Sprites22 files (Private sprite area files)
  31.      Any other resources your program uses
  32.      (!Sprites, Templates and !RunImage stay in the top level directory)
  33.  4; If you are including source/uncompressed code then put it in a directory 
  34.     called Source inside the Resources directory.
  35.  5; Merge any library files into the main code, this makes things look a lot
  36.     tidier (only do this if the library's copyright permits this)
  37.     
  38.  Wimp Application
  39.  ----------------
  40.   Sprites
  41.   -------
  42.   Your application should have two different sets of sprite files. The first
  43.   one should contain the !App sprite, any file_xxx sprites and an ic_App 
  44.   sprite, this file should be called !Sprites, and gets loaded into the wimp   sprite pool using *IconSprites. All other sprites should be put in the 
  45.   other sprite file which is loaded into the private sprite area. If you do 
  46.   not know how to use a private sprite area then:
  47.   
  48.   SYS "OS_File",5,"<App$Dir>.Resources.Sprites" TO ,,,,length%
  49.   DIM sprites% length%+4
  50.   sprites%!0=length%+4
  51.   sprites%!8=16
  52.   SYS "OS_SpriteOp",9+256,sprites%
  53.   SYS "OS_SpriteOp",10+256,sprites%,"<App$Dir>.Resources.Sprites"
  54.   
  55.   Now if you load the templates using the Wimp Extension you must specify
  56.   sprites% as the sprite area (not +1 as for the wimp sprite pool)
  57.   
  58.   Your program must not load sprites for opton/optoff, radioon/radiooff
  59.   into the wimp sprite pool because the user will likely have the ones that 
  60.   they want loaded, and will not apreciate having them replaced, however if 
  61.   you must use non-standard versions
  62.   you may load them into your private sprite pool though this is not
  63.   recomended because your application will look out of place with the rest of  the desktop.
  64.   
  65.   You must not use alternatives for any filer, device or application icons.
  66.   (Even in your own sprite area) You must not include the default versions
  67.   of any sprites. This is because:
  68.   a) Often only a low resolution version is supplied so VGA monitor users
  69.      have to re-load the ROM sprites.
  70.   b) The user may have loaded their own custom versions of the sprites
  71.   c) The sprites are already loaded, re-loading them causes duplication
  72.      and results in memory wastage
  73.      
  74.   If possible your task should re-load it's sprite file whenever there is
  75.   a mode change. Whenever there is a mode change the WIMP broadcasts 
  76.   message number &400C1 (Mode_Change) when you recieve this you should
  77.   read the new mode eig value and load whichever sprite file is applicable
  78.   The code to do this would be:
  79.   
  80.    SYS "Wimp_Poll",,block% TO reason%
  81.    
  82.    CASE reason% OF
  83.     WHEN 0
  84.      ...
  85.     WHEN 17,18
  86.      IF block%!16=&400C1 THEN
  87.       SYS "OS_ReadModeVariable",-1,4 TO ,,x%
  88.       SYS "OS_ReadModeVariable",-1,5 TO ,,y%
  89.       IF x%=1 AND y%=1 THEN OSCLI "IconSprites <App$Dir>.!Sprites22"
  90.       IF (x%=2 AND y%=2) OR (y%<>x%) THEN OSCLI "IconSprites <App$Dir>.
  91.    !Sprites"
  92.    ENDCASE
  93.    
  94.   It is also necessary to re-load the sprites into the private sprite area
  95.   not just the wimp sprites. After the mode change the wimp sends redraw
  96.   messages to all open windows, so the sprites will be updated on screen
  97.   without any intervention from your task.
  98.    
  99.   Some old applications such as some old applications from DoggySoft, Black 
  100.   Hole 2 and various other programs have thier logos stored as a large sprite  loaded into the wimp sprite pool. This must not be done, on pre Risc PC 
  101.   machines you cannot easily see how much memory is being used by the wimp 
  102.   sprite pool. I typically find that about 300-600k is used up!!! This is
  103.   largely because of large company/program logos and duplications of ROM 
  104.   sprites.
  105.   
  106.   Windows
  107.   -------
  108.   It is unfair on users if in each application they use there is a completely  different window that performs a standard function like changing a font, 
  109.   printing a file etc.. If possible you should use the templates described 
  110.   in the RISC OS style guide, from Acorn. 
  111.   
  112.   Default action buttons & action buttons: These should not have a button 
  113.   type of menu, this makes the button slab in whenever the pointer is over
  114.   them. This is confusing and looks awful. You must only ever have one
  115.   default action button per window, otherwise things get confusing for the
  116.   user.
  117.   
  118.   All new applications developed should use the 3D look, if you must support
  119.   RISC OS 2 then you can use the Wimp Extension or Interface manager or
  120.   you can supply 2 sets of templates, one 2D one 3D. Your program should
  121.   also check if the 3D byte of CMOS RAM is set, RISC OS 3 users may not wish
  122.   to use the 3D desktop.
  123.   
  124.   Outline fonts
  125.   -------------
  126.   You aren't supposed to use outline fonts in windows but many people do.
  127.   Outline fonts mess up if the mode is changed from an EGA mode to a VGA
  128.   mode, their height either halves or doubles. You must NOT use outline fonts  on a windows title bar, this severly messes up and is severly hissed at by   Acorn. You can use outline fonts in your menus but is is quite complicated   to do and is best avoided. 
  129.   
  130.   If using fonts you should stick to standard ROM fonts, you can be sure 
  131.   that everyone has these. I recomend that you only use a few different type
  132.   styles. 
  133.    For body text use Homerton.Medium at 12pt
  134.    For headings use Homerton.Bold at 24pt
  135.    For large titles use Trinity.Bold ate 46pt
  136.    For writeable icons use Trinity.Medium at 12pt
  137.   
  138.   Texture mapping
  139.   ---------------
  140.   On the Risc PC is you supply a sprite called tile_1 in your private sprite
  141.   area or in the wimp sprite pool then this will be used as a tile in all
  142.   your windows backgrounds. If you want tiled window backgrounds on RISC OS
  143.   3.1 or 2 then you must supply the sprite and do the tiling in your redraw
  144.   procedure. This is slightly tricky, an easier way to do it is before you 
  145.   create any icons in your windows create one icon displaying the tile 
  146.   sprite and then copy it left, right up and down until the window is fully 
  147.   tiled. This means that the WIMP handles all the redrawing of the window and
  148.   makes the template file a bit larger. 
  149.   An example of this is in our disc magazine, Risc Mag's control panel a grey
  150.   version of the logo is tiled in the background.
  151.   
  152.   Error Boxes
  153.   -----------
  154.   You should if possible use the standard WIMP error box. If you require a 
  155.   custom error box then do not use those provided by the Wimp Extension, 
  156.   make a copy of the ROM error box template into your own sprite file and
  157.   customise that. To use this file you should open the window in the center
  158.   of the screen and then call Wimp_Poll in the same procedure, (Not your main
  159.   polling loop). The mouse should also be restricted to the window.
  160.   The error box supplied with RISC OS 3.5 (Risc PC) is much much better than
  161.   the RISC OS 2/3 one. In some of our programs, we have duplicated this 
  162.   window and use this as a report box. I advise that you do the same if at 
  163.   all possible.
  164.   
  165.   Star Commands
  166.   -------------
  167.   If your task is a module then you may wish to provide star commands to
  168.   perform various functions. These commands should be provided so that
  169.   other programs (and programmers) can interface directly with your task,
  170.   there should always be an equivelant way of carrying out the functions 
  171.   provided from a desktop interface. Users should not be expected to use the
  172.   command line, RISC OS is a WIMP operating system, the user should not have
  173.   to leave the desktop and the command line should be alienated from them
  174.   as much as possible.
  175.   
  176.   
  177.  Games
  178.  -----
  179.  When writing games I would like to ask you not to do anything stupid. Do 
  180.  not try to speed up any hardware components such as the ROMS, it was 
  181.  possible to speed the ROMs up from 4 to 8 mega herz but on RISC OS 3 this
  182.  call was made invalid and many games stoped working. When you need to
  183.  write to memory, validate the addresses first, no not assume that, for
  184.  example, screen memory will always lie at &8000. It is likely to be moved
  185.  on new machines.
  186.   
  187.  You should make your game work in an EGA mode, like 12 or 15 and a VGA mode
  188.  such as 28 or 32. You should check to see if VGA modes are valid each time
  189.  the game runs and provide high resolution versions of the graphics and
  190.  have two versions of the code because the pixel and OS unit resolutions
  191.  are different. It is recomended that you use Acorn's Games modes module, 
  192.  this provides both VGA and EGA modes that have the same X and Y sizes in 
  193.  OS units so you do not have to rewrite your code for VGA and EGA modes.
  194.  
  195.  If possible your game should run completely in the desktop, if this is not
  196.  possible then it should at least install to the icon bar and alow the users
  197.  to set the game options from here before clicking on the icon to start the
  198.  game.
  199.  
  200.  System Sprites
  201.  --------------
  202.  If you must use the system sprite area (You don't know how to use the SWIs)
  203.  then don't try to load sprites directly into memory. It is VERY unlikely
  204.  that the user will have any sprite memory set up, so either use the star
  205.  command 
  206.   *ChangeDynamicArea -SpriteSize xxxk 
  207.  or the SWI
  208.   SYS "OS_ChangeDynamicArea",3,amount TO ,bytes%
  209.  amount is the amount of memory you require, in bytes, bytes% is the amount 
  210.  of memory being allocated. If this is insufficient then report an error. 
  211.  With the star command the values are in kilobytes, using the SWI the values  are in bytes.
  212.  
  213.  You must clear the sprites away when you are finnished and free the memory 
  214.  used. If your program is multi tasking then you should put an alias on
  215.  then star commands *Snew and *Sloadso that no other program or user can 
  216.  clear your sprites away whilst you are trying to use them. To do this you 
  217.  can use the commands:
  218.  *Set Alias$Snew Error There are sprites still being used in the system 
  219.   sprite area
  220.  *Set Alias$Sload Error There are sprite still being used in the system 
  221.  sprite area
  222.  And when you are finnished, restore the commands using:
  223.  *UnSet Alias$Snew
  224.  *UnSet Alias$Sload
  225.   
  226.  
  227.  
  228.  Configuration
  229.  -------------
  230.  Programs should never make assumptions about the configuration of a users 
  231.  machine, and if they find it configured wrongly then they must NEVER 
  232.  re configure it to suite their own purposes. They may however ask the user
  233.  for confirmation before they change any preconfigured values, make sure you  let the user know exactly what you are about to do. The exception to the 
  234.  above rule is if your program is, for example a start up managing 
  235.  application, it may override the boot option to make sure it gets run, when  being installed.
  236.  
  237.  
  238.  Reservations
  239.  ------------
  240.  Most people are aware of Acorn's policy of name registration. Most authors 
  241.  of PD software think that the policy does not apply to them. I will explain:
  242.   
  243.   For every program you write you must register the application name, any 
  244.   system variable and any file types it uses with Acorn, even PD programs.
  245.   TO make an reservation you should write off for a copy of the !Allocate 
  246.   program from Acorn. You simply fill in a few details and then send the
  247.   file back and they check that your names are unique and allocate any file
  248.   types and then write back.
  249.   
  250.  It is incredibly annoying to have several programs fighting over which of
  251.  them is going to load a file, all claiming that it belongs to them.
  252.  
  253.  Please register all names and filetypes.
  254.  
  255.  
  256.  
  257.  
  258.   
  259.