Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Ali on Tue 30/06/2009 09:59:48

Title: Problem setting transparency on GUIs in AGS 3.1 (Solved!)
Post by: Ali on Tue 30/06/2009 09:59:48
Hi,

I recently imported the tech demo of Nelly II into AGS 3.1 and the GUIs no longer fade in and out correctly. They appear to 'flash' because 100% transparency is rendered as solid white which fades away to reveal the GUI. This happens where the GUIs have alpha channels and where they do not.

The same thing occured when I replaced my code with the new Tween module. I couldn't find this problem when searching, I'd be grateful for any help.

- Ali
Title: Re: Problem setting transparency on GUIs in AGS 3.1
Post by: Gilbert on Tue 30/06/2009 10:35:26
Can you post here the part of codes responsible for the effect? From the change log I see that there're some changes/fixes related to transparencies, that may or may not be related, so it might be possible that you need some code modifications.
Title: Re: Problem setting transparency on GUIs in AGS 3.1
Post by: Ali on Tue 30/06/2009 11:18:28
This is the code I used:

    gBubble.Transparency=100;
    gBubbleUnderlay.Transparency=100;
   
    gBubble.Visible=true;
    gBubbleUnderlay.Visible=true;

    while (bubbleTrans>15){
       
      bubbleTrans=bubbleTrans-15;
     
      if (bubbleTrans<15) bubbleTrans=15;
     
      gBubble.Transparency=bubbleTrans;
     
      gBubbleUnderlay.Transparency=bubbleTrans;
           
      Wait(1);
    }


But I tried replacing it with the Tween module's function to the same effect. I should mention that these two GUIs overlap, in case that is relevant. One has a solid background (to allow anti-aliased text) and the other surrounds it with alpha channeled edges to create a speech bubble effect.
Title: Re: Problem setting transparency on GUIs in AGS 3.1
Post by: Gilbert on Tue 30/06/2009 14:04:10
Seems okay to me.
What value was bubbleTrans initially set to?
Title: Re: Problem setting transparency on GUIs in AGS 3.1
Post by: Vince Twelve on Tue 30/06/2009 16:49:15
I had a similar issue in an early version of AGS 3.0, but I thought it was fixed.  The issue was that I was starting the GUI with an 8 bit graphic, then when the game was started, that GUI was created as an 8 bit graphic, so when I would then change it to something with alpha transparency, it would render all the alpha as solid white, assuming it was still 8 bit.  I'm not sure if that's what's happening here, but it could be worth checking if you're setting the background graphic of the GUI to an 8 or 16 bit sprite at some point.
Title: Re: Problem setting transparency on GUIs in AGS 3.1
Post by: Ali on Tue 30/06/2009 23:10:16
Thanks for the responses guys. bubbleTrans was 100.

I should mention that this code worked correctly in AGS 3.0. It's only with 3.1 that this odd problem occurs. Also the effect also works in DX5 mode.

Giving the text GUI a 32 bit backdrop prevents makes the text display with weird edges. Giving the surrounding bubble GUI a 32 bit backdrop makes it simply appear instead of fading in.

Please let me know if this helps explain the problem.
Title: Re: Problem setting transparency on GUIs in AGS 3.1
Post by: GarageGothic on Thu 02/07/2009 22:42:32
Variable transparency for alpha channel sprites wasn't supported until version 3.1.2, so if that's what you want you need to update your editor. That shouldn't be a problem for non-alpha sprites though, but if they're 32-bit perhaps AGS deals with them as if they did have an alpha channel.
Title: Re: Problem setting transparency on GUIs in AGS 3.1 (Solved!)
Post by: Ali on Fri 03/07/2009 19:33:17
Updating the editor was the answer. Thanks GarageGothic, I'd missed version 3.1.2.

Transparent GUIs here I come!