Chipmunk2D Pro API Reference  7.0.1
 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) CP_EXPORT 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 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 MAKE_REF(cpv); // makes a variable named _cpv that contains the function pointer for cpv()
45 MAKE_REF(cpveql);
46 MAKE_REF(cpvadd);
47 MAKE_REF(cpvneg);
48 MAKE_REF(cpvsub);
49 MAKE_REF(cpvmult);
50 MAKE_REF(cpvdot);
51 MAKE_REF(cpvcross);
52 MAKE_REF(cpvperp);
53 MAKE_REF(cpvrperp);
54 MAKE_REF(cpvproject);
55 MAKE_REF(cpvforangle);
56 MAKE_REF(cpvtoangle);
57 MAKE_REF(cpvrotate);
58 MAKE_REF(cpvunrotate);
59 MAKE_REF(cpvlengthsq);
60 MAKE_REF(cpvlength);
61 MAKE_REF(cpvlerp);
62 MAKE_REF(cpvnormalize);
63 MAKE_REF(cpvclamp);
64 MAKE_REF(cpvlerpconst);
65 MAKE_REF(cpvdist);
66 MAKE_REF(cpvdistsq);
67 MAKE_REF(cpvnear);
68 
69 MAKE_REF(cpfmax);
70 MAKE_REF(cpfmin);
71 MAKE_REF(cpfabs);
72 MAKE_REF(cpfclamp);
73 MAKE_REF(cpflerp);
74 MAKE_REF(cpflerpconst);
75 
76 MAKE_REF(cpBBNew);
77 MAKE_REF(cpBBNewForExtents);
78 MAKE_REF(cpBBNewForCircle);
79 MAKE_REF(cpBBIntersects);
80 MAKE_REF(cpBBContainsBB);
81 MAKE_REF(cpBBContainsVect);
82 MAKE_REF(cpBBMerge);
83 MAKE_REF(cpBBExpand);
84 MAKE_REF(cpBBCenter);
85 MAKE_REF(cpBBArea);
86 MAKE_REF(cpBBMergedArea);
87 MAKE_REF(cpBBSegmentQuery);
88 MAKE_REF(cpBBIntersectsSegment);
89 MAKE_REF(cpBBClampVect);
90 
91 MAKE_REF(cpSpatialIndexDestroy);
92 MAKE_REF(cpSpatialIndexCount);
93 MAKE_REF(cpSpatialIndexEach);
94 MAKE_REF(cpSpatialIndexContains);
95 MAKE_REF(cpSpatialIndexInsert);
96 MAKE_REF(cpSpatialIndexRemove);
97 MAKE_REF(cpSpatialIndexReindex);
100 MAKE_REF(cpSpatialIndexQuery);
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
107 #endif