PDA

View Full Version : Stupid NSPoint Question.




kbaum
Sep 16, 2007, 04:47 PM
Hi, how do I store the x value of an NSPoint into a float? Thanks.

Also, how do I make my application stay the frontmost app (without it being fullscreen)?



kainjow
Sep 16, 2007, 05:57 PM
See the NSPoint (http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_DataTypes/Reference/reference.html#//apple_ref/c/tdef/NSPoint) documentation. It's just a struct. If you don't know what a struct is, you should go back and learn C.

Nutter
Sep 16, 2007, 07:37 PM
Also, how do I make my application stay the frontmost app (without it being fullscreen)?

This can be done by creating transparent windows that cover the screen(s) and using SetSystemUIMode(), but I wouldn't recommend it. If you want your app to stay frontmost you should make it full screen.

MrFusion
Sep 18, 2007, 11:44 AM
Hi, how do I store the x value of an NSPoint into a float? Thanks.

Also, how do I make my application stay the frontmost app (without it being fullscreen)?


NSPoint yourPoint = NSMakePoint(3,4);
float yourx = yourPoint.x;
yourPoint.y = 3+yourPoint.x*yourPoint.y; //not sure this would work correctly

Krevnik
Sep 18, 2007, 12:33 PM
NSPoint yourPoint = NSMakePoint(3,4);
float yourx = yourPoint.x;
yourPoint.y = 3+yourPoint.x*yourPoint.y; //not sure this would work correctly

That would work correctly for the most part, although to ensure readability/etc, I would replace '3' with '3.0' to ensure that the compiler produces a floating point literal (GCC should be okay, but better safe than sorry *g*).