I hope that maybe you'll point me in right direction, because I have no idea what to do.
I had to write a specific game with couple requirements and last of them was that it should compile in Visual Studio 2005 or 2008. I normally use CodeBlocks, so I thought I will migrate my project when it's finished because it should be easy. And so I did, my game works fine in CodeBlocks and finally I installed VS 2008 and tried to migrate it. I added include patch, libraries, example project was compiling well. And so did my project, it compiles, but constantly throws me errors when debugging.
Errors occur, when I'm trying to use any of my classes created for nodes etc that I use, for example event receiver, terrain, scene nodes and so on, every "block" has it own class for easier development. For example class CTerrain looks like this:
CTerrain.h
Code: Select all
// CTerrain - class for terrain node
#include <irrlicht.h>
using namespace irr;
class CTerrain {
private:
scene::ITerrainSceneNode* m_terrain;
scene::ITriangleSelector* m_selector;
public:
// Constructor
CTerrain(scene::ISceneManager* smgr, video::IVideoDriver* driver);
// Destructor
~CTerrain();
// GetPtr - returns pointer to ITerrainSceneNode object
scene::ITerrainSceneNode* GetPtr();
// GetSelector - returns triangle selector connected with ITerrainSceneNode object
scene::ITriangleSelector* GetSelector();
};
Code: Select all
#include "CConfig.h"
#include "CTerrain.h"
// CONSTRUCTOR
CTerrain::CTerrain(scene::ISceneManager* smgr, video::IVideoDriver* driver) {
m_terrain = smgr->addTerrainSceneNode(
"textures/terrain_heightmap.png", // heightmap
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( // scale
CConfig::CITY_X*CConfig::TILE_SCALE,
CConfig::TILE_SCALE,
CConfig::CITY_Y*CConfig::TILE_SCALE),
video::SColor ( 255, 255, 255, 255 ), // vertexColor
5, // maxLOD
scene::ETPS_17, // patchSize
4 // smoothFactor
);
m_terrain->setMaterialFlag(video::EMF_LIGHTING, CConfig::LIGHT);
m_terrain->setMaterialTexture(0, driver->getTexture("textures/terrain_texture.jpg"));
m_terrain->setMaterialType(video::EMT_DETAIL_MAP);
m_terrain->scaleTexture(CConfig::TEXTURE_SCALE);
// triangle selector
m_selector = smgr->createTerrainTriangleSelector(m_terrain, 0);
m_terrain->setTriangleSelector(m_selector);
}
// GetPtr - returns pointer to ITerrainSceneNode object
scene::ITerrainSceneNode* CTerrain::GetPtr() {
return m_terrain;
}
// GetSelector - returns triangle selector connected with ITerrainSceneNode object
scene::ITriangleSelector* CTerrain::GetSelector() {
return m_selector;
}
Code: Select all
CTerrain* terrain = new CTerrain(smgr, driver);
"Unhandled exception at 0x6965685f in Game.exe: 0xC0000005: Access violation."
And I'm stuck, I have no idea where to try. I feel that it's something about technical issues, environment configuration of something like that and I'm not so good at this kind of stuff :l
Thanks in advance for any help.
Best regards,
wzerek