Unhandled exception at 0x00411613 in Irrlicht Pong.exe: 0xC0000005: Access violation writing location 0x00000001.. Here is my code:
Code: Select all
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace video;
using namespace gui;
using namespace scene;
using namespace io;
#pragma comment(lib, "Irrlicht.lib")
bool keys[irr::KEY_KEY_CODES_COUNT];
class MyEventReceiver : public IEventReceiver {
public:
bool OnEvent(SEvent event) {
if(event.EventType == irr::EET_KEY_INPUT_EVENT){
keys[event.KeyInput.Key] = event.KeyInput.PressedDown;
return false;
}
return false;
}
};
struct PADDLE1
{
ITexture* tex;
s32 x, y;
};
int main(PADDLE1* p1)
{
IrrlichtDevice *device = createDevice(EDT_DIRECT3D9);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
device->setWindowCaption(L"Irrlicht Pong Game");
//not part of the code but this is where it messes up in front of the arrow-> p1->tex = driver->getTexture("../../Media/Player1paddle.jpg");
p1->x = 100;
p1->y = 200;
while(device->run() && driver)
{
if (device->isWindowActive())
{
u32 time = device->getTimer()->getTime();
driver->beginScene(true, true, video::SColor(0,120,102,136));
driver->draw2DImage(p1->tex,position2d<s32>(p1->x,p1->y));
driver->endScene();
}
}
device->drop();
return 0;
}