wavelength 1.0.0
Loading...
Searching...
No Matches
ovyjuice.h
Go to the documentation of this file.
1#pragma once
2
3#include "app/hideablepanel.h"
4#include "math/interpolator.h"
5#include "rnd/rndanimatable.h"
6#include "rnd/rnddrawable.h"
7#include "rnd/rndview.h"
8
16class OvyJuice : public HideablePanel {
17public:
25
32 ~OvyJuice() override = default;
33
41 void Show(bool bShow) override;
42
49 void Reset();
50
59 void SetLevel(float fLevel, int nColor);
60
68 void SetWarning(bool bWarn);
69
77 void Poll(float fDelta);
78
85 static float sGhostFadeTime;
86
93 static float sWarningBlinkTime;
94
102
109 static float sBlinkLeft;
110
112 void SetHideBar(int nHideBar) {
113 mHideBar = nHideBar;
114 }
115
116private:
117 RndView *mView;
118 RndAnimatable *mColorAnim;
119 RndDrawable *mBar;
120 RndDrawable *mWarning;
121 RndDrawable *mGhost;
122 RndAnimatable *mGhostAnim;
123 RndAnimatable *mGhostFadeAnim;
124 LinearInterpolator mGhostFade;
125 float mLevel;
126 int mWarn;
127 int mHideBar;
128 float mWarningLeft;
129};
HideablePanel(const char *pszAnim, const char *pszDrawable, bool bShown)
Construct a panel and find its animation and drawable.
Straight-line interpolator.
Definition interpolator.h:99
void Show(bool bShow) override
Slide the bar in or out.
static float sWarningBlinkTime
The half period of the warning's blink, juice_dying_blink_time.
Definition ovyjuice.h:93
void SetWarning(bool bWarn)
Start or stop the blinking warning.
~OvyJuice() override=default
Destroy the bar.
void Poll(float fDelta)
Advance the slide, the warning, the ghost, and the blink of a low bar.
static float sBlinkLeft
The part of the current blink of a low bar still to run.
Definition ovyjuice.h:109
OvyJuice()
Construct a hidden, full bar from HUD1 energy.tnm and HUD energy.view.
static float sGhostFadeTime
The time the ghost of a dropped level takes to fade, juice_ghost_fade_time.
Definition ovyjuice.h:85
void SetLevel(float fLevel, int nColor)
Set the level of the bar, leaving a fading ghost when it drops.
void Reset()
Empty the bar, hide the warning and the ghost, and settle the display.
void SetHideBar(int nHideBar)
Definition ovyjuice.h:112
static LinearInterpolator sBlinkRate
The blinks per unit of time of a low bar against its level, from juice_blink_range and juice_blink_fr...
Definition ovyjuice.h:101
Mix-in for an object driven by a frame.
Definition rndanimatable.h:16
Mix-in for an object that draws itself and then a list of other drawables.
Definition rnddrawable.h:16
View that shows the children of another view, its children owner, under its own transform and frame.
Definition rndview.h:27