Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: fireapache on Sun 18/11/2012 08:46:04

Title: DrawImage doesn't work!
Post by: fireapache on Sun 18/11/2012 08:46:04
Hey people! I don't understand why this simple DrawImage doesn't work:

Code (AGS) Select
// room script file

Overlay *overlay;
DynamicSprite *sprite;
DrawingSurface *surface;

function After_FadeIn()
{
  sprite = DynamicSprite.Create(320, 240, true);
  surface = sprite.GetDrawingSurface();
  surface.Clear();
  surface.DrawImage(160, 160, 35);
  surface.Release();
  overlay = Overlay.CreateGraphical(0, 0, sprite.Graphic, true);
}


Nothing happens!

The sprite on slot 35 is a cursor with an alpha channel:

(http://imageshack.us/scaled/avatar96/844/28825828.png) (http://imageshack.us/a/img844/1205/28825828.png) (http://imageshack.us/scaled/avatar96/534/27970964.png) (http://imageshack.us/scaled/avatar96/534/27970964.png)

... my project is running in 32-bit colour.
Title: Re: DrawImage doesn't work!
Post by: Calin Leafshade on Sun 18/11/2012 09:59:16
does After_FadeIn() actually run? I dont think thats the default name for the function so did you create it with the editor events pane? or did you just type the function in manually?
Title: Re: DrawImage doesn't work!
Post by: fireapache on Sun 18/11/2012 10:53:10
Yes, it's run, I did write "After_FadeIn" in the events panel of that room.
Title: Re: DrawImage doesn't work!
Post by: fireapache on Sun 18/11/2012 11:30:47
Actualy, I think there's a problem in the engine. I say that because I imported the same sprite again but telling AGS to do not use the alpha channel of the PNG and it worked!

Code (AGS) Select
surface.DrawImage(160, 160, 37);
[imgzoom]http://imageshack.us/a/img231/1298/34730502.png[/imgzoom]

buuut... The transparency in DrawImage never worked, for both situations and graphic drivers - DirectDraw 5 and Direct3D 9.
Title: Re: DrawImage doesn't work!
Post by: Slasher on Sun 18/11/2012 15:49:52
Quote from: Calin Leafshade on Sun 18/11/2012 09:59:16
does After_FadeIn() actually run? I dont think thats the default name for the function so did you create it with the editor events pane? or did you just type the function in manually?
You should do this via the Rooms events panel
Title: Re: DrawImage doesn't work!
Post by: fireapache on Sun 18/11/2012 22:14:10
[imgzoom]http://imageshack.us/a/img801/7742/59679850.png[/imgzoom]