⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bitmap.h

📁 小型的3D游戏引擎
💻 H
字号:
#ifndef _GCBITMAP_H_
#define _GCBITMAP_H_

#include "loader.h"

/* NOTE: The screenBpp does nothing in this loader, */
/* it's just the for compability with CTarga		*/

class GcBitmap : public GcLoader
{
public:
	// Constructor/Destructor
	GcBitmap();
	~GcBitmap();

	// Load bitmap from file
	bool Load(char *fileName);

	// Write bitmap to file
	bool Write(char *fileName, uint width, uint height, uint screenBpp = 0);

	// Take a screenshot
	/* WARNING! DO NOT USE THIS IF THE BITMAP ARE TO BE USED FURTHER ON */
	void Screenshot(char *fileName, uint winWidth, uint winHeight, uint screenBpp = 0);

	// Draw the bitmap
	void Draw(uint xPos, uint yPos);

	// Height/Width/Size
	uint Height() { return bitmapInfoHeader.biHeight; }
	uint Width()  { return bitmapInfoHeader.biWidth; }
	byte Bpp()	  { return (byte)bitmapInfoHeader.biBitCount; }		
	uint Size()	  { return bitmapInfoHeader.biSizeImage; }

	// Image
	byte *Image() { return bitmapImage; }
	byte Image(int index) { return bitmapImage[index]; }

	// Destroy
	void Destroy();

private:
	BITMAPFILEHEADER	bitmapFileHeader;	// Bitmap file header
	BITMAPINFOHEADER	bitmapInfoHeader;	// Bitmpa info header
	byte				*bitmapImage;		// The image
	int					colorMode;			// 1 == 8 bit, 2 == 16, 3 == RGB 4 == RGBA
	byte				tempRGB;			// Swap variable
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -