Trouble with Splitting Images

Forum Archive - from http://theuniversal.net
Locked
User avatar
Mattizme
Posts: 615
Joined: Sat Oct 04, 2003 6:23 pm
Location: At work/school/home
Contact:

Trouble with Splitting Images

Post by Mattizme »

Mit,

using the InterfaceDrawSprite function, how is it possible to split image into anything but fours? I'm trying to get an 8x8 grid, but I'm having some trouble splitting it up. If a float value of 0.5f will split it into 4x4, would 0.125f split it 8x8?

Answers please :)
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

Post by Mit »

Simple answer.. yes :]

Well almost.
The float parameter of DrawSprite specifies how much of the width&height of the texture is used for each image.. So 0.5f would actually split it into a 2x2. (i.e. 0.5f = the texture is split in half lengthways and widthways)

The parameter that follows that value determines which portion of the texture to use - the portions are ordered by columns then rows.

So.. as an example.. 0.25f, 5 would split the texture into 16 (4x4) regions, and you would be drawing the image on the second column of the second row. (0 being the first column of the first row)
User avatar
Mattizme
Posts: 615
Joined: Sat Oct 04, 2003 6:23 pm
Location: At work/school/home
Contact:

Post by Mattizme »

Cheers Mit - That's all the answer I need :)

The one thing that I use to work it out, is that if 1/2 (2 each way) gives 0.5 then 1/8 must give 0.125 :)
Locked