But Irrlicht said that he cant load the file.
I try to debug but i dont know why it doesnt work.
Here is my code:
Code: Select all
**********************************
main.h
#ifndef __MAIN_H__
#define __MAIN_H__
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#endif
**********************************
main.cpp
#pragma comment(lib, "irrlicht.lib")
#include <windows.h>
#include <commctrl.h>
#include "main.h"
OPENFILENAME ofn; // common dialog box structure
char szFile[260]; // buffer for filename
c8 IrrlichtImageFile[260];
HANDLE hf; // file handle
IVideoDriver* driver = 0;
ICameraSceneNode* Camera = 0;
IParticleSystemSceneNode *Particle=0;
IParticleSystemSceneNode* ps = 0;
IParticleEmitter* em = 0;
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
IrrlichtDevice *device =createDevice(video::EDT_DIRECTX9, core::dimension2d<s32>(800, 600), 32, false,false,false,0);
driver = device->getVideoDriver();
SExposedVideoData VideoData=driver->getExposedVideoData();
HWND Hwnd = reinterpret_cast<HWND>(VideoData.OpenGLWin32.HWnd);
strcpy(szFile,"particle.bmp");
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = Hwnd;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "bmp\0*.bmp\0jpeg\0*.jpg\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST;
if (GetOpenFileName(&ofn)==TRUE)
{
hf = CreateFile(ofn.lpstrFile, GENERIC_READ,
0, (LPSECURITY_ATTRIBUTES) NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL);
strcpy(szFile,ofn.lpstrFile);
}
for (int f=0;f<(signed)strlen(szFile);f++)
{
IrrlichtImageFile[f]=szFile[f];
if(szFile[f]=='\\') IrrlichtImageFile[f]='/';
}
strlwr(IrrlichtImageFile);
scene::ISceneManager* smgr = device->getSceneManager();
Camera= smgr->addCameraSceneNode(0,vector3df(0,0,1000),vector3df(0,0,0),0);
// create a particle system
ps = smgr->addParticleSystemSceneNode(false);
ps->setPosition(core::vector3df(0,0,0));
ps->setScale(core::vector3df(10,10,10));
ps->setParticleSize(core::dimension2d<f32>(20.0f, 10.0f));
em = ps->createBoxEmitter(
core::aabbox3d<f32>(-1,0,-1,1,1,1),
core::vector3df(0.001f,0.001f,0.001f),
50,60,
video::SColor(0,100,100,100), video::SColor(0,0,0,0),
1000,1000,0);
ps->setEmitter(em);
em->drop();
ps->setMaterialFlag(video::EMF_LIGHTING, false);
ps->setMaterialTexture(0, driver->getTexture(IrrlichtImageFile));
ps->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
while(device->run())
{
driver->beginScene(true, true, 0);
smgr->drawAll();
driver->endScene();
}
em->drop();
device->drop();
return 0;
}
**********************************