diff options
| author | boris <wzn@moneybot.cc> | 2018-11-28 16:00:02 +1300 |
|---|---|---|
| committer | boris <wzn@moneybot.cc> | 2018-11-28 16:00:02 +1300 |
| commit | 3d412a4b30a9f7c7f51ea6562e694315948bd3da (patch) | |
| tree | 26d67dfd1f3e5fd12903ad13e85d0cb8bcf8f21c /cheat/internal_rewrite/ui_itemlist_def.h | |
| parent | e4729e4393d90271a3814c7a79950a660c48325a (diff) | |
cleaned up
in short, the cheat and loader are now separate solutions. unused stuff was moved into the legacy solution in case anyone wants to compile it or whatever.
i can change this back if you want to. also, i configured the loader to compile in x64, and have separate build types for linux and win64
Diffstat (limited to 'cheat/internal_rewrite/ui_itemlist_def.h')
| -rw-r--r-- | cheat/internal_rewrite/ui_itemlist_def.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/cheat/internal_rewrite/ui_itemlist_def.h b/cheat/internal_rewrite/ui_itemlist_def.h new file mode 100644 index 0000000..fd64f12 --- /dev/null +++ b/cheat/internal_rewrite/ui_itemlist_def.h @@ -0,0 +1,61 @@ +#include "ui_itemlist.h" +#include <windows.h> + +namespace ui +{ + template < typename t, size_t size > + void c_itemlist< t, size >::text_input( ) { + if( is_textbox_hovered( ) && g_input.is_key_pressed( KEYS_MOUSE1 ) ) { + if( !m_was_held ) { + m_box_active ^= 1; + } + m_was_held = true; + } + else { + m_was_held = false; + } + + if( m_box_active ) { + if( !is_textbox_hovered( ) && g_input.is_key_pressed( KEYS_MOUSE1 ) ) { + m_box_active = false; + } + + float current_time = GetTickCount( ) * 0.001f; + size_t length = strlen( m_search_text ); + + for( size_t i{ }; i < 0xfe; ++i ) { + if( g_input.is_key_pressed( i ) ) { + float delta_time = current_time - m_last_key_input[ i ]; + if( fabs( delta_time ) > 0.2f ) { + if( i == KEYS_BACK ) { + m_search_text[ length - 1 ] = 0; + m_last_key_input[ i ] = current_time; + continue; + } + + m_key_states[ i ] = 0xf0; + wchar_t pressed_char; + const auto scan = MapVirtualKeyA( i, 2 ); + auto ret = ToAscii( i, scan, ( BYTE* )m_key_states, ( LPWORD )&pressed_char, 1 ); + + if( ret == 1 ) { + if( length < size ) { + m_search_text[ length ] = ( char )( pressed_char ); + m_search_text[ length + 1 ] = 0; + } + } + m_last_key_input[ i ] = current_time; + } + } + else { + m_last_key_input[ i ] = 0.f; + m_key_states[ i ] = 0; + } + } + + if( g_input.is_key_pressed( KEYS_RETURN ) ) { + m_box_active = false; + } + } + } +}
\ No newline at end of file |
