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> |
---|
12 | #include "core/CoreIncludes.h" |
---|
13 | |
---|
14 | namespace orxonox |
---|
15 | { |
---|
16 | |
---|
17 | RegisterClass (HUDDialogue); |
---|
18 | /** |
---|
19 | @brief |
---|
20 | Default Constructor. Registers the object and initializes variables. |
---|
21 | */ |
---|
22 | HUDDialogue::HUDDialogue(Context* context) : |
---|
23 | OrxonoxOverlay(context) |
---|
24 | { |
---|
25 | RegisterObject(HUDDialogue); |
---|
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 | */ |
---|
31 | void HUDDialogue::updateTarget(std::string portrait) |
---|
32 | { |
---|
33 | overlayElementIcon_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "Dialogue" + getUniqueNumberString())); |
---|
34 | overlayElementIcon_->setPosition(0.0f,0.0f); |
---|
35 | overlayElementIcon_->setDimensions(1.0f,1.0f); |
---|
36 | this->background_->addChild(overlayElementIcon_); |
---|
37 | |
---|
38 | overlayElementIcon_->setMaterialName(portrait); |
---|
39 | this->setVisible(true); |
---|
40 | portraitTimer.setTimer(2.9f,false,createExecutor(createFunctor(&HUDDialogue::invisible, this))); |
---|
41 | } |
---|
42 | /** |
---|
43 | @brief |
---|
44 | Sets the picture back to invisible again. |
---|
45 | */ |
---|
46 | void HUDDialogue::invisible() |
---|
47 | { |
---|
48 | this->setVisible(false); |
---|
49 | Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->overlayElementIcon_); |
---|
50 | } |
---|
51 | /** |
---|
52 | @brief |
---|
53 | Default Destructor. |
---|
54 | */ |
---|
55 | HUDDialogue::~HUDDialogue() |
---|
56 | { |
---|
57 | |
---|
58 | |
---|
59 | } |
---|
60 | } |
---|