Dialog boxes!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
FireCross88
Posts: 14
Joined: Wed Jul 04, 2007 4:57 am

Dialog boxes!

Post by FireCross88 »

How do I create a popup dialog box in irrlicht when I've reached a certain position?

Like in Resident Evil, when you reach an item and press X, a dialog box comes up.

Thanks!
FireCross88
Posts: 14
Joined: Wed Jul 04, 2007 4:57 am

Post by FireCross88 »

No one knows how? This is a really important aspect for my school project!

Thanks!
olivehehe_03
Posts: 157
Joined: Tue Mar 20, 2007 8:30 am

Post by olivehehe_03 »

Write yourself a function to check if the players X, Y and Z coordinates are within a certain range (for example, the target position's X, Y and Z +- 10 units or something like that) and if the function returns true, use Irrlichts GUI stuff to make a message show up on screen. Hope that helps
Tell me what you cherish most. Give me the pleasure of taking it away.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Make a bounding box [core::aabbox3df] that describes the position that you want the 'trigger' to be at. In your main game loop, check to see if the player scene node absolute position is inside the box. If it is, set a flag that indicates the 'trigger' has been used, and then create your message box. Something like this...

Code: Select all

core::aabbox3df box(100, 100, 100, 110, 110, 110);
bool triggered = false;

while (device->run())
{
  if (driver->beginScene(...))
  {
    smgr->drawAll();

    driver->endScene();
  }

  if (!triggered && box.isPointInside( player->getAbsolutePosition() )
  {
    triggered = true;

    // create dialog or whatever
  }
}
Once you get that working, you can abstract it out a little bit. You could make a trigger interface that knows how to check that some condition is met, sets an internal 'triggered' flag and calls a function or does some other arbitrary thing. Then you can read these triggers from a configuration file and add them to a list of triggers. Every few ticks you can evaluate a few of the triggers...

Travis
FireCross88
Posts: 14
Joined: Wed Jul 04, 2007 4:57 am

Post by FireCross88 »

Sorry, maybe I should've been more specific.

I already know how to create the bounding box and trigger stuff, etc.

What I don't know how to do is to invoke Irrlicht's GUI or whatever to ACTUALLY create the dialog box, so I need detailed info for that.

Thanks!
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

have a look at tutorial #05.UserInterface, it shows you how to create windows and other gui stuff...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply