I have the next three files:
main.cpp
Code: Select all
#include <irrlicht.h>
#include "game.h"
using namespace irr;
int main()
{
ggame *game;
game -> init();
game -> run();
return 0;
}Code: Select all
#ifndef _GMAE_H_
#define _GAME_H_
#include <irrlicht.h>
using namespace irr;
class ggame
{
struct ssettings
{
bool fullscreen;
int scrHeight;
int scrWidth;
int scrBPP;
} settings;
IrrlichtDevice *device;
video::IVideoDriver *driver;
scene::ISceneManager *smgr;
io::IFileSystem *fileSys;
gui::ICursorControl *cursor;
public:
void init();
// getting the settings ... those that are there so far
bool isFulscreen();
int getScrHeight();
int getScrWidth();
int getScrBPP();
void run();
};
#endifCode: Select all
#include "game.h"
#include <irrlicht.h>
using namespace std;
void ggame::init()
{
device = createDevice(video::EDT_OPENGL,
core::dimension2d<u32>(640,480));
driver = device -> getVideoDriver();
smgr = device -> getSceneManager();
fileSys = device -> getFileSystem();
cursor = device -> getCursorControl();
}
bool ggame::isFulscreen()
{
return settings.fullscreen;
}
int ggame::getScrHeight()
{
return settings.scrHeight;
}
int ggame::getScrWidth()
{
return settings.scrWidth;
}
int ggame::getScrBPP()
{
return settings.scrBPP;
}
void ggame::run()
{
device -> setWindowCaption(L"Title");
smgr->addCameraSceneNodeFPS();
while(device->run() && driver)
{
driver->beginScene(true, true, video::SColor(255,0,0,255));
smgr->drawAll();
driver->endScene();
}
device->drop();
}The codeblocks debugger doesn't seem to point at the problem, i only found it by using the exit function.
Can anyone help me and explain what's wrong with it?