Gui -> addWindow -> no close button and how close from
-
knightoflight
- Posts: 199
- Joined: Sun Aug 24, 2003 5:47 pm
- Location: Germany
Gui -> addWindow -> no close button and how close from
again beginner questions - i cant find, maybe im blind ;-)
- how can i switch off the close button from the window, of have i to screw in the irrlichtengine ?
- how can i close the window from program ? i tried destructor, but doesnt work, or ???
- how can i switch off the close button from the window, of have i to screw in the irrlichtengine ?
- how can i close the window from program ? i tried destructor, but doesnt work, or ???
-
knightoflight
- Posts: 199
- Joined: Sun Aug 24, 2003 5:47 pm
- Location: Germany
i was blind, ok, the remove is in the docu, but if i try, i get a
"Debug Assertion Failed !
File dbgdel.cpp line 47
Expression _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)"
heres the code, i press ESC the window opens, the FPS-camera ist stopped,
i click on continue, the FPS-camera ist started, the computer crashes, have it to remove the buttons, too?:
...
switch(event.GUIEvent.EventType)
{
case EGET_BUTTON_CLICKED:
...
if (id == 107)
{
smgr->setActiveCamera(camera);
window->remove();
return true;
}
}
}
...
switch(event.KeyInput.Key)
{
case KEY_ESCAPE:
{
smgr->setActiveCamera(0);
window = guienv->addWindow(
rect<s32>(50 , 50 , 400 , 300 ), 0, -1, L"Menu");
guienv->addButton(rect<s32>(30,30,100,60), window, 104, "End game");
guienv->addButton(rect<s32>(30,70,100,100), window, 105, L"Load");
guienv->addButton(rect<s32>(30,110,100,140), window, 106, L"Save");
guienv->addButton(rect<s32>(30,150,100,180), window, 107, L"Continue");
return true;
}
"Debug Assertion Failed !
File dbgdel.cpp line 47
Expression _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)"
heres the code, i press ESC the window opens, the FPS-camera ist stopped,
i click on continue, the FPS-camera ist started, the computer crashes, have it to remove the buttons, too?:
...
switch(event.GUIEvent.EventType)
{
case EGET_BUTTON_CLICKED:
...
if (id == 107)
{
smgr->setActiveCamera(camera);
window->remove();
return true;
}
}
}
...
switch(event.KeyInput.Key)
{
case KEY_ESCAPE:
{
smgr->setActiveCamera(0);
window = guienv->addWindow(
rect<s32>(50 , 50 , 400 , 300 ), 0, -1, L"Menu");
guienv->addButton(rect<s32>(30,30,100,60), window, 104, "End game");
guienv->addButton(rect<s32>(30,70,100,100), window, 105, L"Load");
guienv->addButton(rect<s32>(30,110,100,140), window, 106, L"Save");
guienv->addButton(rect<s32>(30,150,100,180), window, 107, L"Continue");
return true;
}
-
knightoflight
- Posts: 199
- Joined: Sun Aug 24, 2003 5:47 pm
- Location: Germany
-
Soldier of infortune
- Posts: 29
- Joined: Fri Sep 19, 2003 8:36 am
I added a gui on my game like the tutorial 5 (user interface example)
For getting keyboard input events :
But when i move the mouse on these buttons, there is a seg fault !
How can i resolve this big problem ?
Sam
For getting keyboard input events :
Code: Select all
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = device->getGUIEnvironment();
switch(event.GUIEvent.EventType)
{
case EGET_BUTTON_CLICKED:
if (id == 101)
{
device->closeDevice();
return true;
}
break;
}
}
if (perso2_corps != 0 && event.EventType == irr::EET_KEY_INPUT_EVENT )
{
switch(event.KeyInput.Key)
{
case KEY_KEY_G:
{
core::vector3df r = perso2_corps->getRotation();
if (r.Y == 360)
r.Y=0.0f;
else
r.Y += 1.0f;
perso2_corps->setRotation(r);
}
}
}
}
};
How can i resolve this big problem ?
Sam
-
Soldier of infortune
- Posts: 29
- Joined: Fri Sep 19, 2003 8:36 am
I can move my camera and my model with the keyboard.
I don't control the cam with the mouse , I don't use the camerafps.
There are 3 buttons, by example there is the Quit button.
When I move the mouse on this button, the application stops : there is a segmentation fault .
Soldier of Infortune
ps : I work on Linux
I don't control the cam with the mouse , I don't use the camerafps.
There are 3 buttons, by example there is the Quit button.
When I move the mouse on this button, the application stops : there is a segmentation fault .
Soldier of Infortune
ps : I work on Linux
-
Soldier of infortune
- Posts: 29
- Joined: Fri Sep 19, 2003 8:36 am
I think the error comes in my code
I work with the 0.4 version of the engine.
Have you patch the new code for working under Linux ?
cf :
http://irrlicht.sourceforge.net/phpBB2/ ... ight=linux
Sam/Soldier
I work with the 0.4 version of the engine.
Have you patch the new code for working under Linux ?
cf :
http://irrlicht.sourceforge.net/phpBB2/ ... ight=linux
Sam/Soldier
-
Soldier of infortune
- Posts: 29
- Joined: Fri Sep 19, 2003 8:36 am
-
Soldier of infortune
- Posts: 29
- Joined: Fri Sep 19, 2003 8:36 am