So this is what i've done so far. I've created a class called engine which creates a device, scene manager and video driver. This all works fine but when i try to create a void function which has the game loop in it i get errors.
here is the code:
engine.h
Code: Select all
#pragma once
#include<irrlicht.h>
class engine
{
public:
engine();
scene::ISceneManager* smgr;
video::IVideoDriver *driver;
void engine::loop();
private:
IrrlichtDevice *device;
};
Code: Select all
#include "engine.h"
#include<irrlicht.h>
#include "createTerrain.h"
using namespace irr;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#endif
engine::engine()
{
IrrlichtDevice *device = createDevice(video::EDT_OPENGL,
core::dimension2d<u32>(640, 480), 16,false, false, false, 0);
driver=device->getVideoDriver();
smgr=device->getSceneManager();
}
void engine::loop(){
while(device->run())
{
driver->beginScene(true,true,video::SColor(255,100,101,140));
smgr->drawAll();
driver->endScene();
}
device->drop();
}
Error:Expression must have pointer to class type
I know i have probably missed some basic fundementals of c++ but i cant figure it out
If possible could you point me in the right direction instead of giving me a direct answer so that i can solve it myself. unless this is a really stupid question and the answer is really straightforward