| 1 | /* * ORXONOX - the hottest 3D action shooter ever to exist * > www.orxonox.net < * * * License notice: * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * |
|---|
| 2 | * Author: |
|---|
| 3 | * Yuning Chai |
|---|
| 4 | * Co-authors: |
|---|
| 5 | * Felix Schulthess |
|---|
| 6 | * |
|---|
| 7 | */ |
|---|
| 8 | |
|---|
| 9 | #ifndef _BarOverlayElement_H__ |
|---|
| 10 | #define _BarOverlayElement_H__ |
|---|
| 11 | |
|---|
| 12 | #include "OrxonoxPrereqs.h" |
|---|
| 13 | |
|---|
| 14 | #include <OgrePrerequisites.h> |
|---|
| 15 | #include <OgrePanelOverlayElement.h> |
|---|
| 16 | |
|---|
| 17 | namespace orxonox |
|---|
| 18 | { |
|---|
| 19 | class _OrxonoxExport BarOverlayElement : public Ogre::PanelOverlayElement |
|---|
| 20 | { |
|---|
| 21 | private: |
|---|
| 22 | bool autoColor_; // whether bar changes color automatically |
|---|
| 23 | float value_; // progress of bar |
|---|
| 24 | int color_; |
|---|
| 25 | int left_; |
|---|
| 26 | int top_; |
|---|
| 27 | int width_; |
|---|
| 28 | int height_; |
|---|
| 29 | int windowW_, windowH_; |
|---|
| 30 | Ogre::Real leftRel_; |
|---|
| 31 | Ogre::Real topRel_; |
|---|
| 32 | Ogre::Real dimRel_; |
|---|
| 33 | Ogre::OverlayManager* om; // our overlay manager |
|---|
| 34 | Ogre::OverlayContainer* container_; // our parent container to attach to |
|---|
| 35 | Ogre::OverlayContainer* background_; |
|---|
| 36 | Ogre::String name_; |
|---|
| 37 | |
|---|
| 38 | public: |
|---|
| 39 | bool left2Right; |
|---|
| 40 | static const int RED = 0; // predefined colors |
|---|
| 41 | static const int YELLOW = 1; |
|---|
| 42 | static const int GREEN = 2; |
|---|
| 43 | |
|---|
| 44 | BarOverlayElement(const Ogre::String& name); |
|---|
| 45 | virtual ~BarOverlayElement(); |
|---|
| 46 | void init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container); |
|---|
| 47 | void resize(); |
|---|
| 48 | void setValue(float value); |
|---|
| 49 | void setColor(int color); |
|---|
| 50 | float getValue(); |
|---|
| 51 | int getBarColor(); |
|---|
| 52 | }; |
|---|
| 53 | } |
|---|
| 54 | #endif /* _BarOverlayElement_H__ */ |
|---|