AC Coding help
#1
Okay, I've opened up renderhud.cpp inside of the cube source code and am looking at this line:

drawicon(tex, x, y, 120, col, row, 1/4.0f);

I understand what tex,x,y,120,col,row is. The only thing I am stuck on is what 1/4.0f

What does 1/4.0f mean? I was experimenting with jmonkey w/ netbeans 2 year ago and have seen numbers attached to the 'f', but I can't recall what it is.
Thanks given by:
#2
This equates to 0.25, the f means "float" and make the number a float. Think about this number as a fraction. Not knowing the arguments of that function I cannot tell you why they would do 1/4 rather than 0.25, but it may be more intuitive for the developer to use fractions there. Of course it might be like the rest of AC, and slightly confusing for no apparent reason.

But yeah, that means 0.25, the f makes it a floating point rather than an int.
Thanks given by:
#3
1/4 would be easier to edit if the fraction was frequently modified during development (and they, for some reason, didn't want to test arbitrary or linear decimal intervals. Maybe they were testing values there on a log scale or something).
Thanks given by:
#4
I understand that is 0.25, but what I'm really asking is how or where does it know that the texture is 256 by 256 pixels? I'm trying to load a custom texture when drawequipicon() is called with a specific row and column values.

My custom texture contains only 1 image, so I assume I would call drawicon() with row = 0 and column = 0? Or do the rows and columns start at (1,1)? Thanks
Thanks given by:
#5
(29 Jan 13, 08:16PM)Lee Wrote: I understand what tex,x,y,120,col,row is. The only thing I am stuck on is what 1/4.0f

(29 Jan 13, 08:30PM)Lee Wrote: I understand that is 0.25, but what I'm really asking is how or where does it know that the texture is 256 by 256 pixels?

. . .
Thanks given by:
#6
output screen can have various resolutions. from output resolution you can count "unit" in pixels and your number is relative size to this unit.
Thanks given by:
#7
@GDM, I was asking what the 1/4.0f actually does. I know its 0.25, that doesn't quite help me in figuring out its function. Thanks though.
Thanks given by: