Author Topic: What BackgroundColourNumber should I use to make a transparent GUI?  (Read 301 times)

bx83

  • Get 'Er Doooooone
And there it is. I just want to make a transparent GUI for use in a custom dialogue system - at the moment, it shows as white (BackgroundColour/BackgroundColourNumber etc. are all 0's).

Khris

  • having to deal with what games are going through
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on a game that was nominated for an AGS Award!
Given that you want to use it for Dialogs, did you create it as TextWindow GUI? If so, have you assigned any images to the 4 corners / 4 edges / background?

Transparent is 0, so there might be something else involved here.

bx83

  • Get 'Er Doooooone
This is it. (ignore the cursor)


bx83

  • Get 'Er Doooooone
And this is the window in game (down the bottom).
I'd like for it be translucent (instead of solid white) so I can see what's behind it.


bx83

  • Get 'Er Doooooone
And here is the code in GlobalScript:

Code: [Select]

//----------------------------------------------------------------------------------------------------------------------
// DIALOG
//----------------------------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Get Dimensions
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_get_dimensions(DialogOptionsRenderingInfo* info)
{

// Create a 1024x64 dialog options area at (0,704)

  info.X = 0;
  info.Y = 704;
  info.Width = 1366;
  info.Height = 64;
}

//----------------------------------------------------------------------------------------------------------------------
// Draw Dialog Options
//----------------------------------------------------------------------------------------------------------------------

function DrawDialogOptions(DrawingSurface* ds, DialogOptionsRenderingInfo* info)
{
  int i = 1, ypos = 0, xpos = 0;
  ds.Clear(15);
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      String str = info.DialogToRender.GetOptionText(i);
      int cur_img = str.AsInt;
      ds.DrawImage(xpos, ypos, cur_img);
      xpos += 64;
    }
    i++;
  }
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Render
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_render(DialogOptionsRenderingInfo* info)
{
  DrawDialogOptions(info.Surface, info);
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Repeat Exec
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_repexec(DialogOptionsRenderingInfo* info)
{
  int i = 1, xpos = 0;
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      if (mouse.y >= info.Y && mouse.x >= xpos && mouse.x <= xpos+64)
      {
        info.ActiveOptionID = i;
        return;
      }
      xpos += 64;
    }
    i++;
  }
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Mouse Click
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_mouse_click(DialogOptionsRenderingInfo* info, MouseButton button)
{
  if (info.ActiveOptionID > 0)
  {
    MyDynamicSpriteForTheFakeGUI = DynamicSprite.Create(info.Width, info.Height, true);
    DrawingSurface* ds = MyDynamicSpriteForTheFakeGUI.GetDrawingSurface();
    DrawDialogOptions(ds, info);
    ds.Release();

    gFakeDialogOptions.BackgroundGraphic = MyDynamicSpriteForTheFakeGUI.Graphic;
    gFakeDialogOptions.Visible = true;
    info.RunActiveOption();
  }
}

// END DIALOG FUNCTIONS

The dialog was originally for 1024x768 backgrounds, now 1366x768.
It's used with 64x64 conversation images.

Khris

  • having to deal with what games are going through
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on a game that was nominated for an AGS Award!
You have
ds.Clear(15);

15 is white. Use 0 instead, or COLOR_TRANSPARENT.

selmiak

  • ǝsıɔɹǝxǝ ʞɔǝu puɐ uıɐɹq
    • I can help with play testing
    • I can help with proof reading
    • I can help with translating
    • I can help with web design
    • selmiak worked on a game that won an AGS Award!
    •  
    • selmiak worked on a game that was nominated for an AGS Award!
That screenshot looks pretty cool and reminds me of some timetraveling adventures :)

bx83

  • Get 'Er Doooooone
Thanks Khris :)
Selmiak, I have no idea what you're takling about ;)