Changed OffSet for Offset.

Disabled debug information by default in the Physics.
This commit is contained in:
spartanj@gmail.com
2012-01-25 00:53:06 -03:00
parent 07821a318b
commit aa0347a793
8 changed files with 40 additions and 39 deletions

View File

@@ -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 ) {

View File

@@ -100,8 +100,8 @@ class EE_API cShape {
eeRecti mSrcRect;
eeFloat mDestWidth;
eeFloat mDestHeight;
Int32 mOffSetX;
Int32 mOffSetY;
Int32 mOffsetX;
Int32 mOffsetY;
void CreateUnnamed();
};

View File

@@ -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 ) {

View File

@@ -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 );

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -28,6 +28,7 @@ class CP_API cShapePolySprite : public cShapePoly {
protected:
cSprite * mSprite;
bool mSpriteAutoDelete;
eeVector2i mOffset;
void OffsetSet( cVect center );
};