Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: magintz on Sun 01/06/2008 23:19:22

Title: BUG - DrawLine [SOLVED]
Post by: magintz on Sun 01/06/2008 23:19:22
Within the Hotspot description field when I press the space bar it zooms in the background instead of inserting a space.

The DrawLine function fails to draw a complete line some of the time and seems broken and unfinished. My code uses the draw line and then waits 100 followed by releasing the surface. I'm using a function to draw this several times (Whenever the player presses a button. The first time it is done it works fine, after that it doesn't.

Here's an example and some code.

(http://www.sanslife.com/temp/lasers.png)


DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
DrawingSurface *backup = Room.GetDrawingSurfaceForBackground(1);
surface.DrawingColor = 45153;
surface.DrawLine(212, 22, endX, endY);
Wait(100);
surface.DrawSurface(backup);
Wait(1);
surface.Release();
backup.Release();


Using AGS 3.01 Stable

EDIT: I've overcome this bug by replacing my Wait(100) with a SetTimer() command with a IsTimerExpired() within the repeatedly execute of the page, it causes no problems in the game but seems a little long winded.
Title: Re: BUGS - DrawLine & Hotspots
Post by: Rui 'Trovatore' Pires on Mon 02/06/2008 00:09:49
QuoteWithin the Hotspot description field when I press the space bar it zooms in the background instead of inserting a space.

That one's been reported and fixed.
Title: Re: BUG - DrawLine
Post by: Pumaman on Mon 02/06/2008 18:37:49
This is because you've got to Release the surface before you attempt to display it -- otherwise, the changes you've made won't be committed.

For example:

DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
DrawingSurface *backup = Room.GetDrawingSurfaceForBackground(1);
surface.DrawingColor = 45153;
surface.DrawLine(212, 22, endX, endY);
surface.Release();
Wait(100);
surface = Room.GetDrawingSurfaceForBackground();
surface.DrawSurface(backup);
Wait(1);
surface.Release();
backup.Release();
Title: Re: BUG - DrawLine [SOLVED]
Post by: magintz on Mon 02/06/2008 21:07:02
Thanks, I guess that makes sense :)