Let's follow a few simple steps:
<engine root>GameLibsUIUIElements
folder, and create a new XML file (for example NewHUD.xml
).<UIElements>
tag and ends with a </UIElements>
tag. Within this tag, you can define your UIElements. Add a new <UIElement>
definition for your new HUD:<UIElements name="HUD"> <UIElement name="NewHUD" render_lockless="1"> <GFx file="NewHUD.swf" layer="1"> <Constraints><Align mode="dynamic" valign="center" halign="center"scale="1" max="0" /> </Constraints> </GFx> </UIElement> </UIElements>
This is the basic layout for a new UIElement with the name NewHUD
. Within the <GFx>
tag you need to define the actual SWF file. Additionally, you can define a layer for this element. If more than one element is visible at the same time, the layer will define in which order those elements are drawn.
Within the <Constraints>
tag, we can define an alignment for this element. In our case, we want to have dynamic alignment with halign="center"
and valign="center"
. With this alignment, the Flash asset will always be centered. With the scale="1"
flag, the element is automatically scaled to always fit the current resolution without losing its aspect ratio.
By defining the UIElement in the XML file, we announced the new HUD to CryENGINE. It is now possible to display the HUD via Flow Graph. Since we also want to expose the textfields and ActionScript functions, we have to extend the XML file in the next step first, before we can create the Flow Graph to display the new HUD.
3.144.33.41