#pragma once #include "ui_base_item.h" #include "ui_menu.h" #include "ui_form.h" #include "ui_render.h" #include "ui_checkbox.h" #include "ui_tab_manager.h" #include "ui_slider.h" #include "ui_dropdown.h" #include "ui_key_picker.h" #include "ui_button.h" #include "ui_color_picker.h" #include "ui_label.h" #include "ui_text_input.h" #include "ui_progressbar.h" char g_login[ 32 ]; int g_game = 1; float g_progress = 0.f; enum { STATUS_LOGIN, STATUS_LOGGING_IN, STATUS_LOGGED_IN, STATUS_LOADING, }; int g_status = STATUS_LOGIN; extern void execute_login( ); enum { GAME_UNSAFE = 0, GAME_SAFE = 1, }; struct game_t { int status; char name[ 32 ]; bool valid_sub; }; std::vector< game_t > games = { { GAME_SAFE, xors( "csgo" ), true }, { GAME_UNSAFE, xors( "csgo ( beta )" ), false } }; //fill this vector when receiving game data based on the one above (this is just a test sample one) std::vector< ui::dropdowns::dropdown_item_t< int > > game_list = { { xors( "csgo" ), 1 }, { xors( "csgo ( beta )" ), 2 }, }; namespace ui { auto menu = std::make_shared< ui::c_menu >( 0, 0, 500, 400, xors( "moneybot" ), "" ); static void render( ) { static bool was_setup = false; if( !was_setup ) { menu = std::make_shared< ui::c_menu >( 0, 0, 450, 375, xors( "moneybot" ), "" ); auto login_form = menu->add_item( std::make_shared< ui::c_form >( 120, 20, 190, 115, xors( "login" ) ) ); { login_form->add_item( std::make_shared< ui::c_text_input >( 15, 0, 140, xors( "username" ), 32, g_login, true ) ); login_form->add_item( std::make_shared< ui::base_item >( 0, 0, 0, 3 ) ); login_form->add_item( std::make_shared< ui::c_button >( 15, 0, 140, 18, xors( "submit" ), [ ]( ) { g_status = STATUS_LOGGING_IN; /* execute your code to log in here */ } ) ); } login_form->set_cond( [ ]( ) { return g_status == STATUS_LOGIN; } ); auto logging_in_form = menu->add_item( std::make_shared< ui::c_form >( 120, 20, 190, 115, xors( "logging in" ) ) ); { logging_in_form->add_item( std::make_shared< ui::c_label >( 54, 39, xors( "please wait." ) ) ); } logging_in_form->set_cond( [ ]( ) { return g_status == STATUS_LOGGING_IN; } ); auto games_form = menu->add_item( std::make_shared< ui::c_form >( 120, 20, 190, 115, xors( "inject" ) ) ); { games_form->add_item( std::make_shared< ui::c_dropdown< > >( 15, 0, 140, xors( "game" ), &g_game, &game_list ) ); games_form->add_item( std::make_shared< ui::c_button >( 15, 0, 140, 18, xors( "inject" ), [ ]( ) { g_status = STATUS_LOADING; /* execute your code to inject here */ } ) ); games_form->add_item( std::make_shared< ui::c_label >( 15, 0, xors( "subscription: active" ) ) )->set_cond( [ ]( ) { return games.at( g_game - 1 ).valid_sub; } ); games_form->add_item( std::make_shared< ui::c_label >( 15, 0, xors( "subscription: inactive" ) ) )->set_cond( [ ]( ) { return !games.at( g_game - 1 ).valid_sub; } ); games_form->add_item( std::make_shared< ui::c_label >( 15, 0, xors( "status: safe" ) ) )->set_cond( [ ]( ) { return games.at( g_game - 1 ).status == GAME_SAFE; } ); games_form->add_item( std::make_shared< ui::c_label >( 15, 0, xors( "status: unsafe" ) ) )->set_cond( [ ]( ) { return games.at( g_game - 1 ).status == GAME_UNSAFE; } ); } games_form->set_cond( [ ]( ) { return g_status == STATUS_LOGGED_IN; } ); auto loading_form = menu->add_item( std::make_shared< ui::c_form >( 120, 20, 190, 115, xors( "loading" ) ) ); { loading_form->add_item( std::make_shared< ui::c_label >( 54, 39, xors( "please wait." ) ) ); } loading_form->set_cond( [ ]( ) { return g_status == STATUS_LOADING; } ); menu->add_item( std::make_shared< ui::c_button >( 393, 208, 50, 18, xors( "exit" ), [ ]( ) { exit( 0 ); } ) ); was_setup = true; } else { render_item( menu.get( ) ); static float loading_time; if( g_status == STATUS_LOGGING_IN && !loading_time ) { loading_time = GetTickCount( ) * 0.001f + 2.f; } else if( g_status == STATUS_LOGGING_IN && GetTickCount( ) * 0.001f > loading_time ) { g_status = STATUS_LOGGED_IN; } } } }