BUG - DrawLine [SOLVED]

Started by magintz, Sun 01/06/2008 23:19:22

Previous topic - Next topic

magintz

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.



Code: ags

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.
When I was a little kid we had a sand box. It was a quicksand box. I was an only child... eventually.

Rui 'Trovatore' Pires

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.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Pumaman

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();

magintz

Thanks, I guess that makes sense :)
When I was a little kid we had a sand box. It was a quicksand box. I was an only child... eventually.

SMF spam blocked by CleanTalk