Tuesday, March 4, 2008

Drawing Surfaces

AGS 3.0 introduces a new type to the game author called the DrawingSurface which allows you to do the equivalent of RawDraw commands on an object other than the current Background. You can also use it for the background, too.

Previously, if you wanted to modify a sprite on the fly or do any complex drawing you had to save the background, clear it to the "magic pink" colour that turns transparent when grabbed, do your drawing, grab a dynamic sprite and then redraw the background how it was. This wasted time and could make things slower than they needed to be. The Drawing Surface concept lets you draw onto a Dynamic Sprite directly. Not only that, but it adds the ability to use hi-res co-ordinates within that sprite instead of the standardized 320x240 co-ordinates, if you wish. Further capabilities are added in the 3.01 beta where you can also grab the colour of a pixel within the drawing surface, just like the eyedropper tool in a paint program.

Modules like my Hypertext module, which allowed fonts to change in the middle of a piece of text (amongst other things) used the drawing-on-the-background extensively in version 2.72 but now they can be much more efficient and organised, and draw on dynamic sprites, which is great. If only I could get around to updating the module... and all the others that are affected by this: like SimpleSnow, SimpleRain, SpriteFont and Shadow...

1 comment:

  1. Hi SSH,

    it's some days I'm getting crazy trying to port your beatiful Star Wars scroller module to AGS version 3.2.1, but I'm not an expert and the best I was able to do is to succeed in making it work with a one color background, but I have problem if the background is an image or not one color.

    Could you help me ?


Please keep comments clean: foul language means your comment will not get published. Sorry for the captcha, was getting to much spam.