Chipmunk2D Pro API Reference  7.0.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
ChipmunkMultiGrab.h
1 /* Copyright (c) 2013 Scott Lembcke and Howling Moon Software
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to deal
5  * in the Software without restriction, including without limitation the rights
6  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7  * copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19  * SOFTWARE.
20  */
21 
22 #import "ObjectiveChipmunk/ObjectiveChipmunk.h"
23 
24 @interface ChipmunkGrab : NSObject<ChipmunkObject> {
25  NSArray *_chipmunkObjects;
26 
27  cpVect _pos;
28  cpFloat _smoothing;
29 
30  ChipmunkShape *_grabbedShape;
31 
32  id _data;
33 }
34 
36 @property(nonatomic, readonly) cpVect pos;
37 
39 @property(nonatomic, readonly) ChipmunkShape *grabbedShape;
40 
42 @property(nonatomic, retain) id data;
43 
44 @end
45 
46 
48 @interface ChipmunkMultiGrab : NSObject {
49  ChipmunkSpace *_space;
50  NSMutableArray *_grabs;
51 
52  cpFloat _smoothing;
53  cpFloat _grabForce;
54 
55  cpFloat _grabFriction;
56  cpFloat _grabRotaryFriction;
57  cpFloat _grabRadius;
58 
60  bool (^_grabFilter)(ChipmunkShape *shape);
61  cpFloat (^_grabSort)(ChipmunkShape *shape, cpFloat depth);
62 
63  bool _pushMode, _pullMode;
64 
65  cpFloat _pushMass;
66  cpFloat _pushFriction;
67  cpFloat _pushElasticity;
68  cpCollisionType _pushCollisionType;
69 }
70 
71 @property(nonatomic, assign) cpFloat smoothing;
72 @property(nonatomic, assign) cpFloat grabForce;
73 
75 @property(nonatomic, assign) cpShapeFilter filter;
76 
78 @property(nonatomic, assign) cpGroup group;
79 
82 @property(nonatomic, copy) bool (^grabFilter)(ChipmunkShape *shape);
83 
89 @property(nonatomic, copy) cpFloat (^grabSort)(ChipmunkShape *shape, cpFloat depth);
90 
93 @property(nonatomic, assign) cpFloat grabFriction;
94 
97 @property(nonatomic, assign) cpFloat grabRotaryFriction;
98 
102 @property(nonatomic, assign) cpFloat grabRadius;
103 
104 @property(nonatomic, assign) bool pullMode;
105 @property(nonatomic, assign) bool pushMode;
106 
107 @property(nonatomic, assign) cpFloat pushMass;
108 @property(nonatomic, assign) cpFloat pushFriction;
109 @property(nonatomic, assign) cpFloat pushElasticity;
110 @property(nonatomic, assign) cpCollisionType pushCollisionType;
111 
112 @property(nonatomic, readonly) NSArray *grabs;
113 
114 
121 -(id)initForSpace:(ChipmunkSpace *)space withSmoothing:(cpFloat)smoothing withGrabForce:(cpFloat)grabForce;
122 
126 -(ChipmunkGrab *)beginLocation:(cpVect)pos;
127 
130 -(ChipmunkGrab *)updateLocation:(cpVect)pos;
131 
134 -(ChipmunkGrab *)endLocation:(cpVect)pos;
135 
136 @end