8,018
edits
Paradox-01 (talk | contribs) (+ mouse cursor) |
Paradox-01 (talk | contribs) (Button styling and scaling) |
||
Line 589: | Line 589: | ||
====Widgets==== | ====Widgets==== | ||
[[Image:ue4_open_close_a_menu_widget.jpg|400px|right|thumb|Before "IsVisible" can use a reference, it had to be given data, e.g. at BeginPlay. See second image for details.]] | [[Image:ue4_open_close_a_menu_widget.jpg|400px|right|thumb|Before "IsVisible" can use a reference, it had to be given data, e.g. at BeginPlay. See second image for details.]] | ||
[[Image:ue4_create_widget_ref_after_BeginPlay.jpg|400px|right|thumb|Creating a menu reference at BeginPlay. Reminder: "Cast To ..." node is used to get variables from another blueprint.]] | <!--obsolete with IsValid node [[Image:ue4_create_widget_ref_after_BeginPlay.jpg|400px|right|thumb|Creating a menu reference at BeginPlay. Reminder: "Cast To ..." node is used to get variables from another blueprint.]]--> | ||
Any key can be used to open a menu. But when the game gets paused too then pressing the same key again cannot close the menu. | Any key can be used to open a menu. But when the game gets paused too then pressing the same key again cannot close the menu. | ||
You need to set the key's property "Execute when Paused" to true. | You need to set the key's property "Execute when Paused" to true. | ||
Also, in theory a "Flipflop" node would work but has proven unreliable. | Also, in theory a "Flipflop" node would work but has proven unreliable. Instead, a reference to the menu instead, an "Is Visible" and a "Branch" (if) node will do the trick. Additionally, an Is Valid node is placed to catch an error when the reference is used for the very first time. | ||
We can capture the mouse within the game application if we place an "Set Input Mode Game And UI" node with "Lock Always" option. | |||
=====Button and section images===== | |||
[[Image:ue4PauseMenuButtonsDisabled.jpg|400px|right|thumb]] | |||
'''Styles''' | |||
Buttons have 4 styles: Normal, Hovered, Pressed, Disabled. | |||
For now lets use only 2 texture: one for Normal, one for Hovered and Pressed. | |||
The Disabled style just uses a tint color on the Normal texture with an RGBA of 000000FF. | |||
Buttons can be disabled via Set Is Enabled (Target is Widget). You can get button references from the Graph window. | |||
[[Image:ue4PauseMenuButtonsDisabledInGame.jpg|400px|right|thumb]] | |||
'''Scaling''' | |||
When you place a Grid Panel into the widget you can define columns and rows. Buttons and other elements can adapt to their given space. | |||
You probably want to set button texture property Draw As to Image. | |||
For standalone images Draw As Border can be used if the image is big enough. This will work like Oni's [[XML:PSpc]] where only specific sections of the image are scaled. | |||
For extreme different resolutions we might need to bind different textures so Draw As Border won't produce empty spaces in the center. | |||
====Animations==== | ====Animations==== |
edits