It is not so that I never heard anything about OOP. I already trusted in OOP.
But there I had a problem that confusing me.
The code of scene.cpp:
Code: Select all
void makeScene()
{
scene::ITerrainSceneNode* terrain = smgr->addTerrainSceneNode("heightmap.tga");;
terrain->setScale(core::vector3df(40, 4.4f, 40));
terrain->setMaterialFlag(video::EMF_LIGHTING, false);
terrain->setMaterialTexture(0, driver->getTexture("stein8.jpg"));
terrain->setMaterialTexture(1, driver->getTexture("leaves.jpg"));
terrain->setMaterialType(video::EMT_DETAIL_MAP);
terrain->scaleTexture(80.0f, 40.0f);
}
main.cpp
Code: Select all
#include <cstdlib>
#include <iostream.h>
#include <irrlicht.h>
#include "scene.cpp"
using namespace std;
using namespace irr;
using namespace core;
using namespace gui;
using namespace io;
using namespace scene;
using namespace video;
int main(int argc, char *argv[])
{
IrrlichtDevice *device = createDevice(EDT_OPENGL,
dimension2d<s32>(640, 480), 16, false, false, false, 0);
IVideoDriver *driver = device->getVideoDriver();
ISceneManager *smgr = device->getSceneManager();
IGUIEnvironment *guienv = device->getGUIEnvironment();
makeScene();
[...]
}
The error messages:
`smgr' undeclared (first use this function)
´driver' undeclared (first use this function)
and so on
I knew what the messages mean, but I don`t know why they appear and how to fix them.
Thank you.