2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-03-10 03:47:37 +00:00
|
|
|
|
2020-03-18 01:26:54 +00:00
|
|
|
#include <array>
|
2019-09-22 21:52:05 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Runtime/CToken.hpp"
|
|
|
|
#include "Runtime/Graphics/CTexture.hpp"
|
|
|
|
#include "Runtime/Graphics/Shaders/CEnergyBarShader.hpp"
|
|
|
|
#include "Runtime/GuiSys/CGuiWidget.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CColor.hpp>
|
|
|
|
#include <zeus/CVector3f.hpp>
|
2016-03-10 03:47:37 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2017-01-22 01:40:12 +00:00
|
|
|
class CSimplePool;
|
2016-03-10 03:47:37 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CAuiEnergyBarT01 : public CGuiWidget {
|
2016-03-12 04:58:56 +00:00
|
|
|
public:
|
2020-03-18 01:23:59 +00:00
|
|
|
using FCoordFunc = std::pair<zeus::CVector3f, zeus::CVector3f> (*)(float t);
|
2018-12-08 05:30:43 +00:00
|
|
|
enum class ESetMode { Normal, Wrapped, Insta };
|
|
|
|
|
2017-04-02 03:03:37 +00:00
|
|
|
private:
|
2018-12-08 05:30:43 +00:00
|
|
|
CAssetId xb8_txtrId;
|
|
|
|
TLockedToken<CTexture> xbc_tex; // Used to be optional
|
|
|
|
zeus::CColor xcc_emptyColor;
|
|
|
|
zeus::CColor xd0_filledColor;
|
|
|
|
zeus::CColor xd4_shadowColor;
|
|
|
|
FCoordFunc xd8_coordFunc = nullptr;
|
|
|
|
float xdc_tesselation = 1.f;
|
|
|
|
float xe0_maxEnergy = 0.f;
|
|
|
|
float xe4_filledSpeed = 1000.f;
|
|
|
|
float xe8_shadowSpeed = 1000.f;
|
|
|
|
float xec_shadowDrainDelay = 0.f;
|
|
|
|
bool xf0_alwaysResetDelayTimer = false;
|
|
|
|
bool xf1_wrapping = false;
|
|
|
|
float xf4_setEnergy = 0.f;
|
|
|
|
float xf8_filledEnergy = 0.f;
|
|
|
|
float xfc_shadowEnergy = 0.f;
|
|
|
|
float x100_shadowDrainDelayTimer = 0.f;
|
|
|
|
|
2017-04-02 03:03:37 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
CAuiEnergyBarT01(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId txtrId);
|
2019-08-09 12:45:18 +00:00
|
|
|
FourCC GetWidgetTypeID() const override { return FOURCC('ENRG'); }
|
2018-12-08 05:30:43 +00:00
|
|
|
static std::pair<zeus::CVector3f, zeus::CVector3f> DownloadBarCoordFunc(float t);
|
2019-08-09 12:45:18 +00:00
|
|
|
void Update(float dt) override;
|
2020-03-18 05:14:36 +00:00
|
|
|
void Draw(const CGuiWidgetDrawParms& drawParms) override;
|
2018-12-08 05:30:43 +00:00
|
|
|
float GetActualFraction() const { return xe0_maxEnergy == 0.f ? 0.f : xf4_setEnergy / xe0_maxEnergy; }
|
|
|
|
float GetSetEnergy() const { return xf4_setEnergy; }
|
|
|
|
float GetMaxEnergy() const { return xe0_maxEnergy; }
|
|
|
|
float GetFilledEnergy() const { return xf8_filledEnergy; }
|
|
|
|
void SetCurrEnergy(float e, ESetMode mode);
|
|
|
|
void SetCoordFunc(FCoordFunc func) { xd8_coordFunc = func; }
|
|
|
|
void SetEmptyColor(const zeus::CColor& c) { xcc_emptyColor = c; }
|
|
|
|
void SetFilledColor(const zeus::CColor& c) { xd0_filledColor = c; }
|
|
|
|
void SetShadowColor(const zeus::CColor& c) { xd4_shadowColor = c; }
|
|
|
|
void SetMaxEnergy(float maxEnergy);
|
|
|
|
void ResetMaxEnergy() { SetMaxEnergy(xdc_tesselation); }
|
|
|
|
void SetTesselation(float t) { xdc_tesselation = t; }
|
|
|
|
void SetIsAlwaysResetTimer(bool b) { xf0_alwaysResetDelayTimer = b; }
|
|
|
|
void SetFilledDrainSpeed(float s) { xe4_filledSpeed = s; }
|
|
|
|
void SetShadowDrainSpeed(float s) { xe8_shadowSpeed = s; }
|
|
|
|
void SetShadowDrainDelay(float d) { xec_shadowDrainDelay = d; }
|
|
|
|
static std::shared_ptr<CGuiWidget> Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp);
|
2016-03-10 03:47:37 +00:00
|
|
|
};
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|