Posts: 59
Threads: 21
Joined: Dec 2012
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.
Posts: 3,462
Threads: 72
Joined: Jun 2010
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.
Posts: 172
Threads: 5
Joined: Jun 2010
29 Jan 13, 08:27PM
(This post was last modified: 30 Jan 13, 12:22AM by GDM.)
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).
Posts: 59
Threads: 21
Joined: Dec 2012
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
Posts: 172
Threads: 5
Joined: Jun 2010
(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?
. . .
Posts: 591
Threads: 19
Joined: Jun 2010
output screen can have various resolutions. from output resolution you can count "unit" in pixels and your number is relative size to this unit.
Posts: 59
Threads: 21
Joined: Dec 2012
@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.