From aa0347a793ebec97e5b60b7ebddaf21f27f99480 Mon Sep 17 00:00:00 2001 From: "spartanj@gmail.com" Date: Wed, 25 Jan 2012 00:53:06 -0300 Subject: [PATCH] Changed OffSet for Offset. Disabled debug information by default in the Physics. --- src/graphics/cshape.cpp | 32 +++++++++++++++--------------- src/graphics/cshape.hpp | 4 ++-- src/graphics/csprite.cpp | 10 +++++----- src/graphics/csprite.hpp | 20 +++++++++---------- src/physics/cphysicsmanager.hpp | 4 ++-- src/physics/cshapecirclesprite.cpp | 4 ++-- src/physics/cshapepolysprite.cpp | 4 ++-- src/physics/cshapepolysprite.hpp | 1 + 8 files changed, 40 insertions(+), 39 deletions(-) diff --git a/src/graphics/cshape.cpp b/src/graphics/cshape.cpp index 20859f884..d652904f2 100644 --- a/src/graphics/cshape.cpp +++ b/src/graphics/cshape.cpp @@ -12,8 +12,8 @@ cShape::cShape() : mSrcRect( eeRecti(0,0,0,0) ), mDestWidth(0), mDestHeight(0), - mOffSetX(0), - mOffSetY(0) + mOffsetX(0), + mOffsetY(0) { CreateUnnamed(); } @@ -28,8 +28,8 @@ cShape::cShape( const Uint32& TexId, const std::string& Name ) : mSrcRect( eeRecti( 0, 0, mTexture->Width(), mTexture->Height() ) ), mDestWidth( (eeFloat)mTexture->Width() ), mDestHeight( (eeFloat)mTexture->Height() ), - mOffSetX(0), - mOffSetY(0) + mOffsetX(0), + mOffsetY(0) { if ( !GLi->IsExtension( EEGL_ARB_texture_non_power_of_two ) ) { mSrcRect = eeRecti( 0, 0, mTexture->ImgWidth(), mTexture->ImgHeight() ); @@ -48,8 +48,8 @@ cShape::cShape( const Uint32& TexId, const eeRecti& SrcRect, const std::string& mSrcRect(SrcRect), mDestWidth( (eeFloat)( mSrcRect.Right - mSrcRect.Left ) ), mDestHeight( (eeFloat)( mSrcRect.Bottom - mSrcRect.Top ) ), - mOffSetX(0), - mOffSetY(0) + mOffsetX(0), + mOffsetY(0) { CreateUnnamed(); } @@ -64,8 +64,8 @@ cShape::cShape( const Uint32& TexId, const eeRecti& SrcRect, const eeFloat& Dest mSrcRect(SrcRect), mDestWidth(DestWidth), mDestHeight(DestHeight), - mOffSetX(0), - mOffSetY(0) + mOffsetX(0), + mOffsetY(0) { CreateUnnamed(); } @@ -80,8 +80,8 @@ cShape::cShape( const Uint32& TexId, const eeRecti& SrcRect, const eeFloat& Dest mSrcRect(SrcRect), mDestWidth(DestWidth), mDestHeight(DestHeight), - mOffSetX(OffsetX), - mOffSetY(OffsetY) + mOffsetX(OffsetX), + mOffsetY(OffsetY) { CreateUnnamed(); } @@ -148,29 +148,29 @@ void cShape::DestHeight( const eeFloat& height ) { } const Int32& cShape::OffsetX() const { - return mOffSetX; + return mOffsetX; } void cShape::OffsetX( const Int32& offsetx ) { - mOffSetX = offsetx; + mOffsetX = offsetx; } const Int32& cShape::OffsetY() const { - return mOffSetY; + return mOffsetY; } void cShape::OffsetY( const Int32& offsety ) { - mOffSetY = offsety; + mOffsetY = offsety; } void cShape::Draw( const eeFloat& X, const eeFloat& Y, const eeColorA& Color, const eeFloat& Angle, const eeFloat& Scale, const EE_PRE_BLEND_FUNC& Blend, const EE_RENDERTYPE& Effect, const bool& ScaleRendered ) { if ( NULL != mTexture ) - mTexture->DrawEx( X + mOffSetX, Y + mOffSetY, mDestWidth, mDestHeight, Angle, Scale, Color, Color, Color, Color, Blend, Effect, ScaleRendered, mSrcRect ); + mTexture->DrawEx( X + mOffsetX, Y + mOffsetY, mDestWidth, mDestHeight, Angle, Scale, Color, Color, Color, Color, Blend, Effect, ScaleRendered, mSrcRect ); } void cShape::Draw( const eeFloat& X, const eeFloat& Y, const eeFloat& Angle, const eeFloat& Scale, const eeColorA& Color0, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_PRE_BLEND_FUNC& Blend, const EE_RENDERTYPE& Effect, const bool& ScaleRendered ) { if ( NULL != mTexture ) - mTexture->DrawEx( X + mOffSetX, Y + mOffSetY, mDestWidth, mDestHeight, Angle, Scale, Color0, Color1, Color2, Color3, Blend, Effect, ScaleRendered, mSrcRect ); + mTexture->DrawEx( X + mOffsetX, Y + mOffsetY, mDestWidth, mDestHeight, Angle, Scale, Color0, Color1, Color2, Color3, Blend, Effect, ScaleRendered, mSrcRect ); } void cShape::Draw( const eeQuad2f Q, const eeFloat& X, const eeFloat& Y, const eeFloat& Angle, const eeFloat& Scale, const eeColorA& Color0, const eeColorA& Color1, const eeColorA& Color2, const eeColorA& Color3, const EE_PRE_BLEND_FUNC& Blend ) { diff --git a/src/graphics/cshape.hpp b/src/graphics/cshape.hpp index 5c584f3cf..dc1f6300b 100644 --- a/src/graphics/cshape.hpp +++ b/src/graphics/cshape.hpp @@ -100,8 +100,8 @@ class EE_API cShape { eeRecti mSrcRect; eeFloat mDestWidth; eeFloat mDestHeight; - Int32 mOffSetX; - Int32 mOffSetY; + Int32 mOffsetX; + Int32 mOffsetY; void CreateUnnamed(); }; diff --git a/src/graphics/csprite.cpp b/src/graphics/csprite.cpp index 43c960d8a..76604857a 100755 --- a/src/graphics/csprite.cpp +++ b/src/graphics/csprite.cpp @@ -575,7 +575,7 @@ eeUint cSprite::GetSubFrame( const eeUint& SubFrame ) { return SFN; } -Int32 cSprite::OffSetX() { +Int32 cSprite::OffsetX() { cShape* S = GetCurrentShape(); if ( S != NULL ) @@ -584,14 +584,14 @@ Int32 cSprite::OffSetX() { return 0; } -void cSprite::OffSetX( const Int32& offsetx ) { +void cSprite::OffsetX( const Int32& offsetx ) { cShape* S = GetCurrentShape(); if ( S != NULL ) S->OffsetX( offsetx ); } -Int32 cSprite::OffSetY() { +Int32 cSprite::OffsetY() { cShape* S = GetCurrentShape(); if ( S != NULL ) @@ -600,14 +600,14 @@ Int32 cSprite::OffSetY() { return 0; } -void cSprite::OffSetY( const Int32& offsety ) { +void cSprite::OffsetY( const Int32& offsety ) { cShape* S = GetCurrentShape(); if ( S != NULL ) S->OffsetY( offsety ); } -void cSprite::OffSet( const eeVector2i& offset ) { +void cSprite::Offset( const eeVector2i& offset ) { cShape* S = GetCurrentShape(); if ( S != NULL ) { diff --git a/src/graphics/csprite.hpp b/src/graphics/csprite.hpp index 896d4867f..39bca8293 100755 --- a/src/graphics/csprite.hpp +++ b/src/graphics/csprite.hpp @@ -274,20 +274,20 @@ class EE_API cSprite { /** @return The four vertex position of the Sprite */ eeQuad2f GetQuad(); - /** @return The OffSetX of the current frame */ - Int32 OffSetX(); + /** @return The OffsetX of the current frame */ + Int32 OffsetX(); - /** Set the OffSetX of the current frame */ - void OffSetX( const Int32& offsetx ); + /** Set the OffsetX of the current frame */ + void OffsetX( const Int32& offsetx ); - /** @return The OffSetY of the current frame */ - Int32 OffSetY(); + /** @return The OffsetY of the current frame */ + Int32 OffsetY(); - /** Set the OffSetY of the current frame */ - void OffSetY( const Int32& offsety ); + /** Set the OffsetY of the current frame */ + void OffsetY( const Int32& offsety ); - /** Set the OffSet of the current frame */ - void OffSet( const eeVector2i& offset ); + /** Set the Offset of the current frame */ + void Offset( const eeVector2i& offset ); /** Reverse the animation from last frame to first mFrames. */ void ReverseAnim( const bool& Reverse ); diff --git a/src/physics/cphysicsmanager.hpp b/src/physics/cphysicsmanager.hpp index 53fc99509..6b8b52a40 100644 --- a/src/physics/cphysicsmanager.hpp +++ b/src/physics/cphysicsmanager.hpp @@ -19,9 +19,9 @@ class CP_API cPhysicsManager { cDrawSpaceOptions() : DrawBBs( false ), DrawShapes( true ), - CollisionPointSize( 4.0f ), + CollisionPointSize( 0.0f ), BodyPointSize( 0.0f ), - LineThickness( 1.5f ) + LineThickness( 0.0f ) {} bool DrawBBs; diff --git a/src/physics/cshapecirclesprite.cpp b/src/physics/cshapecirclesprite.cpp index 55fad22c8..f3124ac78 100644 --- a/src/physics/cshapecirclesprite.cpp +++ b/src/physics/cshapecirclesprite.cpp @@ -32,8 +32,8 @@ void cShapeCircleSprite::Draw( cSpace * space ) { void cShapeCircleSprite::OffsetSet() { mSprite->Width( cShapeCircle::Radius() * 2 ); mSprite->Height( cShapeCircle::Radius() * 2 ); - mSprite->OffSetX( -cShapeCircle::Radius() + cShapeCircle::Offset().x ); - mSprite->OffSetY( -cShapeCircle::Radius() + cShapeCircle::Offset().y ); + mSprite->OffsetX( -cShapeCircle::Radius() + cShapeCircle::Offset().x ); + mSprite->OffsetY( -cShapeCircle::Radius() + cShapeCircle::Offset().y ); } cSprite * cShapeCircleSprite::GetSprite() const { diff --git a/src/physics/cshapepolysprite.cpp b/src/physics/cshapepolysprite.cpp index 4dbf790cf..5d7ee9e2b 100644 --- a/src/physics/cshapepolysprite.cpp +++ b/src/physics/cshapepolysprite.cpp @@ -38,6 +38,7 @@ cShapePolySprite::~cShapePolySprite() { void cShapePolySprite::Draw( cSpace * space ) { cVect Pos = Body()->Pos(); + mSprite->Offset( mOffset ); mSprite->Position( Pos.x, Pos.y ); mSprite->Angle( Body()->AngleDeg() ); mSprite->Draw(); @@ -46,8 +47,7 @@ void cShapePolySprite::Draw( cSpace * space ) { void cShapePolySprite::OffsetSet( cVect center ) { cVect myCenter = cVectNew( ( mSprite->Width() / 2 ), ( mSprite->Height() / 2 ) ); - mSprite->OffSetX( -myCenter.x + ( center.x - myCenter.x ) ); - mSprite->OffSetY( -myCenter.y + ( center.y - myCenter.y ) ); + mOffset = eeVector2i( (Int32)( -myCenter.x + ( center.x - myCenter.x ) ) , (Int32)( -myCenter.y + ( center.y - myCenter.y ) ) ); } cSprite * cShapePolySprite::GetSprite() const { diff --git a/src/physics/cshapepolysprite.hpp b/src/physics/cshapepolysprite.hpp index 39d05a260..f89a5a183 100644 --- a/src/physics/cshapepolysprite.hpp +++ b/src/physics/cshapepolysprite.hpp @@ -28,6 +28,7 @@ class CP_API cShapePolySprite : public cShapePoly { protected: cSprite * mSprite; bool mSpriteAutoDelete; + eeVector2i mOffset; void OffsetSet( cVect center ); };