Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Types | Public Member Functions | List of all members
core::system::hud::ScreenKeyboard Class Reference

A screen keyboard for getting arbitrary user input. More...

#include <ScreenKeyboard.hpp>

Public Types

using OnSubmit = std::function< void(const std::string &)>
 

Public Member Functions

 ScreenKeyboard (bl::engine::Engine &engine, const OnSubmit &onSubmit)
 Construct a new Screen Keyboard. More...
 
 ~ScreenKeyboard ()
 Unsubscribes the keyboard if still subscribed. More...
 
void start (unsigned int minLen=0, unsigned int maxLen=16)
 Subscribes the keyboard to the event bus. More...
 
void stop ()
 Unsubscribes the keyboard from the event bus. More...
 
void setPosition (const sf::Vector2f &position)
 Sets the position of the keyboard. The default is (??) More...
 
const std::string & value () const
 Returns the current input value. More...
 
sf::Vector2f getSize () const
 Returns the size of the screen keyboard. More...
 
void process (unsigned int ctrl, bool ignoreDebounce)
 Handles player input. More...
 

Detailed Description

A screen keyboard for getting arbitrary user input.

Definition at line 27 of file ScreenKeyboard.hpp.

Member Typedef Documentation

◆ OnSubmit

using core::system::hud::ScreenKeyboard::OnSubmit = std::function<void(const std::string&)>

Definition at line 29 of file ScreenKeyboard.hpp.

Constructor & Destructor Documentation

◆ ScreenKeyboard()

core::system::hud::ScreenKeyboard::ScreenKeyboard ( bl::engine::Engine &  engine,
const OnSubmit onSubmit 
)

Construct a new Screen Keyboard.

Parameters
engineThe game engine instance
onSubmitCallback to call when the input is submitted

Definition at line 19 of file ScreenKeyboard.cpp.

◆ ~ScreenKeyboard()

core::system::hud::ScreenKeyboard::~ScreenKeyboard ( )

Unsubscribes the keyboard if still subscribed.

Definition at line 121 of file ScreenKeyboard.cpp.

Member Function Documentation

◆ getSize()

sf::Vector2f core::system::hud::ScreenKeyboard::getSize ( ) const

Returns the size of the screen keyboard.

Definition at line 156 of file ScreenKeyboard.cpp.

◆ process()

void core::system::hud::ScreenKeyboard::process ( unsigned int  ctrl,
bool  ignoreDebounce 
)

Handles player input.

Parameters
ctrlThe control to process, in raw form
ignoreDebounceTrue to ignore debounce and process always, false to rate limit

Definition at line 143 of file ScreenKeyboard.cpp.

◆ setPosition()

void core::system::hud::ScreenKeyboard::setPosition ( const sf::Vector2f &  position)

Sets the position of the keyboard. The default is (??)

Definition at line 147 of file ScreenKeyboard.cpp.

◆ start()

void core::system::hud::ScreenKeyboard::start ( unsigned int  minLen = 0,
unsigned int  maxLen = 16 
)

Subscribes the keyboard to the event bus.

Parameters
minLenMinimum input length to accept
maxLenMaximum input length to accept

Definition at line 123 of file ScreenKeyboard.cpp.

◆ stop()

void core::system::hud::ScreenKeyboard::stop ( )

Unsubscribes the keyboard from the event bus.

Definition at line 138 of file ScreenKeyboard.cpp.

◆ value()

const std::string & core::system::hud::ScreenKeyboard::value ( ) const

Returns the current input value.

Definition at line 154 of file ScreenKeyboard.cpp.


The documentation for this class was generated from the following files: