2024-02-19 00:08:03 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "IWidget.hpp"
|
|
|
|
#include "../../helpers/Vector2D.hpp"
|
|
|
|
#include "../../helpers/Color.hpp"
|
|
|
|
#include <chrono>
|
|
|
|
#include <vector>
|
2024-02-19 23:39:13 +01:00
|
|
|
#include <any>
|
|
|
|
#include <unordered_map>
|
2024-02-19 00:08:03 +01:00
|
|
|
|
2024-02-19 23:58:59 +01:00
|
|
|
struct SPreloadedAsset;
|
|
|
|
|
2024-02-19 00:08:03 +01:00
|
|
|
class CPasswordInputField : public IWidget {
|
|
|
|
public:
|
2024-02-19 23:39:13 +01:00
|
|
|
CPasswordInputField(const Vector2D& viewport, const std::unordered_map<std::string, std::any>& props);
|
2024-02-19 00:08:03 +01:00
|
|
|
|
2024-02-19 17:26:08 +01:00
|
|
|
virtual bool draw(const SRenderData& data);
|
2024-02-19 00:08:03 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void updateDots();
|
2024-02-19 02:22:22 +01:00
|
|
|
void updateFade();
|
2024-02-20 01:53:49 +01:00
|
|
|
void updateFailTex();
|
2024-02-20 15:42:04 +01:00
|
|
|
void updateHiddenInputState();
|
2024-02-19 00:08:03 +01:00
|
|
|
|
|
|
|
Vector2D size;
|
|
|
|
Vector2D pos;
|
2024-02-20 15:42:04 +01:00
|
|
|
Vector2D viewport;
|
2024-02-19 00:08:03 +01:00
|
|
|
|
2024-02-20 18:12:43 +01:00
|
|
|
float dt_size, dt_space;
|
|
|
|
|
2024-02-19 00:08:03 +01:00
|
|
|
int out_thick;
|
|
|
|
|
2024-02-19 23:35:13 +01:00
|
|
|
CColor inner, outer, font;
|
2024-02-19 00:08:03 +01:00
|
|
|
|
2024-02-19 22:09:00 +01:00
|
|
|
struct {
|
|
|
|
float currentAmount = 0;
|
|
|
|
float speedPerSecond = 5; // actually per... something. I am unsure xD
|
|
|
|
std::chrono::system_clock::time_point lastFrame;
|
2024-02-21 12:42:18 +01:00
|
|
|
bool center = false;
|
2024-02-19 22:09:00 +01:00
|
|
|
} dots;
|
2024-02-19 00:08:03 +01:00
|
|
|
|
2024-02-19 02:22:22 +01:00
|
|
|
struct {
|
|
|
|
std::chrono::system_clock::time_point start;
|
|
|
|
float a = 0;
|
|
|
|
bool appearing = true;
|
|
|
|
bool animated = false;
|
|
|
|
} fade;
|
|
|
|
|
2024-02-19 23:58:59 +01:00
|
|
|
struct {
|
|
|
|
std::string resourceID = "";
|
|
|
|
SPreloadedAsset* asset = nullptr;
|
2024-02-20 01:53:49 +01:00
|
|
|
|
|
|
|
std::string failID = "";
|
|
|
|
SPreloadedAsset* failAsset = nullptr;
|
|
|
|
bool canGetNewFail = true;
|
2024-02-19 23:58:59 +01:00
|
|
|
} placeholder;
|
|
|
|
|
2024-02-20 15:42:04 +01:00
|
|
|
struct {
|
|
|
|
CColor lastColor;
|
|
|
|
int lastQuadrant = 0;
|
|
|
|
int lastPasswordLength = 0;
|
|
|
|
bool enabled = false;
|
|
|
|
} hiddenInputState;
|
|
|
|
|
2024-02-19 22:09:00 +01:00
|
|
|
bool fadeOnEmpty;
|
2024-02-20 18:12:43 +01:00
|
|
|
};
|