Chipmunk2D Pro API Reference  7.0.0
 All Classes Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
chipmunk_ffi.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 #ifdef CHIPMUNK_FFI
23 
24 // Create non static inlined copies of Chipmunk functions, useful for working with dynamic FFIs
25 // This file should only be included in chipmunk.c
26 
27 // TODO: get rid of the reliance on static inlines.
28 // They make a mess for FFIs.
29 
30 #ifdef _MSC_VER
31  #if _MSC_VER >= 1600
32  #define MAKE_REF(name) decltype(name) *_##name = name
33  #else
34  #define MAKE_REF(name)
35  #endif
36 #else
37  #define MAKE_REF(name) __typeof__(name) *_##name = name
38 #endif
39 
40 #define MAKE_PROPERTIES_REF(struct, property) \
41  MAKE_REF(struct##Get##property); MAKE_REF(struct##Set##property)
42 
43 MAKE_REF(cpv); // makes a variable named _cpv that contains the function pointer for cpv()
44 MAKE_REF(cpveql);
45 MAKE_REF(cpvadd);
46 MAKE_REF(cpvneg);
47 MAKE_REF(cpvsub);
48 MAKE_REF(cpvmult);
49 MAKE_REF(cpvdot);
50 MAKE_REF(cpvcross);
51 MAKE_REF(cpvperp);
52 MAKE_REF(cpvrperp);
53 MAKE_REF(cpvproject);
54 MAKE_REF(cpvforangle);
55 MAKE_REF(cpvtoangle);
56 MAKE_REF(cpvrotate);
57 MAKE_REF(cpvunrotate);
58 MAKE_REF(cpvlengthsq);
59 MAKE_REF(cpvlength);
60 MAKE_REF(cpvlerp);
61 MAKE_REF(cpvnormalize);
62 MAKE_REF(cpvclamp);
63 MAKE_REF(cpvlerpconst);
64 MAKE_REF(cpvdist);
65 MAKE_REF(cpvdistsq);
66 MAKE_REF(cpvnear);
67 
68 MAKE_REF(cpfmax);
69 MAKE_REF(cpfmin);
70 MAKE_REF(cpfabs);
71 MAKE_REF(cpfclamp);
72 MAKE_REF(cpflerp);
73 MAKE_REF(cpflerpconst);
74 
75 MAKE_REF(cpBBNew);
76 MAKE_REF(cpBBNewForCircle);
77 MAKE_REF(cpBBIntersects);
78 MAKE_REF(cpBBContainsBB);
79 MAKE_REF(cpBBContainsVect);
80 MAKE_REF(cpBBMerge);
81 MAKE_REF(cpBBExpand);
82 MAKE_REF(cpBBArea);
83 MAKE_REF(cpBBMergedArea);
84 MAKE_REF(cpBBSegmentQuery);
85 MAKE_REF(cpBBIntersectsSegment);
86 MAKE_REF(cpBBClampVect);
87 
88 MAKE_REF(cpSpatialIndexDestroy);
89 MAKE_REF(cpSpatialIndexCount);
90 MAKE_REF(cpSpatialIndexEach);
91 MAKE_REF(cpSpatialIndexContains);
92 MAKE_REF(cpSpatialIndexInsert);
93 MAKE_REF(cpSpatialIndexRemove);
94 MAKE_REF(cpSpatialIndexReindex);
97 MAKE_REF(cpSpatialIndexQuery);
99 
100 #endif