Folks,
I am currently getting myself accustomed again to programming using the
pointer interface after years of inactivity.
I would like to hear how the cracks would tackle a problem I have where
I have some alternative solutions for.
(My programs are SuperBasic, liberated or Turbo-ed)
How do you draw graphics in the pointer coordinate system (a typical
application would be things like rubber-banding or a shape drawing
program)? The options I currently see are as follows:
1. Use the Graphics coordinate system - Here I find it next to
impossible to find a perfect match between pixel coordinates and
graphic coordinates using SCALE (Or am I just doing something
wrong?). I'm doing something like SCALE #channel,windowHeight%,
0, 0 and POINT x,y-windowHeight%. This (at least sometimes) hits
the spot, but not with acceptable accurracy - the point plotted is
always a bit off the pointer position. Advantage is, you can use
INK, PAPER, and he like and have all the graphics drawing for
circles and arcs available
2. Use BLOCK - this hits the spot perfectly, because it uses pixel
coordinates. You can also take advantage of INK and PAPER and the
like, but need to write your own routines for drawing shapes,
rectangles, arcs, lines. This could end up in a huge pile of work,
the program could also tend to be slow with implementation of
these primitives in SuperBASIC.
3. Use the "Draw line of blobs/sprite" functionality from PE. Uses
the pixel coordinate system, so we'd be safe with pixel accuracy -
Cannot use INK, PAPER and the like, because you define the colour
in the sprite. You'd need to have an assortment of pixel-sized
sprites in order to be able to draw in different colours. Shapes
like rectangles and circles are not available as well and need to
be emulated.
4. Use own, machine code-based SuperBasic extensions to plot and draw
in the pixel coordinate system. Not sure whether I would want to
tackle this one, especially if I want my program to be able to run
both on "standard" QLs and GD2-Based systems (Or is there
something already available - I'm not aware of such an extension -
There was an article in an old QL world, part of the DIY toolkit,
but this would hardly work in a GD2-based environment.
What's common practice? Like to hear some recommendations.
Regards
Tobias
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm