DXMap.h
资源名称:DXGuide.zip [点击查看]
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:4k
源码类别:
DirextX编程
开发平台:
Visual C++
- // Copyright (C) 1998-1999 DXGuide. All Rights Reserved.
- // File: DXMap.h
- #ifndef _DXMAP__H
- #define _DXMAP__H
- #if _MSC_VER >= 1000
- #pragma once
- #endif // _MSC_VER >= 1000
- class CDDDevice;
- class CDDSurface;
- class CPackFileManager;
- class CDXMap
- {
- public:
- CDXMap(void);
- virtual ~CDXMap();
- public:
- bool Create(CDDSurface* pTiles,
- int nCellWidthShift, int nCellHeightShift,
- int nCellColumns, int nCellRows, int nFill,
- LPRECT lprcDest);
- bool Create(CDDSurface* pTiles,
- int nCellWidthShift, int nCellHeightShift,
- LPCTSTR lpszFileName, CDDDevice* pDDDevice,
- CPackFileManager* pPackFileManager = NULL);
- bool Create(CDDSurface* pTiles,
- int nCellWidthShift, int nCellHeightShift,
- LPCTSTR lpszFileName,
- LPRECT lprcDest,
- CPackFileManager* pPackFileManager = NULL);
- bool Create(CDDDevice* pDDDevice,
- LPCTSTR lpszFileName,
- LPRECT lprcDest,
- CPackFileManager* pPackFileManager = NULL,
- bool bTrans = false);
- public:
- void SetPassValues(int* pPassValues);
- protected:
- bool Create(CDDSurface* pTiles,
- int nCellWidthShift, int nCellHeightShift,
- int nCellColumns, int nCellRows,
- int* pMapData,
- LPRECT lprcDest);
- public:
- void Draw(CDDSurface* pDestSurface,
- LPCRECT lprcClip = NULL);
- void MoveTo(int nPosX, int nPosY);
- void ScrollUp(int nOffset);
- void ScrollDown(int nOffset);
- void ScrollLeft(int nOffset);
- void ScrollRight(int nOffset);
- void ScrollX(int nOffset);
- void ScrollY(int nOffset);
- void WrapScrollUp(int nOffset);
- void WrapScrollDown(int nOffset);
- void WrapScrollLeft(int nOffset);
- void WrapScrollRight(int nOffset);
- public:
- bool Save(LPCTSTR lpszFileName);
- bool SaveMixed(LPCTSTR lpszFileName);
- void Clear(void);
- void Fill(int nTileNum);
- int GetTile(int nMapCol, int nMapRow) const;
- int GetTile(int nIndex) const;
- int GetIndexFromPoint(int nX, int nY) const;
- int GetTileFromPoint(int nX, int nY) const;
- void CalcScreenPoint(int nMapCol, int nMapRow, int& nX, int& nY);
- int GetTilePassValue(int nMapCol, int nMapRow) const;
- int GetTilePassValue(int nIndex) const;
- int GetPointPassValue(int nX, int nY) const;
- void SetTile(int nMapCol, int nMapRow, int nTile);
- void SetTile(int nIndex, int nTile);
- int GetX(void) const;
- int GetY(void) const;
- int GetCellWidth(void) const;
- int GetCellHeight(void) const;
- int GetHoriCellNum(void) const;
- int GetVertCellNum(void) const;
- int GetTotalWidth(void) const;
- int GetTotalHeight(void) const;
- protected:
- void BltTile(CDDSurface* pDestSurface,
- int nDestX, int nDestY,
- int nWidth, int nHeight);
- int GetTotalTileTypes(void) const;
- protected:
- int m_nTotalWidth;
- int m_nTotalHeight;
- int* m_pPassValues;
- protected:
- int m_nPosX;
- int m_nPosY;
- RECT m_rcDest;
- int m_nColumns;
- int m_nRows;
- int m_nCellWidth;
- int m_nCellHeight;
- int m_nCellWidthShift;
- int m_nCellHeightShift;
- int m_nSrcSurfaceCellRows;
- int* m_pMapData;
- bool m_bAutoDelete;
- CDDSurface* m_pTiles;
- protected:
- static const LPCTSTR m_lpcszMapFileSectionName;
- static const LPCTSTR m_lpcszMapNameEntryName;
- static const LPCTSTR m_lpcszMapWidthEntryName;
- static const LPCTSTR m_lpcszMapHeightEntryName;
- static const LPCTSTR m_lpcszTilesFileNameEntryName;
- static const LPCTSTR m_lpcszTileWidthShiftEntryName;
- static const LPCTSTR m_lpcszTileHeightShiftEntryName;
- static const LPCTSTR m_lpcszMapDataSectionName;
- static const LPCTSTR m_lpcszDataEntryFmt;
- static const LPCTSTR m_lpcszTilePassValueSectionName;
- static const LPCTSTR m_lpcszPassValueEntryFmt;
- };
- #include "DXMap.inl"
- #endif // _DXMAP__H