First-chance exception at 0x013d3649 in Com S 309 Project.exe: 0xC0000005: Access violation reading location 0x0021005d.
Unhandled exception at 0x013d3649 in Com S 309 Project.exe: 0xC0000005: Access violation reading location 0x0021005d.
my code is as follows:(not all of my code)
Code: Select all
TitleScreen title(device);
ISceneManager* smgr = title.ChangeScene();
IGUIEnvironment* guien = title.ChangeText();
ICursorControl* cursor = device->getCursorControl();
cursor->setVisible(false);
IGUIImage* image = guien->addImage(driver->getTexture("../media/cursor.tga"), position2d<s32>(0, 0));
ICameraSceneNode* camera = smgr->addCameraSceneNode(0, core::vector3df(0, 0, 0), core::vector3df(0, 0, -5));
while(device->run()){
if(currentState == -1){
break;
}
if(currentState == STATE_1 && receiver.IsKeyDown(KEY_RETURN)){
currentState = STATE_2;
}
if(currentState == STATE_2 && receiver.GetMouseState().LeftButtonDown){
currentState = STATE_3;
}
if(currentState == STATE_2 && receiver.IsKeyDown(KEY_ESCAPE)){
currentState = -1;
}
if(currentState == STATE_3 && receiver.IsKeyDown(KEY_ESCAPE)){
currentState = -1;
}
// if(currentState == STATE_4 && receiver.IsKeyDown(KEY_ESCAPE)){
// currentState = STATE_3;
// }
// if(currentState == STATE_4 && receiver.GetMouseState().LeftButtonDown){
// currentState= STATE_2;
// }
if(currentState != lastState){
if(currentState == STATE_2){
mainMenu menu(device);
smgr = menu.ChangeScene();
guien = menu.ChangeText();
lastState = currentState;
}else if(currentState ==STATE_3){
GameWorld game(device);
smgr = game.ChangeScene();
guien->clear();
camera = game.ChangeCamera(keyMap);
lastState = currentState;
}else if(currentState == STATE_4){
guien->clear();
guien->addStaticText(L"You are now in Game Menu\n press escape to get back to Game World, or left click to go back to Main Menu.", rect<s32>(480, 200, 1440, 300), false, true);
lastState = currentState;
}
}
driver->beginScene(true, true, SColor(255, 100, 101, 140));
int x = cursor->getPosition().X;
int y = cursor->getPosition().Y;
image->setRelativePosition(position2di(x, y));
smgr->drawAll();
guien->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
edit: put code tags in...sorry