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).
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.
This is it. (ignore the cursor)
(http://redrom.ltd/img/dialoggui.png)
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.
(http://redrom.ltd/img/convowindow.png)
And here is the code in GlobalScript:
//----------------------------------------------------------------------------------------------------------------------
// 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.
You have
ds.Clear(15);
15 is white. Use 0 instead, or COLOR_TRANSPARENT.
That screenshot looks pretty cool and reminds me of some timetraveling adventures :)
Thanks Khris :)
Selmiak, I have no idea what you're takling about ;)