Need help with font-icon coding

isnorden

Amnesiac Modder
Joined
Jul 6, 2012
Messages
608
Location
Madison, Wisconsin, USA
I'm currently trying to update my "Brewery and Mead Hall" mod with some related resources (see the attached file). Although I plan to code in some other things I haven't defined yet (like the Resource Generator definitions, and a unique replacment for Circus Maximus :viking: ), my main concern here is getting the font icons to work. I've never included new font icons as part of a mod before; although I've got a .DDS file ready, it's the matching .xml and .ggxml that confuses me. All four new resources fit onto the first row of a 4x4 atlas, but where do I go from there?
 
Code:
	<IconFontTextures>
		<Row>
			<IconFontTexture>ICON_FONT_TEXTURE_CCTP</IconFontTexture>
			<IconFontTextureFile>CCTPFontIconAtlas</IconFontTextureFile>
		</Row>
	</IconFontTextures>
This part names(IconFontTexture) and also points to your new font atlas(IconFontTextureFile).
Code:
	<IconFontMapping>
		<Row>
			<IconName>ICON_RES_MANGO</IconName>
			<IconFontTexture>ICON_FONT_TEXTURE_CCTP</IconFontTexture>
			<IconMapping>1</IconMapping>
		</Row>
     </IconFontMapping>
This part sorts out where you set your strings to use in Resources.xml(IconName, IconFontTexture) and where they are in your atlas(IconMapping). IconName should be ICON_RES_NAME to match the vanilla entries.

As for the ggxml use the vanilla one, rename file and edit these two lines:
Code:
    <textures width="[B][COLOR="Red"]256[/COLOR][/B]" height="[B][COLOR="Red"]256[/COLOR][/B]">
        <texture name="" src="[B][COLOR="Red"]CCTPFontIconAtlas.dds[/COLOR][/B]" allowcolor="1" alloweffects="1" inuse="1" />
To match your new Font Atlas. There is a tutorial on the workshop by one of the Devs that is well worth taking a look at.
 
Back
Top Bottom