add show and center options

This commit is contained in:
Felix Salcher 2025-06-03 11:36:41 +02:00
parent 8bd246c397
commit 801491a190
No known key found for this signature in database
2 changed files with 5 additions and 4 deletions

View file

@ -260,8 +260,7 @@ bool CPasswordInputField::draw(const SRenderData& data) {
g_pRenderer->renderRect(inputFieldBox, innerCol, ROUND);
if (!hiddenInputState.enabled) {
if (false) {
if (!password.show) {
const int RECTPASSSIZE = std::nearbyint(inputFieldBox.h * dots.size * 0.5f) * 2.f;
Vector2D passSize{RECTPASSSIZE, RECTPASSSIZE};
int passSpacing = std::floor(passSize.x * dots.spacing);
@ -331,7 +330,7 @@ bool CPasswordInputField::draw(const SRenderData& data) {
if (password.asset != nullptr) {
auto size = password.asset->texture.m_vSize;
double xstart = inputFieldBox.w / 2.0 - size.x / 2.0;
double xstart = password.center ? inputFieldBox.w / 2.0 - size.x / 2.0 : inputFieldBox.h / 2.0 - size.y / 2.0;
Vector2D dotPosition = inputFieldBox.pos() + Vector2D{xstart, (inputFieldBox.h / 2.0) - (size.y / 2.0)};
CBox box{dotPosition, Vector2D(size.x, size.y)};

View file

@ -71,7 +71,9 @@ class CPasswordInputField : public IWidget {
} dots;
struct {
float size = 0;
bool show = true;
bool center = false;
float size = 0;
std::string content;
std::string resourceID;
SPreloadedAsset* asset = nullptr;