Official continuation of Destination Sol, the great fun little arcade space shooter from http://sourceforge.net/projects/destinationsol/ Modules live at https://github.com/DestinationSol/
Apache License 2.0
330
stars
122
forks
source link
New NUI widgets (`EmptyIfInvisibleContainer`, `UIBackingBox` and `UILabelledIcon`) #664
This pull request adds some now NUI widgets that will be used in when porting the remaining built-in UI screens to use NUI. It also makes some minor changes to the default UILoadBar style, which was unnecesarily constraining the size of load bars.
EmptyIfInvisibleContainer
This widget acts like a standard wrapper container, with the special case that if either its contents is empty or invisible, then it will report its own size as zero.
UIBackingBox
This widget acts like a standard UIBox, with the added functionality of consuming all mouse click events targeted within its area. This prevents mouse click events from propagating to layers beneath the box.
UILabelledIcon
This widget allows the user to display an icon alongside a descriptive label, such as might be used in a HUD to display brief player statistics, The icon can be placed either to the left or the right of the label.
Testing
There are some basic test screens for this in my temporary nuiExperiments module. You'll need to fetch that into your workspace first. When asked to open a screen, open it using the showNUIScreen <screenUrn> command.
EmptyIfInvisibleContainer
Open the nuiExperiments:emptyIfInvisibleContainers screen.
Toggle the Show checkbox off.
One of the buttons should become invisible.
When the button is invisible, all adjacent buttons should shift along to fill the space previously occupied by that button.
Toggle the Show checkbox on.
One of the buttons should become visible again.
UIBackingBox
Open the nuiExperiments:uiBackingBoxes screen.
Try clicking on the background (outside of any boxes). The background click counter should increase.
Try clicking on the blue box. The background click counter should still increase.
Try clicking on the black box. The background click counter should not increase.
UILabelledIcon
Open the nuiExperiments:uiLabelledIcons screen.
There should be three labels present. One with an icon to the left of it, the other with an icon to its right and at the top a label with no icon associated.
Notes
The UIBackingBox test is unlikely to succeed without #663, since it fixes mouse events previously not being consumed.
The game may crash when closing a screen with the escape key. This is an unrelated issue regarding NUI screens outside of the engine not being correctly injected.
Description
This pull request adds some now NUI widgets that will be used in when porting the remaining built-in UI screens to use NUI. It also makes some minor changes to the default
UILoadBar
style, which was unnecesarily constraining the size of load bars.EmptyIfInvisibleContainer
This widget acts like a standard wrapper container, with the special case that if either its contents is empty or invisible, then it will report its own size as zero.
UIBackingBox
This widget acts like a standard
UIBox
, with the added functionality of consuming all mouse click events targeted within its area. This prevents mouse click events from propagating to layers beneath the box.UILabelledIcon
This widget allows the user to display an icon alongside a descriptive label, such as might be used in a HUD to display brief player statistics, The icon can be placed either to the left or the right of the label.
Testing
nuiExperiments
module. You'll need to fetch that into your workspace first. When asked to open a screen, open it using theshowNUIScreen <screenUrn>
command.EmptyIfInvisibleContainer
nuiExperiments:emptyIfInvisibleContainers
screen.Show
checkbox off.Show
checkbox on.UIBackingBox
nuiExperiments:uiBackingBoxes
screen.UILabelledIcon
nuiExperiments:uiLabelledIcons
screen.Notes
UIBackingBox
test is unlikely to succeed without #663, since it fixes mouse events previously not being consumed.