comparison trunk/chipmunkd/chipmunk_types.d @ 17:131331ebb599

cpVect toString method and some cleanup
author Extrawurst
date Thu, 09 Dec 2010 01:51:30 +0100
parents df4ebc8add66
children 4ceef5833c8c
comparison
equal deleted inserted replaced
16:af2f61a96318 17:131331ebb599
1 1
2 // written in the D programming language 2 // written in the D programming language
3 3
4 module chipmunkd.chipmunk_types; 4 module chipmunkd.chipmunk_types;
5
6 import std.string;
5 7
6 //#ifdef __APPLE__ 8 //#ifdef __APPLE__
7 // #import "TargetConditionals.h" 9 // #import "TargetConditionals.h"
8 //#endif 10 //#endif
9 // 11 //
98 // // CGPoints are structurally the same, and allow 100 // // CGPoints are structurally the same, and allow
99 // // easy interoperability with other iPhone libraries 101 // // easy interoperability with other iPhone libraries
100 // #import <CoreGraphics/CGGeometry.h> 102 // #import <CoreGraphics/CGGeometry.h>
101 // typedef CGPoint cpVect; 103 // typedef CGPoint cpVect;
102 //#else 104 //#else
103 struct cpVect{cpFloat x = 0; cpFloat y=0;} 105 struct cpVect
106 {
107 cpFloat x = 0; cpFloat y=0;
108
109 string toString() const
110 {
111 return .format("(%s,%s)",x,y);
112 }
113 }
104 //#endif 114 //#endif
105 115
106 alias uint cpHashValue; 116 alias uint cpHashValue;
107 117
108 // Oh C, how we love to define our own boolean types to get compiler compatibility 118 // Oh C, how we love to define our own boolean types to get compiler compatibility