Need advices with scene switching
Need advices with scene switching
Hello,
In my game, I have to login first, then choose a server to pay on ( like a mmo).
Ok, I login and here is my problem : I have to delete the buttons, edits box, background image and then create the interface for server choosing, but what's the best here ? resetting device ? dropping it and creating another one ? or keeping it (which I really want to do) delete images , gui etc and draw new one but in this case I don't really know what to do..
I hope I'm clear, my keyboard bugs so forgive my spelling mistakes
thanks you
In my game, I have to login first, then choose a server to pay on ( like a mmo).
Ok, I login and here is my problem : I have to delete the buttons, edits box, background image and then create the interface for server choosing, but what's the best here ? resetting device ? dropping it and creating another one ? or keeping it (which I really want to do) delete images , gui etc and draw new one but in this case I don't really know what to do..
I hope I'm clear, my keyboard bugs so forgive my spelling mistakes
thanks you
Re: Need advices with scene switching
if you wantto do it this way then do it this way (I probably also would)...Is3dpic wrote:or keeping it (which I really want to do) delete images , gui etc and draw new one but in this case I don't really know what to do..
and the API is a realy magical place to gather informations:
http://irrlicht.sourceforge.net/docu/cl ... t.html#a31
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Ok after severals tests, I came up with only errors...I don't know how to use this.
Example :
I get an error on that, I don't know how to use it, can someone light me up ? thanks xD
Example :
Code: Select all
IGUIElement* elem2 = loginPasswordBox;
elem2->remove();
Code: Select all
IGUIElement* root = m_guienv->getRootGUIElement();
root->getElementFromId(loginPasswordBox->getID(), false);
root->remove();
Edit : Some progress so far ->
Code: Select all
IGUIElement* root = m_guienv->getRootGUIElement();
IGUIElement* e = root->getElementFromId(loginUsernameBox->getID(), true);
if (e) e->remove();
Last edited by Is3dpic on Wed Oct 29, 2008 10:05 am, edited 1 time in total.
You should look at the docs to figure out how to use IGUIElement::getElementFromId properly
It returns a pointer to the element that you asked for (could be NULL though if it couldn't find it)
So you should do this:
It returns a pointer to the element that you asked for (could be NULL though if it couldn't find it)
So you should do this:
Code: Select all
IGUIElement* root = m_guienv->getRootGUIElement();
IGUIElement* myElement = root->getElementFromId(loginPasswordBox->getID(), false);
if (myElement) myElement->remove();
It's not the end lol.
What does m_guienv->getRootGUIElement() really do ? Look my code :
It's delete the loginbutton and not the loginpasswordbox as expected and that I think because of getRootGUIElement() function...some lights plz thanks
What does m_guienv->getRootGUIElement() really do ? Look my code :
Code: Select all
if (LogInButton->isPressed())
{
IGUIElement* root = m_guienv->getRootGUIElement();
IGUIElement* e= root->getElementFromId(loginPasswordBox->getID(), false);
if (e) e->remove();
}
Ok :
Returns the root gui element.
This is the first gui element, parent of all other gui elements. You'll never need to use this method, unless you are creating your own gui elements, trying to add them to the gui elements without a parent.
and lol, LoginButton is first thing created so it's the parents, what Can I do now ? I want to delete the loginbutton and loginusernamebox, I think I'll have to mess with parents thingy, I'm digging api..
Returns the root gui element.
This is the first gui element, parent of all other gui elements. You'll never need to use this method, unless you are creating your own gui elements, trying to add them to the gui elements without a parent.
and lol, LoginButton is first thing created so it's the parents, what Can I do now ? I want to delete the loginbutton and loginusernamebox, I think I'll have to mess with parents thingy, I'm digging api..
huu, why you're getting the element by it's id if you already have the element, where you get the id to search for from ?!?!?Is3dpic wrote:Code: Select all
IGUIElement* e= root->getElementFromId(loginPasswordBox->getID(), false);
if you already have the pointers stored why not simply use them ???
Code: Select all
loginPasswordBox->remove();
loginbutton->remove();
loginusernamebox->remove();
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
yes,Acki wrote:huu, why you're getting the element by it's id if you already have the element, where you get the id to search for from ?!?!?Is3dpic wrote:Code: Select all
IGUIElement* e= root->getElementFromId(loginPasswordBox->getID(), false);
if you already have the pointers stored why not simply use them ???or you can create one parent that holds all controls as childs so you just need to remove this single parent...Code: Select all
loginPasswordBox->remove(); loginbutton->remove(); loginusernamebox->remove();
Code: Select all
loginPasswordBox->remove();
loginbutton->remove();
loginusernamebox->remove();
Also, I've tried :
Code: Select all
IGUIElement* parent;
But I always end up with an error when I do m_parent->remove;LogInButton = m_guienv->addButton( rect<s32>(330, 360, 430, 400), m_parent, -1, L"Log In" );
Last edited by Is3dpic on Wed Oct 29, 2008 2:14 pm, edited 1 time in total.
how does it crash, what error message do you get ???Is3dpic wrote:Yes, It's removes but It's make application crashing.
maybe you try to access them after removing ???
try to set the pointers to 0 after removing and always check if it's =! 0 before accessing them...
Code: Select all
loginPasswordBox->remove();
loginPasswordBox = 0;
loginbutton->remove();
loginbutton = 0;
loginusernamebox->remove();
loginusernamebox = 0;
Code: Select all
if(loginusernamebox) theName = loginusernamebox->getText();
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java