Jump to content

Recommended Posts

Its actually quite easy....

On the xml file that references your .tex you will want something like something like this:

===
<Atlas>
<Texture filename="<yourfilename>.tex" />
   <Elements>
       <Element name="<item1name>.tex" u1="0.0010256" u2="0.0663212" v1="0.0021978" v2="0.1428571" />
       <Element name="<item2name>.tex" u1="0.0676923" u2="0.1333333" v1="0.1450549" v2="0.2857143" />
-- etc. etc.
   </Elements>
</Atlas>
===

But, what do those numbers mean?

Well, they are coordinates of the four corners of your .tex icon within the larger image
They are expressed as a percentage of the entire image size.
So if the image is 975 pixels wide, the icon in the upper left would start at horizontal coordinates 1/975 and end at 64/975
And then repeat the math for the vertical coordinates, based on the height of your image.
Measurement and placement of the images is very important, and I think the larger image has to maintain a certain aspect ratio -
unfortunately it has been a long time since I made images in that way
I forget which coordinate is which corner - I think V are the vertical, but it may start measuring from the bottom, so .001 would be the bottom row.
( You can check the core game's Inventoryimages.xml to try to figure out which coordinate is which by matching up a known icon with a known name within the xml file )

Anyway, its quite a bit of mathwork to make it work, but it can be done.
If I remember right, however, the game (or early versions of it) would try to overwrite the xml document whenever I would recompile my mod.
So after compiling I would then manually replace the new xml with one I had saved.
That may no longer be the case.

Hope that helps,
Why not make each image a separate .tex and xml?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...