IrrLicht引擎研究
鬼火引擎研究
1 使用工具将文件转为字节数组,这里用[bin2h.exe]
    比如准备个文件 testpng.png
    使用命令
        bin2h testpng.png
    将生成 testpng.h,内容如下
        unsigned int testpng_size=<size>;
        unsigned char testpng[]={...};
2 将文件加入到工程中
    使用如下代码获取ITextrue接口,env为IGUIEnvironment
    //包含文件
    #include "testpng.h"
    ....
    //获得文件系统
     IFileSystem * pFS = env->getFileSystem();
    //创建读文件接口,这里特别注意第3个参数,其后缀一定要和文件格式一致,如果用的是bmp,则应该是testpng.bmp
     IReadFile * pMFR = pFS->createMemoryReadFile(testpng,testpng_size,"testpng.png",false);
    //获取Texture
     ITexture * pTxtPng = driver->getTexture(pMFR);
3 使用pTxtPng

posted on 2008-01-13 15:26  安徽飞雪游戏工作室  阅读(954)  评论(0编辑  收藏  举报