The help file is clear enough on how to draw a string to the background, but I'm not as sure about how to "change" the message I've written out. I'd need a way to erase the previous text, but Clear() actually wipes out the drawing surface (room background image and all). Is there a good tutorial somewhere on how to do this? If I could just see some simple, working examples in action I'd probably get it...
You need to make a backup of the room background before drawing to it.
// top of room script
DynamicSprite*backup;
// in room_Load
backup = DynamicSprite.CreateFromBackground();
Now you can draw backup to the room's background to "clear" it before drawing the changed message on top.
The approach makes sense, but can't figure out how to draw the dynamic sprite... the closest match I can find is "DrawSurface", which doesn't seem to accept a DynamicSprite:
count = count +1;
DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
surface.DrawSurface(backup); // compile error here; can't use DynamicSprite
surface.DrawingColor = 14;
surface.DrawString(0, 100, Game.NormalFont, String.Format("Test %d", count));
surface.Release();
Also, while I was trying to find a method that would work, I came across this in the help file:
DrawingSurface *mainBackground = Room.GetDrawingSurfaceForBackground(0);
DrawingSurface *nightBackground = Room.GetDrawingSurfaceForBackground(1);
mainBackground.DrawSurface(nightBackground, 50);
mainBackground.Release();
nightBackground.Release();
Would this approach allow me to accomplish the same thing, albiet with surface.DrawSurface? If so, is there an advantage to using the DynamicSprite approach vs. the DrawingSurface approach, or vice versa?
A DrawingSurface is only a middleman you need to change an existing image, to make an actual backup as in store image data, you need a DynamicSprite.
For DrawingSurface.DrawSurface(a) to work, a must be the DrawingSurface of an actual sprite, so it's really just a shortcut.
The command you're looking for is:
surface.DrawImage(0, 0, backup.Graphic);
Ah, that worked quite nicely. Thanks again!