Hi,
Bis jetzt habe ich immer ohne OOP gearbeitet wollte mich nun umstellen in einem anderen Projekt doch das programm stürzt beim ausführen ab
Hier mal der Code vom Test Programm:
Code:
#include <irrlicht.h>
#include <Windows.h>
#include <string>
using namespace irr;
using namespace gui;
using namespace std;
video::IVideoDriver* driver = 0;
IrrlichtDevice *device = 0;
scene::ISceneManager* smgr = 0;
IGUIEnvironment* env = 0;
DWORD destSize=100;
int screenx = 1024;
int screeny = 768;
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if(event.EventType == EET_GUI_EVENT)
{
IGUIEnvironment* env = device->getGUIEnvironment();
s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType)
{
}
}
if(event.EventType == irr::EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown)
{
switch(event.KeyInput.Key)
{
}
}
return false;
}
};
class dev
{
private:
char UP[100];
char DOWN[100];
char LEFT[100];
char RIGHT[100];
char ALT[100];
char PRIM[100];
MyEventReceiver receiver;
public:
void makedev(int x,int y,int bit)
{
IrrlichtDevice *device = createDevice(video::EDT_OPENGL,core::dimension2d<s32>(x, y),bit,true,true,true,&receiver);
driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* env = device->getGUIEnvironment();
device->setWindowCaption(L"Test Programm");
}
void deldev()
{
device->drop();
}
void load()
{
screenx = GetSystemMetrics(SM_CXVIRTUALSCREEN);
screeny = GetSystemMetrics(SM_CYVIRTUALSCREEN);
GetPrivateProfileString("config","UP","NULL",UP,destSize,"config.ini");
GetPrivateProfileString("config","DOWN","NULL",DOWN,destSize,"config.ini");
GetPrivateProfileString("config","LEFT","NULL",LEFT,destSize,"config.ini");
GetPrivateProfileString("config","RIGHT","NULL",RIGHT,destSize,"config.ini");
GetPrivateProfileString("config","ALT","NULL",ALT,destSize,"config.ini");
GetPrivateProfileString("config","PRIM","NULL",PRIM,destSize,"config.ini");
}
};
int main()
{
dev grund;
grund.load();
grund.makedev(screenx,screeny,32);
grund.deldev();
return 0;
}
Compiler meldet keinen Fehler aber es stürzt beim Ausführen ab!
MFG ReduX