At 11:12 AM -0600 12/14/04, Dobbs, Paul wrote:
I am building an application to train people how to use a new signaling
system at a model railroad club I belong to. It's basically a simulation
of a part of a railroad.
Sounds neat!
Now, I need to add the signals. (Sort of like traffic signals, only
green is on top!) I can either add them as sprites or on the background.
They don't move, but their appearance changes. If I put them on the
background, I need to somehow have them redrawn when the lights change.
How do I do this?
You'd call SpriteSurface.PaintTile, which then invokes your PaintTile
event, where you can draw the appropriate image. This is not the
approach I'd recommend, though -- make them sprites instead.
Is redrawing them on the background picture sufficient? (It doesn't
seem like it should be.)
That'll work, but it's very inefficient -- it'll force the whole
SpriteSurface to be drawn.
I noticed in the
language reference that there is a PaintTile method. Is this what I use?
If so, how do the parameters (X and Y) relate to the position in the
background of my signal?
The parameters are which tile you want redrawn. Tiles are 64x64, so
divide your signal position by 64, then round both up and down to
find the range of tiles (could be 1, 2, or 4 of them) that need to be
repainted. Then conclude that this is all too much work, and make
your signals sprites instead. :)
Best,
- Joe
--
REAL World 2005 - The REALbasic User Conference
March 23-25, 2005, Austin, Texas
<http://www.realsoftware.com/realworld>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|