Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: De-Communizer on Mon 03/05/2010 14:02:05

Title: Drawingsurface and backgrounds...
Post by: De-Communizer on Mon 03/05/2010 14:02:05
The manual doesn't seem to be particularly forthcoming about it (or I'm being dense), but does the drawing surface make things appear underneath or over the top of characters? If I tell it to draw a yellow circle on the screen, is that going to stay there on top of any characters and objects, or does it look like it's just affecting the background? Otherwise, is there any means of just keeping things done on the drawingsurface in the background?

Incidentally, since I'm just starting out with it, are there any decent tutorials for the drawingsurface? Everything I've found so far seems to be obsolete (referring to everything as "rawdraw"), or doesn't answer my questions.
Title: Re: Drawingsurface and backgrounds...
Post by: Khris on Mon 03/05/2010 14:17:55
If you draw on the background, the changes appear underneath characters and objects. To draw above them, use a GUI's background graphic.

There aren't any tutorials I'm aware of but it's not that hard to use the commands.
If you want to manually animate a room's background, the code would look like this:

// top of room script

DrawingSurface*backup;

// inside room_Load

  DrawingSurface*ds = Room.GetDrawingSurfaceForBackground();
  backup = ds.CreateCopy();
  ds.Release();

// inside repeatedly_execute

  DrawingSurface*ds = Room.GetDrawingSurfaceForBackground();
  ds.DrawSurface(backup);  // restore original image

  ds.DrawWhatever();   // draw animation on top

  ds.Release();
Title: Re: Drawingsurface and backgrounds...
Post by: De-Communizer on Tue 04/05/2010 05:25:27
Ah, brilliant - that was exactly what I was lookingf for. Many thanks!
Title: Re: Drawingsurface and backgrounds...
Post by: De-Communizer on Sat 08/05/2010 12:42:30
Ah, one last question on this - you say I need to use a GUI's background graphic for drawing above. Firstly, what would I do to accomplish this rather than drawing on the background?

Secondly, does this mean that things drawn on the GUI background have a position based on the screen, rather than the room?
Title: Re: Drawingsurface and backgrounds...
Post by: Calin Leafshade on Sat 08/05/2010 13:12:09
things drawn to the background are always BEHIND the player, GUIs are on top.

and the answer to question 2 is a simple yes.
Title: Re: Drawingsurface and backgrounds...
Post by: De-Communizer on Sat 08/05/2010 14:45:28
I understand that the things drawn on the background appear under, and things on the GUI appear over, but I'm still unclear as to the means by which I draw on the GUI rather than the background using drawingsurface. Is this akin to using something other than "GetDrawingSurfaceForBackground"?
Title: Re: Drawingsurface and backgrounds...
Post by: Khris on Sun 09/05/2010 17:53:27
You can't directly draw onto a GUI, you need to declare a (global) DynamicSprite, draw to it, then set it as the GUI's .BackgroundGraphic.