Wolfgang Uhlig writes:

<>
> Isn't there a possibility to "make" a sprite out of the string "on the
> fly"? Possibly with a background-system-colour?
> I know that there is something like blobs and patterns but I have
> never understood how this works.
>
> I'd like that very much and think it would make drag&drop routines much
> more attractive and clear.

Provided the text item you wish to convert is already visible on screen this
is not difficult, just a little fiddly.

If its not visible it would probably be about as difficult to do as writing
a winprinter driver for the QL..., ie not exactly trivial!

Per

I thought Id have a go just to demonstrate:

The routine below is not guaranteed to be bug-free, so save your work before
testing!

This is just a test and not designed to be universal. It will need some
modifications if you are not using QPC2 with GD2!

To test, start an instance of SBasic in the top lefthad corner of your
screen. Print some text in window#2, eg LIST this program, then RUN it. If
you dont have EasyPtr you'll need to change SPRW on line 330 to some other
keyword to draw the sprite

100 s = SCR_BASE + SCR_LLEN + 4       : rem Start at top left of screen
110 xs = 100: ys = 10                 : rem X/y size
120 pixw = xs * 2                     : rem Pixel words
125 CLS
130 :
140 a = ALCHP(24 + (pixw + xs) * ys)
150 POKE_L a, $2200020                : rem Mode 32 sprite w alpha channel
160 POKE_W a + 4, xs: POKE_W a + 6, ys: rem Create sprite header
170 POKE_L a + 8, 0
180 POKE_L a + 12, 12
190 POKE_L a + 16, 8 + pixw * ys
200 POKE_L a + 20, 0
210 t = a + 24                        : rem Target address for sprite data
220 :                                 : rem Create sprite, line at a time
230 FOR i = 1 TO ys
240  POKE$ t, PEEK$(s, pixw)
250  s = s + SCR_LLEN
260  t = t + pixw
270 END FOR i
280 :                                 : rem Create mask (ghost)
290 FOR i = 1 TO xs * ys
300  POKE t, 128: t = t + 1
310 END FOR i
320 :
330 SPRW #1, 10, 50, a                : rem Draw sprite using EasyPtr
340 SBYTES_O 'ram1_txt_spr', a, 24 + (pixw + xs) * ys: rem Save sprite
350 RECHP a



Reply via email to