DXSprite.h
资源名称:DXGuide.zip [点击查看]
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:2k
源码类别:
DirextX编程
开发平台:
Visual C++
- // Copyright (C) 1998-1999 DXGuide. All Rights Reserved.
- // File: DXSprite.h
- #ifndef _DXSPRITE__H
- #define _DXSPRITE__H
- #if _MSC_VER >= 1000
- #pragma once
- #endif // _MSC_VER >= 1000
- class CDXMap;
- class CDDDevice;
- class CDDSurface;
- class CPackFileManager;
- class CDXSprite : public CObject
- {
- DECLARE_SERIAL(CDXSprite);
- public:
- CDXSprite(void);
- virtual ~CDXSprite();
- public:
- bool Create(CDDSurface* pSurface,
- int nCellWidth, int nCellHeight,
- bool bAutoDelete = false);
- bool Create(CDDDevice* pDDDevice,
- LPCTSTR lpszFileName,
- int nCellWidth, int nCellHeight,
- CPackFileManager* pPackFileManager = NULL,
- bool bTrans = true);
- bool Create2(CDDDevice* pDDDevice,
- LPCTSTR lpszFileName,
- int nHoriBlocks, int nVertBlocks,
- CPackFileManager* pPackFileManager = NULL,
- bool bTrans = true);
- public:
- void MoveTo(int nX, int nY);
- void Move(int nDeltaX, int nDeltaY);
- void SetFrame(int nFrame);
- void NextFrame(void);
- void PrevFrame(void);
- void SetZ(int nZ);
- int GetZ(void) const;
- int GetCenterX(void) const;
- int GetCenterY(void) const;
- int GetCellWidth(void) const;
- int GetCellHeight(void) const;
- int GetCurFrame(void) const;
- int GetTotalFrames(void) const;
- bool IsTrans(void) const;
- bool SpriteHit(CDXSprite* pSprite);
- bool TileHit(CDXMap* pMap, int iTile);
- bool HitTest(int nX, int nY);
- virtual HRESULT Draw(CDDSurface* pDestSurface,
- LPCRECT lprcClip = NULL);
- virtual HRESULT Draw(LPRECT lprcDest,
- CDDSurface* pDestSurface);
- virtual HRESULT DrawScaled(CDDSurface* pDestSurface,
- float fFactor);
- protected:
- void SelectFrame(LPRECT lprcSrc);
- protected:
- int m_nCellWidth;
- int m_nCellHeight;
- int m_nCurFrame;
- int m_nTotalFrames;
- public:
- int m_nPosX;
- int m_nPosY;
- int m_nPosZ;
- protected:
- CDDSurface* m_pSurface;
- bool m_bAutoDelete;
- };
- #include "DXSprite.inl"
- #endif // _DXSPRITE__H