Time for action – bringing your Flash asset into CryENGINE 3

Let's follow a few simple steps:

  1. The first thing we need is an XML file for the newly created Flash asset. Go to the <engine root>GameLibsUIUIElements folder, and create a new XML file (for example NewHUD.xml).
  2. The layout of the XML file is pretty easy. Each XML can have multiple Flash assets defined. It starts with a <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.

What just happened?

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.33.41