Switching scene???
Switching scene???
Okay here's the question.
How do I go from the User Interface like screen to the game screen such as the movement one.
do I have to erase or hide the objects and then redraw the scene with new ones....
what I mean is when I press let say a "play" button it takes the screen from the user interface to a loading bar then the scene for the game.
How do I go from the User Interface like screen to the game screen such as the movement one.
do I have to erase or hide the objects and then redraw the scene with new ones....
what I mean is when I press let say a "play" button it takes the screen from the user interface to a loading bar then the scene for the game.
This may help
http://www.skyesurfer.net/keless/IrrLicht/ICE/
Or you can have multiple cameras. One FPS and another that you could use to render your interface (could even be a 3D interface then)
Then setActiveCamera between them. I do that so I can roam in my world then when I press CTRL I can use the onscreen GUI to press buttons;)
http://www.skyesurfer.net/keless/IrrLicht/ICE/
Or you can have multiple cameras. One FPS and another that you could use to render your interface (could even be a 3D interface then)
Then setActiveCamera between them. I do that so I can roam in my world then when I press CTRL I can use the onscreen GUI to press buttons;)
"When we looked at the relics of the precursors, we saw what heights civilization can attain.
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
Hold on to your but, heres my source
(g_ID is a global pointer to an IrrLichtDevice class, im lazy)
g_ID->GUIMode is a bool to store the current state
then in my even reciever:
Anyway, hope this helps
(g_ID is a global pointer to an IrrLichtDevice class, im lazy)
g_ID->GUIMode is a bool to store the current state
Code: Select all
The function to switch from FPS to GUI camera (has a "flickering" bug)
void setGUIMode(bool mode)
{
if(mode)
{
if(!g_ID->GUIMode)
{
g_ID->GUICamera->setTarget(g_ID->Camera->getTarget());
g_ID->GUICamera->setPosition(g_ID->Camera->getPosition());
// FIXME: Its flickering
g_ID->Smgr->setActiveCamera(g_ID->GUICamera);
g_ID->Device->getCursorControl()->setVisible(true);
}
}
else if(g_ID->GUIMode)
{
g_ID->Camera->setPosition(g_ID->GUICamera->getPosition());
g_ID->Smgr->setActiveCamera(g_ID->Camera);
g_ID->Device->getCursorControl()->setVisible(false);
}
g_ID->GUIMode = mode; // New mode set
}
Code: Select all
if(event.EventType == irr::EET_KEY_INPUT_EVENT)
{
if(!event.KeyInput.PressedDown)
{
switch(event.KeyInput.Key)
{
case KEY_ESCAPE:
{
dropDevice(); // HACK: I want recv to be in "IrrLichtDevice"
return true;
}
case KEY_CONTROL:
{
setGUIMode(false);
return true;
}
}
}
else
{
switch(event.KeyInput.Key)
{
case KEY_CONTROL:
{
setGUIMode(true);
return true;
}
}
}
}
"When we looked at the relics of the precursors, we saw what heights civilization can attain.
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
I wouldnt worry too much, I dont think you can edit posts in this forum. My best is 3 in a row and no-one hit menatol wrote:I am so sorry , I didn't mean to double post....
This is code from an early IrrLicht test project so you may need to fix some bits but I think its about what you asked for. (ignore the comments, mad ramblings)
Happy coding.
"When we looked at the relics of the precursors, we saw what heights civilization can attain.
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
Ok since I am starting to feel like a major newb....
when I go and try to use this part of the code:::
void setGUIMode(bool mode)
{
if(mode)
{
if(!g_ID->GUIMode)
{
g_ID->GUICamera->setTarget(g_ID->Camera->getTarget());
g_ID->GUICamera->setPosition(g_ID->Camera->getPosition());
// FIXME: Its flickering
g_ID->Smgr->setActiveCamera(g_ID->GUICamera);
g_ID->Device->getCursorControl()->setVisible(true);
}
}
else if(g_ID->GUIMode)
{
g_ID->Camera->setPosition(g_ID->GUICamera->getPosition());
g_ID->Smgr->setActiveCamera(g_ID->Camera);
g_ID->Device->getCursorControl()->setVisible(false);
}
g_ID->GUIMode = mode; // New mode set
I get the g_ID not declared error upon compiling....
maybe I'm not sticking the code in the right places?
Thanks for all the help...
when I go and try to use this part of the code:::
void setGUIMode(bool mode)
{
if(mode)
{
if(!g_ID->GUIMode)
{
g_ID->GUICamera->setTarget(g_ID->Camera->getTarget());
g_ID->GUICamera->setPosition(g_ID->Camera->getPosition());
// FIXME: Its flickering
g_ID->Smgr->setActiveCamera(g_ID->GUICamera);
g_ID->Device->getCursorControl()->setVisible(true);
}
}
else if(g_ID->GUIMode)
{
g_ID->Camera->setPosition(g_ID->GUICamera->getPosition());
g_ID->Smgr->setActiveCamera(g_ID->Camera);
g_ID->Device->getCursorControl()->setVisible(false);
}
g_ID->GUIMode = mode; // New mode set
I get the g_ID not declared error upon compiling....
maybe I'm not sticking the code in the right places?
Thanks for all the help...
Like I said, g_ID is a lazy way for me to store global pointers. Im no coding god. Anyway, use this class too, if you like.
(NOTE: This just rigs-up IrrLicht and stores pointers thats all, it was an experiment)
(NOTE: This just rigs-up IrrLicht and stores pointers thats all, it was an experiment)
Code: Select all
class IrrLichtDevice // Note the mispelling to avoid clashes
{
public:
IrrLichtDevice(EDriverType driveType, dimension2d<s32> resoloution)
{
Device = createDevice(driveType, resoloution, 32, true, false, &EvtRecv);
Driver = Device->getVideoDriver();
Smgr = Device->getSceneManager();
GUIEnv = Device->getGUIEnvironment();
GUICamera = Smgr->addCameraSceneNode(0);
GUIMode = false; // FIXED:
// GUICamera->setFarValue(2000);
// Dual WSAD CURSOR camera control (FPS style)
SKeyMap keyMap[8];
keyMap[0].Action = EKA_MOVE_FORWARD;
keyMap[0].KeyCode = KEY_UP;
keyMap[1].Action = EKA_MOVE_FORWARD;
keyMap[1].KeyCode = KEY_KEY_W;
keyMap[2].Action = EKA_MOVE_BACKWARD;
keyMap[2].KeyCode = KEY_DOWN;
keyMap[3].Action = EKA_MOVE_BACKWARD;
keyMap[3].KeyCode = KEY_KEY_S;
keyMap[4].Action = EKA_STRAFE_LEFT;
keyMap[4].KeyCode = KEY_LEFT;
keyMap[5].Action = EKA_STRAFE_LEFT;
keyMap[5].KeyCode = KEY_KEY_A;
keyMap[6].Action = EKA_STRAFE_RIGHT;
keyMap[6].KeyCode = KEY_RIGHT;
keyMap[7].Action = EKA_STRAFE_RIGHT;
keyMap[7].KeyCode = KEY_KEY_D;
// Create this one last (for now)
Camera = Smgr->addCameraSceneNodeFPS(0, 100, 1000, -1, keyMap, 8);
Camera->setPosition(vector3df(2500,500,2500));
Camera->setFOV(PI/2.5f);
// Camera->setFarValue(2000);
};
~IrrLichtDevice(void)
{
Device->drop();
};
IrrlichtDevice *Device;
IVideoDriver *Driver;
ISceneManager *Smgr;
// Not so important?
ICameraSceneNode *Camera, *GUICamera;
MyEventReceiver EvtRecv;
IGUIEnvironment *GUIEnv;
bool GUIMode;
};
"When we looked at the relics of the precursors, we saw what heights civilization can attain.
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
Then in my main():
Like I said, im no coding god but I hope it helps!
Code: Select all
IrrLichtDevice ID(EDT_DIRECTX9, dimension2d<s32>(800, 600));
g_ID = &ID; // Store global pointer for other functions
"When we looked at the relics of the precursors, we saw what heights civilization can attain.
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
Damn. Look ive posted 3 times in a row again sorry.
But at filescope (not in a function) I put this
IrrLichtDevice *g_ID;
And that is why your getting compilation errors. It was just my class, I hope your following cuz im bonkers.
But at filescope (not in a function) I put this
IrrLichtDevice *g_ID;
And that is why your getting compilation errors. It was just my class, I hope your following cuz im bonkers.
"When we looked at the relics of the precursors, we saw what heights civilization can attain.
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
When we looked at their ruins, we marked the danger of that height." -Keeper Annals
(Thief2: The Metal Age)
No, it isn't . The explanations and the syntax of the API doc is a bit weird though, but once you know how it works you can understand most of it . And keep on asking if you don't know how something works.natol wrote:LOL.....
Thanks for the help I will go through all your code and learn from it...
some of the API is a little over my head still....