"L. Spiro Engine"
|
00001 00017 #ifndef __LSE_2DOBJECT_H__ 00018 #define __LSE_2DOBJECT_H__ 00019 00020 #include "../LSEEngine.h" 00021 #include "../Entity/LSEActor.h" 00022 #include "SharedPtr/LSTLSharedPtr.h" 00023 #include "SpatialPartitions/LSPQuadTreeObject.h" 00024 #include "Sprites/LSGAnimSprite.h" 00025 00026 namespace lse { 00027 00035 class C2dObject : public CActor, public CQuadTreeObject { 00036 public : 00037 // == Various constructors. 00038 LSE_CALLCTOR C2dObject(); 00039 virtual LSE_CALLCTOR ~C2dObject(); 00040 00041 00042 // == Functions. 00048 virtual LSUINT32 LSE_CALL EntityType() const; 00049 00055 virtual const CAabb2d & LSE_CALL QuadTreeAabb() const; 00056 00062 virtual LSVOID LSE_CALL Tick( LSUINT64 _ui64Time ); 00063 00072 LSVOID LSE_CALL SetBounds( LSREAL _fCenterX, LSREAL _fCenterY, 00073 LSREAL _fWidth, LSREAL _fHeight ); 00074 00078 LSVOID LSE_CALL SetBoundsToImage(); 00079 00085 LSE_INLINE CVector2 & LSE_CALL Velocity(); 00086 00092 LSE_INLINE const CVector2 & LSE_CALL Velocity() const; 00093 00099 LSE_INLINE LSREAL & LSE_CALL RotVelocity(); 00100 00106 LSE_INLINE LSREAL LSE_CALL RotVelocity() const; 00107 00113 LSE_INLINE CAnimSprite & LSE_CALL Sprite(); 00114 00120 LSE_INLINE const CAnimSprite & LSE_CALL Sprite() const; 00121 00125 LSVOID LSE_CALL Draw(); 00126 00133 static LSVOID LSE_CALL CellResizeCallback( LSVOID * _pvParm ); 00134 00135 00136 protected : 00137 // == Members. 00141 mutable CAabb2d m_aAabb2d; 00142 00146 CAabb2d m_aMasterAabb2d; 00147 00151 CVector2 m_vVel; 00152 00156 CVector2 m_vAcc; 00157 00161 LSREAL m_fRot; 00162 00166 LSREAL m_fRotVel; 00167 00171 CAnimSprite m_asSprite; 00172 00173 00174 // == Functions. 00178 virtual LSVOID LSE_CALL WorldDidChange() const; 00179 00180 private : 00181 typedef CActor Parent; 00182 }; 00183 00184 00185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00186 // DEFINITIONS 00187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00188 // == Types. 00192 typedef CSharedPtr<C2dObject> C2dObjectPtr; 00193 00199 LSE_INLINE CVector2 & LSE_CALL C2dObject::Velocity() { 00200 return m_vVel; 00201 } 00202 00208 LSE_INLINE const CVector2 & LSE_CALL C2dObject::Velocity() const { 00209 return m_vVel; 00210 } 00211 00217 LSE_INLINE LSREAL & LSE_CALL C2dObject::RotVelocity() { 00218 return m_fRotVel; 00219 } 00220 00226 LSE_INLINE LSREAL LSE_CALL C2dObject::RotVelocity() const { 00227 return m_fRotVel; 00228 } 00229 00235 LSE_INLINE CAnimSprite & LSE_CALL C2dObject::Sprite() { 00236 return m_asSprite; 00237 } 00238 00244 LSE_INLINE const CAnimSprite & LSE_CALL C2dObject::Sprite() const { 00245 return m_asSprite; 00246 } 00247 00248 } // namespace lse 00249 00250 #endif // __LSE_2DOBJECT_H__