Problem with IrrlichtDevice.H

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
JumaGames
Posts: 7
Joined: Thu Sep 24, 2009 1:24 pm

Problem with IrrlichtDevice.H

Post by JumaGames »

Problem with IrrlichtDevice.H

This is my failt Code:
------ Erstellen gestartet: Projekt: 11.PerPixelLighting_vc9, Konfiguration: Debug Win32 ------
Kompilieren...
main.cpp
c:\programme\irrlicht-1.5\include\irrlichtdevice.h(220) : error C2065: 'SJoystickInfo': nichtdeklarierter Bezeichner
Das Buildprotokoll wurde unter "file://c:\Programme\irrlicht-1.5\examples\11.PerPixelLighting\Debug\BuildLog.htm" gespeichert.
11.PerPixelLighting_vc9 - 1 Fehler, 0 Warnung(en)
========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========
sry i am geman =D

and can't translate it :(
-insane-
Posts: 18
Joined: Tue Aug 04, 2009 4:41 pm
Location: Germany

Post by -insane- »

Haste vielleicht paar usings vergessen?

glaub das sollte helfen:

Code: Select all

using namespace irr;
using namespace io;
JumaGames
Posts: 7
Joined: Thu Sep 24, 2009 1:24 pm

Post by JumaGames »

Ohh ja danke

zum glück gibt es hier auch deutsche =D

gibt es auch deutsche irrlicht Forum

auser Irrlicht3d den da geht das Forum zurzeit nicht =D :(



Edit

Das ist mein code des Klapt nicht

Code: Select all

#include <irrlicht.h>
#include <iostream>

using namespace irr;

#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif


class MyEventReceiver : public IEventReceiver
{
public:

	MyEventReceiver(scene::ISceneNode* terrain, scene::ISceneNode* skybox, scene::ISceneNode* skydome) :
		Terrain(terrain), Skybox(skybox), Skydome(skydome), showBox(true)
	{
		Skybox->setVisible(true);
		Skydome->setVisible(false);
	}

	bool OnEvent(const SEvent& event)
	{
		// check if user presses the key 'W' or 'D'
		if (event.EventType == irr::EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown)
		{
			switch (event.KeyInput.Key)
			{
			case irr::KEY_KEY_W: // switch wire frame mode
				Terrain->setMaterialFlag(video::EMF_WIREFRAME,
						!Terrain->getMaterial(0).Wireframe);
				Terrain->setMaterialFlag(video::EMF_POINTCLOUD, false);
				return true;
			case irr::KEY_KEY_P: // switch wire frame mode
				Terrain->setMaterialFlag(video::EMF_POINTCLOUD,
						!Terrain->getMaterial(0).PointCloud);
				Terrain->setMaterialFlag(video::EMF_WIREFRAME, false);
				return true;
			case irr::KEY_KEY_D: // toggle detail map
				Terrain->setMaterialType(
					Terrain->getMaterial(0).MaterialType == video::EMT_SOLID ?
					video::EMT_DETAIL_MAP : video::EMT_SOLID);
				return true;
			case irr::KEY_KEY_S: // toggle skies
				showBox=!showBox;
				Skybox->setVisible(showBox);
				Skydome->setVisible(!showBox);
				return true;
			default:
				break;
			}
		}

		return false;
	}

private:
	scene::ISceneNode* Terrain;
	scene::ISceneNode* Skybox;
	scene::ISceneNode* Skydome;
	bool showBox;
};


/*
The start of the main function starts like in most other example. We ask the user
for the desired renderer and start it up.
*/
int main()
{
	// let user select driver type

	video::E_DRIVER_TYPE driverType = video::EDT_DIRECT3D9;


	IrrlichtDevice* device = createDevice(video::EDT_DIRECT3D9,
			core::dimension2d<s32>(640, 480));

	if (device == 0)
		return 1; // could not create selected driver.

	
	/*
	First, we add standard stuff to the scene: A nice irrlicht engine
	logo, a small help text, a user controlled camera, and we disable
	the mouse cursor.
	*/

	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();
	gui::IGUIEnvironment* env = device->getGUIEnvironment();

	driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);

	// add camera
	scene::ICameraSceneNode* camera =
		smgr->addCameraSceneNodeFPS(0,100.0f,1.2f);

	camera->setPosition(core::vector3df(2700*2,255*2,2600*2));
	camera->setTarget(core::vector3df(2397*2,343*2,2700*2));
	camera->setFarValue(42000.0f);

	// disable mouse cursor
	device->getCursorControl()->setVisible(false);

	/*
	Here comes the terrain renderer scene node: We add it just like any
	other scene node to the scene using
	ISceneManager::addTerrainSceneNode(). The only parameter we use is a
	file name to the heightmap we use. A heightmap is simply a gray scale
	texture. The terrain renderer loads it and creates the 3D terrain from
	it.

	To make the terrain look more big, we change the scale factor of
	it to (40, 4.4, 40). Because we don't have any dynamic lights in the
	scene, we switch off the lighting, and we set the file
	terrain-texture.jpg as texture for the terrain and detailmap3.jpg as
	second texture, called detail map. At last, we set the scale values for
	the texture: The first texture will be repeated only one time over the
	whole terrain, and the second one (detail map) 20 times.
	*/

	// add terrain scene node
	scene::ITerrainSceneNode* terrain = smgr->addTerrainSceneNode(
		"../../media/terrain-heightmap.bmp",
		0,					// parent node
		-1,					// node id
		core::vector3df(0.f, 0.f, 0.f),		// position
		core::vector3df(0.f, 0.f, 0.f),		// rotation
		core::vector3df(40.f, 4.4f, 40.f),	// scale
		video::SColor ( 255, 255, 255, 255 ),	// vertexColor
		5,					// maxLOD
		scene::ETPS_17,				// patchSize
		4					// smoothFactor
		);

	terrain->setMaterialFlag(video::EMF_LIGHTING, false);

	terrain->setMaterialTexture(0,
			driver->getTexture("../../media/terrain-texture.jpg"));
	terrain->setMaterialTexture(1,
			driver->getTexture("../../media/detailmap3.jpg"));
	
	terrain->setMaterialType(video::EMT_DETAIL_MAP);

	terrain->scaleTexture(1.0f, 20.0f);
	//terrain->setDebugDataVisible ( true );

	/*
	To be able to do collision with the terrain, we create a triangle selector.
	If you want to know what triangle selectors do, just take a look into the
	collision tutorial. The terrain triangle selector works together with the
	terrain. To demonstrate this, we create a collision response animator
	and attach it to the camera, so that the camera will not be able to fly
	through the terrain.
	*/

	// create triangle selector for the terrain	
	scene::ITriangleSelector* selector
		= smgr->createTerrainTriangleSelector(terrain, 0);
	terrain->setTriangleSelector(selector);

	// create collision response animator and attach it to the camera
	scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
		selector, camera, core::vector3df(60,100,60),
		core::vector3df(0,0,0),
		core::vector3df(0,50,0));
	selector->drop();
	camera->addAnimator(anim);
	anim->drop();

	/* If you need access to the terrain data you can also do this directly via the following code fragment.
	*/
	scene::CDynamicMeshBuffer* buffer = new scene::CDynamicMeshBuffer(video::EVT_2TCOORDS, video::EIT_16BIT);
	terrain->getMeshBufferForLOD(*buffer, 0);
	video::S3DVertex2TCoords* data = (video::S3DVertex2TCoords*)buffer->getVertexBuffer().getData();
	// Work on data or get the IndexBuffer with a similar call.
	buffer->drop(); // When done drop the buffer again.

	/*
	To make the user be able to switch between normal and wireframe mode,
	we create an instance of the event reciever from above and let Irrlicht
	know about it. In addition, we add the skybox which we already used in
	lots of Irrlicht examples and a skydome, which is shown mutually
	exclusive with the skybox by pressing 'S'.
	*/

	// create skybox and skydome
	driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);

	/*
	That's it, draw everything.
	*/

	int lastFPS = -1;

	while(device->run())
	if (device->isWindowActive())
	{
		driver->beginScene(true, true, 0 );

		smgr->drawAll();
		env->drawAll();

		driver->endScene();

		// display frames per second in window title
		int fps = driver->getFPS();
		if (lastFPS != fps)
		{
			core::stringw str = L"Terrain Renderer - Irrlicht Engine [";
			str += driver->getName();
			str += "] FPS:";
			str += fps;
			// Also print terrain height of current camera position
			// We can use camera position because terrain is located at coordinate origin
			str += " Height: ";
			str += terrain->getHeight(camera->getAbsolutePosition().X,
					camera->getAbsolutePosition().Z);

			device->setWindowCaption(str.c_str());
			lastFPS = fps;
		}
	}

	device->drop();
	
	return 0;
}
mfg Juma
-insane-
Posts: 18
Joined: Tue Aug 04, 2009 4:41 pm
Location: Germany

Post by -insane- »

Was klappt da denn jetzt nicht?

EDIT: Andere deutsche Foren kenne ich jetzt nicht, wenn du bei Google keine findest, gibt es auch keine anderen.
JumaGames
Posts: 7
Joined: Thu Sep 24, 2009 1:24 pm

Post by JumaGames »

immer noch das slbe und ich bekomme den fehler auch wenn ich beispiel projecte machen will schreib mich mal in einen massager an =D

ICQ 463399491

Skype juamdot

Hoffe du hast einen von den beiden
-insane-
Posts: 18
Joined: Tue Aug 04, 2009 4:41 pm
Location: Germany

Post by -insane- »

Sorry, aber ich kann doch nicht jeden gleich adden, der ein Problem hat, dafür ist doch das Forum da ^^

Also für mich sieht das so aus, dass dein irrlicht Ordner fehlerhaft ist. Vielleicht solltest du den nochmal runterladen und dann gleich das Beispiel neu kompilieren.
JumaGames
Posts: 7
Joined: Thu Sep 24, 2009 1:24 pm

Post by JumaGames »

Hab ich gemacht jetzt gehts aber jetzt hab ich dieses Problem wenn ich die .exe öffne

Image
-insane-
Posts: 18
Joined: Tue Aug 04, 2009 4:41 pm
Location: Germany

Post by -insane- »

Und was sagt der Debugger?
JumaGames
Posts: 7
Joined: Thu Sep 24, 2009 1:24 pm

Post by JumaGames »

Bei diesen stellen hällt er an

env->addImage(driver->getTexture("../../media/irrlichtlogo2.png"),core::position2d<s32>(10,10));

dann noch da wenn ich weiter mache

camera->setFarValue(42000.0f);

und bei ISceneNode.h

void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
{
for (u32 i=0; i<getMaterialCount(); ++i)
getMaterial(i).setFlag(flag, newvalue);
}

-.-
-insane-
Posts: 18
Joined: Tue Aug 04, 2009 4:41 pm
Location: Germany

Post by -insane- »

Mh ich geh mal davon aus, dass du den Code nur kopiert hast aus zuverlässigen Quellen. Es ist sehr merkwürdig, dass dabei Fehler auftreten. Vielleicht hilft dir das hier weiter:
http://support.microsoft.com/kb/822039
Ansonsten würde ich mal bei c-plusplus.de im Forum nachfragen, da sprechen alle Deutsch und die kennen sich mit solchen Debug Problemen etwas besser aus.
Notfalls könntest du noch versuchen dein Projekt als Release zu kompilieren. Kann sein, dass das Programm läuft, aber das sollte nur eine vorläufige Lösung sein, das Problem muss auf jeden Fall behoben werden.
JumaGames
Posts: 7
Joined: Thu Sep 24, 2009 1:24 pm

Post by JumaGames »

ja ok danke
CuteAlien
Admin
Posts: 9930
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Ich tippe auf Versionsmischmasch. Z.b. compiliert mit neuen Headern, aber versehentlich noch alte DLL irgendwo rumliegen die dann zur Laufzeit verwendet wird.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply