What the way create dragged image

Discussion in 'Mac Programming' started by roma86, Oct 29, 2012.

  1. macrumors newbie

    Joined:
    Oct 29, 2012
    #1
    Hi! I create any simple program and game for iPhone, but new on the mac os programming and cocoa.
    I want create editor map. It create plist file with image center coordinates and angles rotation added on the box area;
    Conception:
    Step 1. add background (it is not editable)
    [​IMG]
    Step 2. Images from table can be added to right area (click or drag). We can add more duplicate this object in the area.
    [​IMG]
    Added onto area objects can be moved within background image. We can get coordinates all images, can rotate it around center.
    [​IMG]
    Finally it's all will be exported into plist file as group image by name and items with coordinates.

    My question is: how to implement it. This is a joke. )
    My questions are:
    What the way create draggable object? Can i use image, or not?
    What i should use for area when object will be place? It's can be box view or other type view?
    What the way create plist file?


    I will be grateful for any tips and tutorials describing part of this task.
     
  2. macrumors member

    Joined:
    Jul 4, 2010
    #2
  3. thread starter macrumors newbie

    Joined:
    Oct 29, 2012
    #3
    Hi!
    Thanx. But this is not what I need. THis is drag-an-drop between application or within window. I want drag-and-drag-and-drag)) my object and get it coordinates.
    Thanx! this is what i need for creating plist files.
     
  4. macrumors member

    Joined:
    Jul 4, 2010
    #4
    So you want to drag an object inside an existing view? In that case, you could override NSViews mouseDragged: method. The event that is passed as argument will contain the position of the mouse in the window which you can then convert to your view like so:
    Code:
    - (void)mouseDragged:(NSEvent *)theEvent {
        NSPoint pointInView = [self convertPoint:[theEvent locationInWindow] fromView:nil];
        // You can now use pointInView for setting a new location
    }
    Check out the NSView documentation for more coordinate conversion methods or details about the one I used. Hope I understood what you want to do this time ;)
     

Share This Page