malena
Why malena
Quick start
Tutorials
API docs
GitHub
GitHub
Tutorials
Loading...
Searching...
No Matches
Traits
Settings
InputSettings.h
Go to the documentation of this file.
1
//
2
// InputSettings.h
3
//
4
5
#ifndef MALENA_INPUTSETTINGS_H
6
#define MALENA_INPUTSETTINGS_H
7
8
#pragma once
9
10
#include <
Malena/Core/malena_export.h
>
11
#include <
Malena/Traits/Settings/ControlSettings.h
>
12
#include <
SFML/System/Vector2.hpp
>
13
#include <cstddef>
14
15
namespace
ml
16
{
26
struct
InputSettings
:
ControlSettings
27
{
28
sf::Vector2f
size
= {200.f, 36.f};
29
std::size_t
maxLength
= 0;
30
bool
passwordMode
=
false
;
31
char32_t
passwordChar
= U
'\u2022'
;
32
33
// ── Assignment from parent levels ─────────────────────────────────────
34
35
InputSettings
&
operator=
(
const
ControlSettings
& c)
36
{
static_cast<
ControlSettings
&
>
(*this) = c;
return
*
this
; }
37
38
InputSettings
&
operator=
(
const
GraphicSettings
& g)
39
{
static_cast<
ControlSettings
&
>
(*this) = g;
return
*
this
; }
40
41
// ── Getters / setters ─────────────────────────────────────────────────
42
43
[[nodiscard]]
sf::Vector2f
getSize
()
const
{
return
size
; }
44
[[nodiscard]] std::size_t
getMaxLength
()
const
{
return
maxLength
; }
45
[[nodiscard]]
bool
isPasswordMode
()
const
{
return
passwordMode
; }
46
[[nodiscard]]
char32_t
getPasswordChar
()
const
{
return
passwordChar
; }
47
48
void
setSize
(
const
sf::Vector2f
& s) {
size
= s; }
49
void
setMaxLength
(std::size_t n) {
maxLength
= n; }
50
void
setPasswordMode
(
bool
b) {
passwordMode
= b; }
51
void
setPasswordChar
(
char32_t
c) {
passwordChar
= c; }
52
};
53
54
}
// namespace ml
55
56
#endif
// MALENA_INPUTSETTINGS_H
ControlSettings.h
Vector2.hpp
malena_export.h
ml
Definition
Component.h:22
sf::Vector2f
Vector2< float > Vector2f
ml::ControlSettings
Settings trait for interactive UI controls — layout only.
Definition
ControlSettings.h:24
ml::GraphicSettings
Base settings trait for all visual components — geometry only.
Definition
GraphicSettings.h:35
ml::InputSettings
Layout and behaviour settings shared by all input controls.
Definition
InputSettings.h:27
ml::InputSettings::operator=
InputSettings & operator=(const GraphicSettings &g)
Definition
InputSettings.h:38
ml::InputSettings::setPasswordMode
void setPasswordMode(bool b)
Definition
InputSettings.h:50
ml::InputSettings::setSize
void setSize(const sf::Vector2f &s)
Definition
InputSettings.h:48
ml::InputSettings::passwordChar
char32_t passwordChar
Bullet •
Definition
InputSettings.h:31
ml::InputSettings::getSize
sf::Vector2f getSize() const
Definition
InputSettings.h:43
ml::InputSettings::operator=
InputSettings & operator=(const ControlSettings &c)
Definition
InputSettings.h:35
ml::InputSettings::getPasswordChar
char32_t getPasswordChar() const
Definition
InputSettings.h:46
ml::InputSettings::getMaxLength
std::size_t getMaxLength() const
Definition
InputSettings.h:44
ml::InputSettings::isPasswordMode
bool isPasswordMode() const
Definition
InputSettings.h:45
ml::InputSettings::setMaxLength
void setMaxLength(std::size_t n)
Definition
InputSettings.h:49
ml::InputSettings::maxLength
std::size_t maxLength
0 = unlimited
Definition
InputSettings.h:29
ml::InputSettings::passwordMode
bool passwordMode
Definition
InputSettings.h:30
ml::InputSettings::size
sf::Vector2f size
Definition
InputSettings.h:28
ml::InputSettings::setPasswordChar
void setPasswordChar(char32_t c)
Definition
InputSettings.h:51