Modding:GUIs: Difference between revisions

From Vintage Story Wiki
Add examples of GuiElementDialogBackground
(→‎Dialog Outline Modes: show the image in frame mode so that the caption is included)
(Add examples of GuiElementDialogBackground)
Line 190: Line 190:
* <code>.BeginClip</code>/<code>.EndClip</code>: Used in combination with a scrollbar to cut away oversized content, such as in the creative inventory
* <code>.BeginClip</code>/<code>.EndClip</code>: Used in combination with a scrollbar to cut away oversized content, such as in the creative inventory
* <code>.AddStaticCustomDraw</code>: Lets you define your own drawing code to be added to the GUI
* <code>.AddStaticCustomDraw</code>: Lets you define your own drawing code to be added to the GUI
== GuiElements ==
To better show what is rendered by the GuiElements, the screenshots shown below were taken with dialog outlines enabled.
=== GuiElementDialogBackground ===
Draws a pretty background and dialog border. The background is drawn on both the padding and content boxes. Typically one uses <code>ElementBounds.Fill</code> (with padding optionally set) to set the background for the entire dialog. Although it is technically possible to use smaller bounds. The <code>withTitleBar</code> does not actually draw the title bar, but instead moves the top of the background box down to make room for the title bar.
GuiComposer factory functions:
* <code>.AddShadedDialogBG(ElementBounds bounds, bool withTitleBar = true, double strokeWidth = 5.0, float alpha = 0.75f)</code>
* <code>.AddDialogBG(ElementBounds bounds, bool withTitleBar = true, float alpha = 1f)</code>
<gallery>
File:AddDialogBG.png|class=pixelated|AddDialogBG with a bounding box set to the entire dialog. The blank space at the top is due to the withTitleBar=true parameter.
File:AddShadedDialogBG.png|class=pixelated|thumb|none|AddShadedDialogBG with a bounding box set to the entire dialog. The blank space at the top is due to the withTitleBar=true parameter.
File:AddShadedDialogBG_with_position_offset.png|class=pixelated|thumb|none|AddShadedDialogBG with a bounding box less than the entire dialog. In this case the blur from AddShadedDialogBG is offset incorrectly. AddDialogBG works correctly (not shown).
</gallery>


== Example ==
== Example ==
Confirmedusers
261

edits