[11292] | 1 | |
---|
| 2 | |
---|
| 3 | #include "HUDDialogue.h" |
---|
| 4 | |
---|
| 5 | #include "core/XMLPort.h" |
---|
| 6 | |
---|
| 7 | #include <OgreCamera.h> |
---|
| 8 | #include <OgreFontManager.h> |
---|
| 9 | #include <OgreOverlayManager.h> |
---|
| 10 | #include <OgreTextAreaOverlayElement.h> |
---|
| 11 | #include <OgrePanelOverlayElement.h> |
---|
[11317] | 12 | #include "core/CoreIncludes.h" |
---|
[11292] | 13 | |
---|
| 14 | namespace orxonox |
---|
| 15 | { |
---|
| 16 | |
---|
[11331] | 17 | RegisterClass (HUDDialogue); |
---|
| 18 | /** |
---|
| 19 | @brief |
---|
| 20 | Default Constructor. Registers the object and initializes variables. |
---|
| 21 | */ |
---|
| 22 | HUDDialogue::HUDDialogue(Context* context) : |
---|
| 23 | OrxonoxOverlay(context) |
---|
[11292] | 24 | { |
---|
| 25 | RegisterObject(HUDDialogue); |
---|
[11331] | 26 | } |
---|
| 27 | /** |
---|
| 28 | @brief |
---|
| 29 | Updates the picture to the picture which was declared in the Dialogue class and sets a timer to set the picture on invisible again. |
---|
| 30 | */ |
---|
[11317] | 31 | void HUDDialogue::updateTarget(std::string portrait) |
---|
| 32 | { |
---|
| 33 | overlayElementIcon_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "Dialogue" + getUniqueNumberString())); |
---|
[11292] | 34 | overlayElementIcon_->setPosition(0.0f,0.0f); |
---|
| 35 | overlayElementIcon_->setDimensions(1.0f,1.0f); |
---|
[11317] | 36 | this->background_->addChild(overlayElementIcon_); |
---|
[11292] | 37 | |
---|
[11317] | 38 | overlayElementIcon_->setMaterialName(portrait); |
---|
| 39 | this->setVisible(true); |
---|
| 40 | portraitTimer.setTimer(2.9f,false,createExecutor(createFunctor(&HUDDialogue::invisible, this))); |
---|
| 41 | } |
---|
[11331] | 42 | /** |
---|
| 43 | @brief |
---|
| 44 | Sets the picture back to invisible again. |
---|
| 45 | */ |
---|
[11317] | 46 | void HUDDialogue::invisible() |
---|
[11292] | 47 | { |
---|
[11317] | 48 | this->setVisible(false); |
---|
| 49 | Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->overlayElementIcon_); |
---|
[11292] | 50 | } |
---|
[11331] | 51 | /** |
---|
| 52 | @brief |
---|
| 53 | Default Destructor. |
---|
| 54 | */ |
---|
| 55 | HUDDialogue::~HUDDialogue() |
---|
| 56 | { |
---|
[11292] | 57 | |
---|
| 58 | |
---|
[11331] | 59 | } |
---|
[11292] | 60 | } |
---|