BMPSURF.H
资源名称:tc3d.zip [点击查看]
上传用户:abcdshs
上传日期:2007-01-07
资源大小:1858k
文件大小:3k
源码类别:
游戏
开发平台:
Visual C++
- // (C) Copyright 1996 by Anthony J. Carin. All Rights Reserved.
- #ifndef BMPSURF_H
- #define BMPSURF_H
- #include "windowsx.h"
- #include "higharea.h"
- typedef unsigned int uint;
- typedef unsigned short ushort;
- typedef unsigned long ulong;
- typedef unsigned char uchar;
- // GL_EXT_paletted_texture
- class bmplist;
- class bmpsurf : public surfs
- {
- public:
- friend class bmplist;
- bmpsurf(CString& filename);
- ~bmpsurf();
- void draw();
- void ExemptFromIntersect();
- void OKToIntersect();
- char intersects(coordinate &a, coordinate &b);
- coordinate& intersectingpoint() { return m_intersectpoint; }
- char iswithin(coordinate& c) { if (m_exempt) return FALSE; else return surfs::iswithin(c); }
- void setto(coordinate& a, coordinate& b, coordinate& c, coordinate& d);
- virtual void operator =(surfs& s);
- virtual void operator +=(coordinate& c);
- virtual char IsABmp() { return TRUE; }
- private:
- LPBITMAPFILEHEADER m_pBmFileHeader;
- LPBITMAPINFO m_pBmInfo;
- LPBITMAPINFOHEADER m_pBmInfoHeader;
- RGBQUAD *m_pRGBTable;
- char *m_pDibBits;
- uint m_numColors;
- float *m_red;
- float *m_blue;
- float *m_green;
- char m_intersects;
- char m_exempt;
- coordinate m_intersectpoint;
- coordinate m_intersectfrom;
- coordinate m_intersectto;
- DWORD dibSize;
- higharea *m_higharea;
- bmpsurf *next;
- bmpsurf *prev;
- void calcintersect(coordinate &a, coordinate &b);
- char sameintersectpoints(coordinate &a, coordinate &b);
- DWORD GetDibSizeImage();
- uint GetDibWidth();
- uint GetDibHeight();
- uint GetDibNumColors();
- LPBITMAPINFOHEADER GetDibInfoHeaderPtr();
- LPBITMAPINFO GetDibInfoPtr();
- LPRGBQUAD GetDibRGBTablePtr();
- char *GetDibBitsPtr();
- void LoadBitmapFile(CString& filename);
- void CreateColorTables();
- };
- class bmplist
- {
- public:
- friend class bmpsurf;
- bmplist() { m_First = m_Curr = 0; }
- ~bmplist() { Purge(); }
- bmpsurf *First() { m_Curr = m_First; return m_Curr; }
- bmpsurf *Next() { if (m_Curr) m_Curr = m_Curr->next; return m_Curr; }
- private:
- void Purge();
- bmpsurf *m_First;
- bmpsurf *m_Curr;
- };
- inline LPBITMAPINFOHEADER bmpsurf::GetDibInfoHeaderPtr()
- {
- return m_pBmInfoHeader;
- }
- inline LPBITMAPINFO bmpsurf::GetDibInfoPtr()
- {
- return m_pBmInfo;
- }
- inline LPRGBQUAD bmpsurf::GetDibRGBTablePtr()
- {
- return m_pRGBTable;
- }
- inline char* bmpsurf::GetDibBitsPtr()
- {
- return m_pDibBits;
- }
- inline uint bmpsurf::GetDibWidth()
- {
- return (uint) m_pBmInfoHeader->biWidth;
- }
- inline uint bmpsurf::GetDibHeight()
- {
- return (uint) m_pBmInfoHeader->biHeight;
- }
- inline char bmpsurf::sameintersectpoints(coordinate &a, coordinate &b)
- {
- return (char) ((a == m_intersectfrom && b == m_intersectto) ||
- (a == m_intersectto && b == m_intersectfrom));
- }
- #endif