Stupid NSPoint Question.

Discussion in 'Mac Programming' started by kbaum, Sep 16, 2007.

  1. kbaum macrumors newbie

    Joined:
    Sep 7, 2007
    #1
    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)?
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    See the NSPoint documentation. It's just a struct. If you don't know what a struct is, you should go back and learn C.
     
  3. Nutter macrumors 6502

    Joined:
    Mar 31, 2005
    Location:
    London, England
    #3
    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.
     
  4. MrFusion macrumors 6502a

    Joined:
    Jun 8, 2005
    Location:
    West-Europe
    #4

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

    Krevnik

    Joined:
    Sep 8, 2003
    #5
    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*).
     

Share This Page