[comp.graphics] Objects on VT100

POPX@vax.oxford.ac.uk (Jocelyn Paine) (04/29/91)

Newsgroups: comp.graphics
Subject: Objects on VT100
Summary:
Expires:
Sender:
Reply-To: popx@vax.ox.ac.uk (Jocelyn Paine)
Followup-To:
Distribution: comp.graphics
Organization: Experimental Psychology, Oxford University, UK.
Keywords:

I wonder whether anyone can suggest how to solve what ought to
be a very simple problem - involving nothing more complicated than
text on a VT100!

I want to display a number of simple objects moving around on a plane.
There's a function mapping each object to an image - images are represented
as relative coordinates of cursor addresses, and the character to be drawn
at each address. Many (but not all) of the objects just occupy one square,
and so have an image consisting of one single character.

Objects can move around. When each object moves, I want to delete its old
image from the screen, and redraw at the object's new position. The
complication is that objects can overlap, and I want to draw always the latest
object to move to a given location. And objects may move over one
another in a non-stack fashion, so I can't just push and pop the
characters currently held at each location.

Thus:
    Objects O1, O2, and O3 have images '11', '2', and '3'
respectively.                       

    O1 moves to x,y:           11  <- You see this at x,y

    O2 moves to x,y:           12

    O3 moves to x,y:           13

    O1 moves elsewhere:         3

    O3 moves elsewhere:         2

    O2 moves elsewhere:

I need this for some portable software which has to be able to work on a
VT100 if there's nothing better available. This is _not_ a question
about how to control the beasts, but a request for ideas on how best
to save and restore information about what's been overdrawn.

Thanks for any help

                                Jocelyn Paine
                                Experimental Psychology
                                Oxford