From 8221c2f20d2243b257374084b9d9570862ebd331 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Mon, 31 Oct 2005 01:56:15 +0000 Subject: [PATCH] Let SM play nice with OS X's headers. --- stepmania/src/RageTypes.h | 53 ++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/stepmania/src/RageTypes.h b/stepmania/src/RageTypes.h index 1901213079..6c941a7a63 100644 --- a/stepmania/src/RageTypes.h +++ b/stepmania/src/RageTypes.h @@ -202,36 +202,37 @@ public: } }; - -template -class Rect +namespace SM { -public: - Rect() {}; - Rect(T l, T t, T r, T b) { left = l, top = t, right = r, bottom = b; }; - - T GetWidth() const { return right-left; }; - T GetHeight() const { return bottom-top; }; - T GetCenterX() const { return (left+right)/2; }; - T GetCenterY() const { return (top+bottom)/2; }; - - bool operator==( const Rect &other ) const +template + class Rect { +public: + Rect() {}; + Rect(T l, T t, T r, T b) { left = l, top = t, right = r, bottom = b; }; + + T GetWidth() const { return right-left; }; + T GetHeight() const { return bottom-top; }; + T GetCenterX() const { return (left+right)/2; }; + T GetCenterY() const { return (top+bottom)/2; }; + + bool operator==( const Rect &other ) const + { #define COMPARE( x ) if( x != other.x ) return false; - COMPARE( left ); - COMPARE( top ); - COMPARE( right ); - COMPARE( bottom ); + COMPARE( left ); + COMPARE( top ); + COMPARE( right ); + COMPARE( bottom ); #undef COMPARE - return true; - } - bool operator!=( const Rect &other ) const { return !operator==(other); } - - T left, top, right, bottom; -}; - -typedef Rect RectI; -typedef Rect RectF; + return true; + } + bool operator!=( const Rect &other ) const { return !operator==(other); } + + T left, top, right, bottom; + }; +} +typedef SM::Rect RectI; +typedef SM::Rect RectF; /* Structure for our custom vertex type. Note that these data structes * have the same layout that D3D expects. */