Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added Target life meter for enemies

  • Loading branch information...
commit 0be06785a3d183975b0878e5c729405d316d50e0 1 parent 8033a77
@is06 authored
View
29 include/gui/TargetLifeMeter.h
@@ -0,0 +1,29 @@
+/******************************************************************************
+Invisible Spirit by Thomas Noury is licensed under a Creative Commons
+Attribution-NonCommercial-ShareAlike 3.0 Unported License. Based on a work at
+is06.com. Permissions beyond the scope of this license may be available at
+http://www.is06.com. Legal code in license.txt
+*******************************************************************************/
+
+#ifndef __IS06_BUTTON_H__
+#define __IS06_BUTTON_H__
+
+#include "../enums/gameplay/CommandIdentifier.h"
+#include "Hud.h"
+
+class TargetLifeMeter : public Hud
+{
+ public:
+ TargetLifeMeter(s32 init, s32 min, s32 max);
+ ~TargetLifeMeter();
+
+ void render(const core::vector3df& targetPosition);
+ void updateValue(const s32& value);
+
+ private:
+ Picture* barBack;
+ BarCounter* counter;
+ Text* label;
+};
+
+#endif
View
1  include/ref/classes.h
@@ -41,6 +41,7 @@ class BarCounter;
class DigitCounter;
class GameTimeCounter;
class WorldTimeCounter;
+class TargetLifeMeter;
class IconCounter;
class Picture;
class Animation;
View
43 src/gui/TargetLifeMeter.cpp
@@ -0,0 +1,43 @@
+/******************************************************************************
+Invisible Spirit by Thomas Noury is licensed under a Creative Commons
+Attribution-NonCommercial-ShareAlike 3.0 Unported License. Based on a work at
+is06.com. Permissions beyond the scope of this license may be available at
+http://www.is06.com. Legal code in license.txt
+*******************************************************************************/
+
+#include "../../include/ref/core.h"
+#include "../../include/enums/styles/FontStyle.h"
+#include "../../include/enums/styles/BarStyle.h"
+#include "../../include/gui/Text.h"
+#include "../../include/gui/BarCounter.h"
+#include "../../include/gui/Picture.h"
+#include "../../include/gui/TargetLifeMeter.h"
+
+using namespace irr;
+using namespace std;
+
+TargetLifeMeter::TargetLifeMeter(s32 init, s32 min, s32 max)
+{
+ label = new Text(L"Cible", 0, 0, FONT_STD_CLASSIC_REGULAR, 0);
+ counter = new BarCounter(init, min, max, 0, 0, 150, 10, BAR_STYLE_LIFE);
+ barBack = new Picture();
+}
+
+void TargetLifeMeter::render(const core::vector3df& targetPosition)
+{
+ label->render();
+ counter->render();
+ barBack->render();
+}
+
+void TargetLifeMeter::updateValue(const s32& value)
+{
+ counter->setValue(value);
+}
+
+TargetLifeMeter::~TargetLifeMeter()
+{
+ delete barBack;
+ delete label;
+ delete counter;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.