66 lines
1004 B
C++
66 lines
1004 B
C++
#pragma once
|
|
#include <map>
|
|
#include <string>
|
|
#include <windows.h>
|
|
#include <iostream>
|
|
#include <zlib.h>
|
|
|
|
#define NPK_R_FLAG(b){if(!b)continue;}
|
|
|
|
//PNG结构体
|
|
struct ImgInfo
|
|
{
|
|
//图片格式
|
|
int Type;
|
|
//压缩类型
|
|
int CmpType;
|
|
//宽度
|
|
int Width;
|
|
//高度
|
|
int Height;
|
|
//大小
|
|
int Size;
|
|
//Xpos
|
|
int Xpos;
|
|
//Ypos
|
|
int Ypos;
|
|
//帧域X
|
|
int FrameXpos;
|
|
//帧域Y
|
|
int FrameYpos;
|
|
//偏移
|
|
int Offset;
|
|
//Png位图数据
|
|
BYTE* PNGdata;
|
|
};
|
|
|
|
struct NpkInfo
|
|
{
|
|
int Offset;
|
|
int Length;
|
|
std::string Path;
|
|
};
|
|
|
|
struct IMG //npk的img的结构体
|
|
{
|
|
std::string lpImgName; //img文件的路径
|
|
int img_index; //img文件在npk文件里的序号
|
|
unsigned imgOffset;
|
|
unsigned imgSize;
|
|
std::string lpBelongsFile; //这个img属于哪个npk文件
|
|
int png_sum; //这个img文件有多少个 图片
|
|
ImgInfo* lp_lplist; //图片的数组..
|
|
};
|
|
|
|
class NPK_M {
|
|
private:
|
|
std::map <std::string, IMG> map_npk;
|
|
public:
|
|
NPK_M();
|
|
void init();
|
|
LPDWORD LoadImgToMem(IMG* p);
|
|
IMG* ReadNpkTable(const std::string imgname);
|
|
void ReleaseNpkTable(IMG* p);
|
|
~NPK_M();
|
|
};
|