Hi,
Also mit dem Linken funktioniert es wenn ich im Linker bei zusätzlichen optionen "Irrlicht" eingeben, es funktioniert aber auch wenn man die .dll in das bin verzeichniss kopiert und dann zu "lirrlicht.dll" umbenennt!
Wenn jemand meinen Code kopiert ists mir egal ist sowieso zu 40% fertig
Hier mal der Source code:
Code:
#include <windows.h>
#include <time.h>
#include <irrlicht.h>
#include <irrKlang.h>
#include <winsock.h>
#include "GL\PostProcessBloom.h"
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
using namespace audio;
IrrlichtDevice *device = 0;
s32 cnt = 0;
IGUIListBox* listbox = 0;
int main()
{
IrrlichtDevice *device = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(1280, 1024),32, true, true,true,0);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
ISoundEngine* engine = createIrrKlangDevice();
device->setWindowCaption(L"Spiel");
device->getFileSystem()->addZipFileArchive("./Data/map1.pk3");
scene::IAnimatedMesh* q3levelmesh = smgr->getMesh("20kdm2.bsp");
scene::ISceneNode* q3node = 0;
if (q3levelmesh)
q3node = smgr->addOctTreeSceneNode(q3levelmesh->getMesh(0));
scene::ITriangleSelector* selector = 0;
if (q3node)
{
q3node->setPosition(core::vector3df(-1370,-130,-1400));
selector = smgr->createOctTreeTriangleSelector(
q3levelmesh->getMesh(0), q3node, 128);
q3node->setTriangleSelector(selector);
selector->drop();
}
IPostProcessBloom *Bloom = new IPostProcessBloom(smgr->getRootSceneNode(), smgr, 666);
PPE_Bloom_Setup setup;
setup.sampleDist=0.008;
setup.strength=3;
setup.multiplier=5;
Bloom->initiate(1280,1024,setup,smgr);
device->getCursorControl()->setVisible(false);
scene::IBillboardSceneNode * bill = smgr->addBillboardSceneNode();
bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR );
bill->setMaterialFlag(video::EMF_LIGHTING, false);
bill->setSize(core::dimension2d<f32>(20.0f, 20.0f));
video::SMaterial material;
material.Textures[0] = driver->getTexture("./Data/faerie.bmp");
material.Lighting = true;
scene::IAnimatedMesh* faerie = smgr->getMesh("./Data/faerie.md2");
SKeyMap keyMap[10];
keyMap[0].Action = EKA_MOVE_FORWARD;
keyMap[0].KeyCode = KEY_KEY_W;
keyMap[1].Action = EKA_MOVE_BACKWARD;
keyMap[1].KeyCode = KEY_KEY_S;
keyMap[2].Action = EKA_STRAFE_LEFT;
keyMap[2].KeyCode = KEY_KEY_A;
keyMap[3].Action = EKA_STRAFE_RIGHT;
keyMap[3].KeyCode = KEY_KEY_D;
keyMap[4].Action = EKA_JUMP_UP;
keyMap[4].KeyCode = KEY_SPACE;
IAnimatedMeshSceneNode *object1 = smgr->addAnimatedMeshSceneNode(faerie);
object1->setPosition(core::vector3df(-70,0,-90));
object1->setMD2Animation(scene::EMAT_RUN);
ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS(0, 100, 500, -1, keyMap, 10,true,0.5f);
cam->addChild(object1);
object1->setVisible(false);
object1->getMaterial(0) = material;
scene::ISceneNodeAnimator* anim =
smgr->createCollisionResponseAnimator(
selector, cam, core::vector3df(30,30,30),
core::vector3df(0,-3,0),
core::vector3df(0,30,0));
cam->addAnimator(anim);
anim->drop();
IAnimatedMeshSceneNode *object2 = smgr->addAnimatedMeshSceneNode(faerie);
ITriangleSelector* triangel = smgr->createTriangleSelector(faerie->getMesh(0, 255, -1, -1),object2);
object2->setPosition(core::vector3df(-70,0,-90));
object2->setMD2Animation(scene::EMAT_RUN);
object2->setTriangleSelector(triangel);
object2->getMaterial(0) = material;
material.Textures[0] = 0;
material.Lighting = true;
smgr->addLightSceneNode(0, core::vector3df(-60,100,400),
video::SColorf(1.0f,1.0f,1.0f,1.0f),
600.0f);
scene::ISceneNode* selectedSceneNode = 0;
scene::ISceneNode* lastSelectedSceneNode = 0;
time_t last = 0;
time_t yet = 0;
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);
driver->setRenderTarget(Bloom->rt0, true, true, video::SColor(0,0,0,0));
smgr->drawAll();
driver->setRenderTarget(0);
Bloom->render();
core::line3d<f32> line;
line.start = cam->getPosition();
line.end = line.start +
(cam->getTarget() - line.start).normalize();
core::vector3df intersection;
core::triangle3df tri;
if (smgr->getSceneCollisionManager()->getCollisionPoint(
line, selector, intersection, tri))
{
driver->setTransform(video::ETS_WORLD, core::matrix4());
driver->setMaterial(material);
}
core::vector3df intersection2;
core::triangle3df tri2;
if(GetAsyncKeyState(VK_ESCAPE)) {
if( IDYES == MessageBox(GetFocus(),"Wollen sie dieses Programm wirklich beenden?", "Programm beenden?", MB_YESNO) )
{
return 1;
}
}
if(GetAsyncKeyState(VK_LBUTTON)) {
yet = timeGetTime();
time_t current = yet - last;
if(current >= 1000) {
last = timeGetTime();
engine->play2D("./Data/shoot.ogg");
line.start = cam->getPosition();
line.end = line.start + (cam->getTarget() - line.start).normalize() * 1000.0f;
if (smgr->getSceneCollisionManager()->getCollisionPoint(
line, selector, intersection2, tri2))
{
bill->setPosition(intersection2);
driver->setTransform(video::ETS_WORLD, core::matrix4());
driver->setMaterial(material);
}
}
}
object2->setPosition(core::vector3df(-70,0,-90));
driver->endScene();
}
engine->drop();
device->drop();
return 0;
}
Ich weiß nicht ob es darran liegt, es kann sein das beim kopieren was schiefging den die alte HDD war defekt und es schwer an die Daten ran zu kommen! Aber dieser Code lief auf dem alten Rechner!
MFG ReduX