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

📄 targa.h

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


#include "loader.h"
#include <fstream>
using namespace std;

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

	// Load the file
	bool Load(char *fileName);

	// Write to the file
	bool Write(char *filename, uint widht, uint height, uint screenBpp);

	// 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);

	// Draw it to the screen
	void Draw(uint xPos, uint yPos);

	// Destroy the TGA (so that the same object can be re-used)
	void Destroy();

	// Return width/height and bit depth
	uint Width()	{ return imageWidth; }
	uint Height()	{ return imageHeight; }
	byte Bpp()		{ return bitCount; }
	uint Size()		{ return imageSize; }

	// Return the image
	byte *Image() { return imageData; }
	byte Image(int index) { return imageData[index]; }

private:

	bool LoadRLE(ifstream &file);
	bool LoadNormal(ifstream &file);

	byte	imageTypeCode;
	byte	bitCount;
	byte	*imageData;
	uint	imageWidth;
	uint	imageHeight;
	uint	imageSize;
};

#endif

⌨️ 快捷键说明

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