On Oct 18, 2016, at 00:04 , Patrick J. Collins <patr...@collinatorstudios.com>
>> Is your process 64-bit or 32-bit? CGFloat is float in 32-bit processes and
>> double in 64-bit processes.
> I'm not sure what you mean? The app is intended to work on both 32-bit
> and 64-bit architectures. My iPad3 is a 32-bit device, and my iPhone-6
> is a 64-bit device. On both of those devices everything is fine and
> casting 1.0 as either a CGFloat or float with both result in 1.0 (as
> expected). On the iPad pro, this bogus behavior happens where 1.0 cast
> as a CGFloat becomes 0.
You’re having a little temper fit here, which is fine by me except that it’s
leading you into technical incorrectness, not to mention contradicting
yourself. You said:
> (lldb) expr (float)[self.fireable laserXOffset]
> (float) $11 = 0
> (lldb) expr (CGFloat)[self.fireable laserXOffset]
> (CGFloat) $12 = 400
> (lldb) expr (double)[self.fireable laserXOffset]
> (double) $15 = 400
That is, according to you, casting *as a float* produces 0, and casting as
CGFloat or double [identical in iPad Pro as in iPhone 6/7] produce the same
non-zero value. Somehow, though, you’ve mixed this up:
> CGFloat is a float, yet it returns 0??????????? WTF?
It isn’t a float. What you’re seeing in the debugger *confirms* that CGFloat is
You’re also confusing the concepts of a cast as a value conversion and a cast
as a re-interpretation of the type of variable (which re-interprets the
underlying memory bits), and that’s what Greg was trying to alert you to:
>> The debugger console may interpret it
>> differently (using the cast as a hint of the correct return type,
>> rather than a conversion of the real return type).
So, back to your actual problem:
> Yes, when I first tried my game on the iPad pro, a huge percentage of my
> sprites were invisible, and it was because their scale was being set to
> 1.0 as CGFloats, which was turning into 0. So I had to make sure all
> the places where scale was being set was using an actual float type.
There’s something else going on here. You might want to show some code,
including the declaration of (say) your “laserXOffset” property, and the line
where you set the scale.
> I feel like I should just sed -i my entire
> project and turn all CGFloats into floats... But I am not sure if that's
> really a good idea.
No, that’s a really terrible idea. Voodoo solutions always are.
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (Objcfirstname.lastname@example.org)
Help/Unsubscribe/Update your Subscription:
This email sent to arch...@mail-archive.com