summaryrefslogtreecommitdiff
path: root/internal_rewrite/ui_text_input.cpp
diff options
context:
space:
mode:
authornavewindre <boneyaard@gmail.com>2018-08-31 18:57:02 +0200
committernavewindre <boneyaard@gmail.com>2018-08-31 18:57:02 +0200
commit78a6e235c3b0006bf29868d5f7ad0628d522fa79 (patch)
treea5bf8ca0005794f717f70c1428a8a1e1d69e9521 /internal_rewrite/ui_text_input.cpp
parent1f3f1ab2a20c6d90189cf1fd03cfbb08077bc02e (diff)
ah yes
Diffstat (limited to 'internal_rewrite/ui_text_input.cpp')
-rw-r--r--internal_rewrite/ui_text_input.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/internal_rewrite/ui_text_input.cpp b/internal_rewrite/ui_text_input.cpp
index 44a4ebc..f2c3530 100644
--- a/internal_rewrite/ui_text_input.cpp
+++ b/internal_rewrite/ui_text_input.cpp
@@ -29,6 +29,11 @@ void ui::c_text_input::render( ) {
m_last_key_input[ i ] = current_time;
continue;
}
+
+ if( i == KEYS_RETURN ) {
+ m_active = false;
+ break;
+ }
m_key_states[ i ] = 0xf0;
wchar_t pressed_char;
@@ -65,5 +70,14 @@ void ui::c_text_input::render( ) {
( is_hovered( ) || m_active ) ? ui_get_text_col( ) : ui_get_accent_col( ) );
ui_draw_rect( x, y, m_width, m_height, ui_get_disabled_col( ) );
- ui_draw_string( x + 2, y + 3, false, ui_get_text_col( ), m_active ? "%s_" : "%s", m_text_ptr );
+ if( !m_hidden )
+ ui_draw_string( x + 2, y + 3, false, ui_get_text_col( ), m_active ? "%s_" : "%s", m_text_ptr );
+ else {
+ std::string str;
+ str.append( "*", strlen( m_text_ptr ) );
+ if( m_active )
+ str += '_';
+
+ ui_draw_string( x + 2, y + 3, false, ui_get_text_col( ), str.c_str( ) );
+ }
} \ No newline at end of file