RSC FILES IN GFA BASIC by Robert Heessels, Strike-a-Light Software
Hello you freaks out there!
Let's have a short introduction first. My name is Robert Heessels.
I am a programmer, and work at the Dutch softwarehouse STRIKE-a-
LIGHT software (in fact I'm one of the owners of this company). I
work on the ST now for one and a half year. Most of the
programming I do is done in GfA basic. All routines that should
run fast I write in pure assembler using Profimat. For my
resources, I use K-Resource, or create them myself from GfA basic.
All right, now let's start.
On the disk you'll find a GfA basic program called RESOURCE.BAS,
and the resource file RESOURCE.RSC. Try and examine the program to
learn using resources.
The ST has some standard built in routines, which can take care of
the interactivity between user and computer. Examples are the well
known menu bar, alert boxes or forms. These are all described in a
so called resource.
So, a resource is a pile of information describing things like
menu bars and forms. A resource is usually made with a resource
construction set like K-Resource. The resource file is called
*.RSC.
A resource is built up by objects. An object is for example a
string, a box or an icon. By combining loose objects you can
create a resource file.
I will now explain how to make a form.
Start with putting a form (a big box) in the creation window. You
now have a rectangle in which you can organize your objects. You
can put an OK box in it, an icon, an editable text (the user can
type in some information), etc. When the form looks like the way
you want it to, you can save a resource file containing the form.
Now you must merge the resource in your program.
If you have given each object a name, you can get a list of the
names and numbers of the object by merging the *.H file to your
program.
At the start of the program you must load the resource file:
N$="*.RSC"+Chr$(0)
Lpoke Addrin,Varptr(N$)
Gemsys 110
The gemsys takes care of loading the resource file in free memory.
Now you must get the start adress of the resource:
Dpoke Gintin,0
Dpoke Gintin+2,0
Gemsys 112
Tree%=Lpeek(Addrout)
Now the variable Tree% contains the adress at which the resource
is located in memory.
Now you have to center the form in the screen:
Lpoke Addrin,Tree%
Gemsys 54
Now the whole form is ready for use.
You can draw the form on the screen:
Lpoke Addrin,Tree%
Dpoke Gintin,0
Dpoke Gintin+2,7
Dpoke Gintin+4,0
Dpoke Gintin+6,0
Dpoke Gintin+8,640
Dpoke Gintin+10,400
Gemsys 42
By this gemsys the form is only drawn to the screen. Nothing else
is done with it.
You can activate the form:
Lpoke Addrin,Tree%
Dpoke Gintin,-1 (or the object number which is editable)
Gemsys 50
Now GEM takes over until the user clicks on a touchexit or an exit
box. After such a box is selected basic takes over again.
You can obtain the number of the selected box:
Out%=Dpeek(Gintout)
The variable Out% now contains the object number. In the list you
merged to your program you can find the name belonging to that
number.
If an object is selected is is automatically inverted. You can re-
invert it:
Dpoke Tree%+Out%*24+10,Dpeek(Tree%+Out%*24+10) And (65534)
Now you can do something as a reaction to the selected object, and
the redraw and reactivate the form again.
All this looks probably rather difficult to you, but I assure you
itt is in fact quite easy. It is though a bit hard to learn it
from a text file.
You can now better load GfA basic an try the program I mentioned
above. After a bit playing with the program I'm sure you'll
understand it.
I wish you good luck in the world of GEM.
You can reach me at:
STRIKE-a-LIGHT software
Robert Heessels
Grote Berg 85
5611 KJ Eindhoven
The Netherlands.
Disclaimer
The text of the articles is identical to the originals like they appeared
in old ST NEWS issues. Please take into consideration that the author(s)
was (were) a lot younger and less responsible back then. So bad jokes,
bad English, youthful arrogance, insults, bravura, over-crediting and
tastelessness should be taken with at least a grain of salt. Any contact
and/or payment information, as well as deadlines/release dates of any
kind should be regarded as outdated. Due to the fact that these pages are
not actually contained in an Atari executable here, references to scroll
texts, featured demo screens and hidden articles may also be irrelevant.