├── .gitattributes ├── .gitignore ├── README.md ├── contrib.rar ├── cs2_internal.sln ├── cs2_internal ├── cs2_internal.vcxproj ├── cs2_internal.vcxproj.filters ├── include │ └── sdk │ │ ├── generated.h │ │ ├── offsets.h │ │ ├── offsets_schema.h │ │ ├── proto.h │ │ └── schema │ │ ├── client.h │ │ ├── engine2.h │ │ ├── global_types.h │ │ ├── particles.h │ │ ├── server.h │ │ └── worldrenderer.h └── src │ ├── dllmain.cpp │ ├── framework.h │ ├── game │ ├── cfg.cpp │ ├── cfg.h │ ├── draw_manager.cpp │ ├── draw_manager.h │ ├── game.cpp │ ├── game.h │ ├── hook_manager.cpp │ ├── hook_manager.h │ ├── movement.cpp │ ├── movement.h │ ├── visuals.cpp │ └── visuals.h │ ├── gui │ ├── anim.cpp │ ├── anim.h │ ├── container.cpp │ ├── container.h │ ├── control.cpp │ ├── control.h │ ├── controls.h │ ├── controls │ │ ├── action_item.cpp │ │ ├── action_item.h │ │ ├── button.cpp │ │ ├── button.h │ │ ├── checkbox.cpp │ │ ├── checkbox.h │ │ ├── child_tab.cpp │ │ ├── child_tab.h │ │ ├── color_picker.cpp │ │ ├── color_picker.h │ │ ├── combo_box.cpp │ │ ├── combo_box.h │ │ ├── combo_box_agent.cpp │ │ ├── combo_box_agent.h │ │ ├── control_container.cpp │ │ ├── control_container.h │ │ ├── group.cpp │ │ ├── group.h │ │ ├── hotkey.cpp │ │ ├── hotkey.h │ │ ├── hotkey_view.cpp │ │ ├── hotkey_view.h │ │ ├── hsv_slider.cpp │ │ ├── hsv_slider.h │ │ ├── image.h │ │ ├── label.cpp │ │ ├── label.h │ │ ├── layout.cpp │ │ ├── layout.h │ │ ├── list.cpp │ │ ├── list.h │ │ ├── loading.cpp │ │ ├── loading.h │ │ ├── notification_control.cpp │ │ ├── notification_control.h │ │ ├── popup.cpp │ │ ├── popup.h │ │ ├── public_software_item.cpp │ │ ├── public_software_item.h │ │ ├── search_result.cpp │ │ ├── search_result.h │ │ ├── selectable.cpp │ │ ├── selectable.h │ │ ├── selectable_game.cpp │ │ ├── selectable_inv.cpp │ │ ├── selectable_inv.h │ │ ├── selectable_script.cpp │ │ ├── selectable_script.h │ │ ├── settings.cpp │ │ ├── settings.h │ │ ├── slider.cpp │ │ ├── slider.h │ │ ├── spacer.cpp │ │ ├── spacer.h │ │ ├── tab.cpp │ │ ├── tab.h │ │ ├── tabs_layout.cpp │ │ ├── tabs_layout.h │ │ ├── text_input.cpp │ │ ├── text_input.h │ │ ├── toggle_button.cpp │ │ ├── toggle_button.h │ │ ├── widget.cpp │ │ ├── widget.h │ │ ├── window.cpp │ │ └── window.h │ ├── debug.h │ ├── gui.cpp │ ├── gui.h │ ├── helpers.cpp │ ├── helpers.h │ ├── hotkeys.h │ ├── input.cpp │ ├── input.h │ ├── misc.h │ ├── notify_system.cpp │ ├── notify_system.h │ ├── popups │ │ ├── about_popup.cpp │ │ ├── about_popup.h │ │ ├── action_list_popup.cpp │ │ ├── action_list_popup.h │ │ ├── color_picker_popup.cpp │ │ ├── color_picker_popup.h │ │ ├── combo_box_popup.cpp │ │ ├── combo_box_popup.h │ │ ├── configs_popup.cpp │ │ ├── configs_popup.h │ │ ├── dialog_box.cpp │ │ ├── dialog_box.h │ │ ├── hotkey_overview_popup.cpp │ │ ├── hotkey_overview_popup.h │ │ ├── hotkey_popup.cpp │ │ ├── hotkey_popup.h │ │ ├── message_box.cpp │ │ ├── message_box.h │ │ ├── notifications_popup.cpp │ │ ├── notifications_popup.h │ │ ├── public_software_popup.cpp │ │ ├── public_software_popup.h │ │ ├── search_popup.cpp │ │ ├── search_popup.h │ │ ├── settings_popup.cpp │ │ └── settings_popup.h │ ├── traits.h │ └── values.h │ ├── hooks │ ├── client.cpp │ ├── hooks.h │ ├── input_system.cpp │ └── steam.cpp │ ├── macros.h │ ├── memory │ ├── common.h │ ├── crt.h │ ├── detour_hook.h │ ├── interfaceless.h │ ├── keyvalue3.h │ ├── memory.cpp │ ├── memory.h │ ├── pe64.h │ └── stb_sprintf.h │ ├── menu │ ├── init │ │ ├── init_anim.cpp │ │ ├── init_anim.h │ │ └── resources │ │ │ ├── atality.h │ │ │ ├── f200.h │ │ │ └── f400.h │ ├── macros.h │ ├── menu.cpp │ ├── menu.h │ ├── resources │ │ ├── cursor.h │ │ ├── hotkey_icons.h │ │ ├── icon_add.h │ │ ├── icon_allow_insecure.h │ │ ├── icon_autoload.h │ │ ├── icon_bug.h │ │ ├── icon_clear.h │ │ ├── icon_close.h │ │ ├── icon_cloud.h │ │ ├── icon_cloud_upd.h │ │ ├── icon_configs.h │ │ ├── icon_copy.h │ │ ├── icon_delete.h │ │ ├── icon_down.h │ │ ├── icon_export.h │ │ ├── icon_file.h │ │ ├── icon_import.h │ │ ├── icon_info.h │ │ ├── icon_keys.h │ │ ├── icon_legit.h │ │ ├── icon_load.h │ │ ├── icon_misc.h │ │ ├── icon_paste.h │ │ ├── icon_rage.h │ │ ├── icon_refresh.h │ │ ├── icon_save.h │ │ ├── icon_scripts.h │ │ ├── icon_search.h │ │ ├── icon_settings.h │ │ ├── icon_skins.h │ │ ├── icon_up.h │ │ ├── icon_visuals.h │ │ ├── loading.h │ │ ├── logo_head.h │ │ └── logo_stripes.h │ └── tabs │ │ ├── tab_legit.cpp │ │ ├── tab_lua.cpp │ │ ├── tab_misc.cpp │ │ ├── tab_rage.cpp │ │ ├── tab_skins.cpp │ │ └── tab_visuals.cpp │ ├── minhook │ ├── buffer.c │ ├── buffer.h │ ├── hde │ │ ├── hde32.c │ │ ├── hde32.h │ │ ├── hde64.c │ │ ├── hde64.h │ │ ├── pstdint.h │ │ ├── table32.h │ │ └── table64.h │ ├── hook.c │ ├── minhook.h │ ├── trampoline.c │ └── trampoline.h │ ├── renderer │ ├── include │ │ ├── lib │ │ │ ├── image.h │ │ │ ├── rectpack.h │ │ │ └── truetype.h │ │ └── ren │ │ │ ├── adapter.h │ │ │ ├── adapters │ │ │ ├── adapter_dx11.h │ │ │ └── adapter_dx9.h │ │ │ ├── buffer.h │ │ │ ├── buffers │ │ │ ├── cmd_buffer.h │ │ │ ├── ib_dx11.h │ │ │ ├── ib_dx9.h │ │ │ ├── vb_dx11.h │ │ │ └── vb_dx9.h │ │ │ ├── layer.h │ │ │ ├── macros.h │ │ │ ├── managed.h │ │ │ ├── misc.h │ │ │ ├── renderer.h │ │ │ └── types │ │ │ ├── animated_texture.h │ │ │ ├── animator.h │ │ │ ├── color.h │ │ │ ├── command.h │ │ │ ├── font.h │ │ │ ├── pos.h │ │ │ ├── shader.h │ │ │ ├── texture.h │ │ │ └── vertex.h │ └── src │ │ ├── adapters │ │ ├── adapter_dx11.cpp │ │ └── adapter_dx9.cpp │ │ ├── buffers │ │ ├── cmd_buffer.cpp │ │ ├── ib_dx11.cpp │ │ ├── ib_dx9.cpp │ │ ├── vb_dx11.cpp │ │ └── vb_dx9.cpp │ │ ├── layer.cpp │ │ ├── renderer.cpp │ │ └── types │ │ ├── animated_texture.cpp │ │ ├── font.cpp │ │ ├── shader.cpp │ │ └── texture.cpp │ ├── resources │ ├── josefin_sans.h │ ├── josefin_sans_bold.h │ └── smallest_pixel.h │ ├── sdk │ ├── client.cpp │ ├── client.h │ ├── color.h │ ├── cvar.h │ ├── engine.h │ ├── globalvars.h │ ├── input.h │ ├── inputsystem.h │ ├── interface.h │ ├── localize.h │ ├── macros.h │ ├── math │ │ ├── intrinsic.h │ │ ├── mat.h │ │ └── vector.h │ ├── mem_alloc.h │ ├── panorama.h │ ├── schema.h │ ├── sdk.h │ ├── utl.h │ ├── utl │ │ ├── utl_linked_list.h │ │ ├── utl_memory.h │ │ ├── utl_string.h │ │ ├── utl_ts_hash.h │ │ └── utl_vector.h │ └── vec.h │ ├── tinyformat.h │ └── utils │ ├── defs.h │ ├── fnv1a.h │ ├── hook.h │ ├── json.hpp │ ├── math.h │ ├── mem.cpp │ ├── mem.h │ ├── murmur2.h │ ├── profiler.h │ ├── random.h │ ├── util.h │ ├── value_obfuscation.h │ └── zip_file.hpp └── framework.png /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OUTDATED!!! 2 | You can update by using this: 3 | ``` 4 | 1. https://github.com/maecry/asphyxia-cs2/tree/master/cstrike (schema, hooks, etc...) 5 | 2. https://github.com/neverlosecc/source2gen/tree/main (offsets, patterns) 6 | 3. And use decryptor (any more files not a decrypted by me) 7 | ``` 8 | # Installation 9 | ``` 10 | 1. git clone https://github.com/AluminumFF/Fatality.git 11 | 12 | 2. extract "contrib.rar", and include libs to project 13 | 14 | 3. build the project 15 | 16 | 4. run cs2.exe in -insecure and use extreme injector (NO MMAP!!!) 17 | ``` 18 | # Screenshots 19 | ![](/framework.png) 20 | -------------------------------------------------------------------------------- /contrib.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linwys/Fatality-Framework/67d119fd9893508f86fd61fa17f4609980776cf1/contrib.rar -------------------------------------------------------------------------------- /cs2_internal.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.7.34031.279 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cs2_internal", "cs2_internal\cs2_internal.vcxproj", "{3AFEA3A6-2325-4E24-B977-BC9E95875C0A}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Prerelease|x64 = Prerelease|x64 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {3AFEA3A6-2325-4E24-B977-BC9E95875C0A}.Debug|x64.ActiveCfg = Debug|x64 16 | {3AFEA3A6-2325-4E24-B977-BC9E95875C0A}.Debug|x64.Build.0 = Debug|x64 17 | {3AFEA3A6-2325-4E24-B977-BC9E95875C0A}.Prerelease|x64.ActiveCfg = Prerelease|x64 18 | {3AFEA3A6-2325-4E24-B977-BC9E95875C0A}.Prerelease|x64.Build.0 = Prerelease|x64 19 | {3AFEA3A6-2325-4E24-B977-BC9E95875C0A}.Release|x64.ActiveCfg = Release|x64 20 | {3AFEA3A6-2325-4E24-B977-BC9E95875C0A}.Release|x64.Build.0 = Release|x64 21 | EndGlobalSection 22 | GlobalSection(SolutionProperties) = preSolution 23 | HideSolutionNode = FALSE 24 | EndGlobalSection 25 | GlobalSection(ExtensibilityGlobals) = postSolution 26 | SolutionGuid = {E121722D-C6D6-43B1-8F7A-5D79613355B2} 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /cs2_internal/include/sdk/generated.h: -------------------------------------------------------------------------------- 1 | // generated on: 11/6/2023 2 | 3 | #ifndef SDK_GENERATED_H 4 | #define SDK_GENERATED_H 5 | 6 | #include 7 | 8 | #define MEMBER_OFF(n, off, ...) __VA_ARGS__ &get_##n() { return *(__VA_ARGS__ *)(uintptr_t(this) + off); } 9 | #define MEMBER_CUSTOM(n, c, ...) __VA_ARGS__& get_##n () { return *(__VA_ARGS__*)(uintptr_t(this) + sdk::offsets::c::n); } 10 | #define MEMBER(n, c, ...) __VA_ARGS__& get_##n () { return *(__VA_ARGS__*)(uintptr_t(this) + sdk::offsets::schema::c::n); } 11 | #define MEMBER_ARR(n, c, i, ...) std::array<__VA_ARGS__, i>& get_##n () { return *(std::array<__VA_ARGS__, i>*)(uintptr_t(this) + sdk::offsets::schema::c::n); } 12 | // TODO 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | #include "proto.h" 28 | #include "offsets.h" 29 | #include "offsets_schema.h" 30 | 31 | #include "schema/global_types.h" 32 | 33 | #include "schema/client.h" 34 | #include "schema/engine2.h" 35 | #include "schema/particles.h" 36 | #include "schema/server.h" 37 | #include "schema/worldrenderer.h" 38 | 39 | namespace sdk {} // namespace sdk 40 | 41 | #endif // SDK_GENERATED_H 42 | -------------------------------------------------------------------------------- /cs2_internal/include/sdk/schema/engine2.h: -------------------------------------------------------------------------------- 1 | // generated on: 11/6/2023 2 | 3 | #ifndef SDK_SCHEMA_ENGINE2_H 4 | #define SDK_SCHEMA_ENGINE2_H 5 | 6 | #include 7 | 8 | namespace sdk 9 | { 10 | namespace schema 11 | { 12 | namespace engine2 13 | { 14 | class centity_component; 15 | class centity_identity; 16 | class centity_instance; 17 | class cscript_component; 18 | 19 | class centity_component 20 | { 21 | public: 22 | // empty. 23 | template 24 | T *as() { return reinterpret_cast(this); } 25 | }; // class centity_component 26 | 27 | class centity_identity 28 | { 29 | public: 30 | MEMBER(name_stringable_index, engine2::centity_identity, int); 31 | MEMBER(name, engine2::centity_identity, cutl_symbol_large); 32 | MEMBER(designer_name, engine2::centity_identity, cutl_symbol_large); 33 | MEMBER(flags, engine2::centity_identity, uint32_t); 34 | MEMBER(world_group_id, engine2::centity_identity, world_group_id_t); 35 | MEMBER(data_object_types, engine2::centity_identity, uint32_t); 36 | MEMBER(path_index, engine2::centity_identity, change_accessor_field_path_index_t); 37 | MEMBER(prev_ptr, engine2::centity_identity, centity_identity*); 38 | MEMBER(next_ptr, engine2::centity_identity, centity_identity*); 39 | MEMBER(prev_by_class_ptr, engine2::centity_identity, centity_identity*); 40 | MEMBER(next_by_class_ptr, engine2::centity_identity, centity_identity*); 41 | template 42 | T *as() { return reinterpret_cast(this); } 43 | }; // class centity_identity 44 | 45 | class centity_instance 46 | { 47 | public: 48 | MEMBER(isz_private_vscripts, engine2::centity_instance, cutl_symbol_large); 49 | MEMBER(entity_ptr, engine2::centity_instance, centity_identity*); 50 | MEMBER(cscript_component_ptr, engine2::centity_instance, cscript_component*); 51 | template 52 | T *as() { return reinterpret_cast(this); } 53 | }; // class centity_instance 54 | 55 | class cscript_component : public centity_component 56 | { 57 | public: 58 | MEMBER(script_class_name, engine2::cscript_component, cutl_symbol_large); 59 | template 60 | T *as() { return reinterpret_cast(this); } 61 | }; // class cscript_component : public centity_component 62 | 63 | } // namespace engine2 64 | 65 | } // namespace schema 66 | 67 | } // namespace sdk 68 | 69 | #endif // SDK_SCHEMA_ENGINE2_H 70 | -------------------------------------------------------------------------------- /cs2_internal/include/sdk/schema/particles.h: -------------------------------------------------------------------------------- 1 | // generated on: 11/6/2023 2 | 3 | #ifndef SDK_SCHEMA_PARTICLES_H 4 | #define SDK_SCHEMA_PARTICLES_H 5 | 6 | #include 7 | 8 | namespace sdk 9 | { 10 | namespace schema 11 | { 12 | namespace particles 13 | { 14 | class cparticle_binding_real_pulse; 15 | 16 | class cparticle_binding_real_pulse : public cparticle_collection_binding_instance 17 | { 18 | public: 19 | // empty. 20 | template 21 | T *as() { return reinterpret_cast(this); } 22 | }; // class cparticle_binding_real_pulse : public cparticle_collection_binding_instance 23 | 24 | } // namespace particles 25 | 26 | } // namespace schema 27 | 28 | } // namespace sdk 29 | 30 | #endif // SDK_SCHEMA_PARTICLES_H 31 | -------------------------------------------------------------------------------- /cs2_internal/include/sdk/schema/worldrenderer.h: -------------------------------------------------------------------------------- 1 | // generated on: 11/6/2023 2 | 3 | #ifndef SDK_SCHEMA_WORLDRENDERER_H 4 | #define SDK_SCHEMA_WORLDRENDERER_H 5 | 6 | #include 7 | 8 | namespace sdk 9 | { 10 | namespace schema 11 | { 12 | namespace worldrenderer 13 | { 14 | class centity_component; 15 | class centity_identity; 16 | class centity_instance; 17 | class cscript_component; 18 | 19 | class centity_component 20 | { 21 | public: 22 | // empty. 23 | template 24 | T *as() { return reinterpret_cast(this); } 25 | }; // class centity_component 26 | 27 | class centity_identity 28 | { 29 | public: 30 | MEMBER(name_stringable_index, worldrenderer::centity_identity, int); 31 | MEMBER(name, worldrenderer::centity_identity, cutl_symbol_large); 32 | MEMBER(designer_name, worldrenderer::centity_identity, cutl_symbol_large); 33 | MEMBER(flags, worldrenderer::centity_identity, uint32_t); 34 | MEMBER(world_group_id, worldrenderer::centity_identity, world_group_id_t); 35 | MEMBER(data_object_types, worldrenderer::centity_identity, uint32_t); 36 | MEMBER(path_index, worldrenderer::centity_identity, change_accessor_field_path_index_t); 37 | MEMBER(prev_ptr, worldrenderer::centity_identity, centity_identity*); 38 | MEMBER(next_ptr, worldrenderer::centity_identity, centity_identity*); 39 | MEMBER(prev_by_class_ptr, worldrenderer::centity_identity, centity_identity*); 40 | MEMBER(next_by_class_ptr, worldrenderer::centity_identity, centity_identity*); 41 | template 42 | T *as() { return reinterpret_cast(this); } 43 | }; // class centity_identity 44 | 45 | class centity_instance 46 | { 47 | public: 48 | MEMBER(isz_private_vscripts, worldrenderer::centity_instance, cutl_symbol_large); 49 | MEMBER(entity_ptr, worldrenderer::centity_instance, centity_identity*); 50 | MEMBER(cscript_component_ptr, worldrenderer::centity_instance, cscript_component*); 51 | template 52 | T *as() { return reinterpret_cast(this); } 53 | }; // class centity_instance 54 | 55 | class cscript_component : public centity_component 56 | { 57 | public: 58 | MEMBER(script_class_name, worldrenderer::cscript_component, cutl_symbol_large); 59 | template 60 | T *as() { return reinterpret_cast(this); } 61 | }; // class cscript_component : public centity_component 62 | 63 | } // namespace worldrenderer 64 | 65 | } // namespace schema 66 | 67 | } // namespace sdk 68 | 69 | #endif // SDK_SCHEMA_WORLDRENDERER_H 70 | -------------------------------------------------------------------------------- /cs2_internal/src/dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include "game/game.h" 2 | 3 | //BOOL APIENTRY DllMain(uintptr_t inst, uint32_t reason, uint32_t reserved) 4 | //{ 5 | // if (reason == DLL_PROCESS_ATTACH) 6 | // { 7 | // std::thread( 8 | // [inst, reserved] 9 | // { 10 | // game = std::make_unique(inst, reserved); 11 | // game->init(); 12 | // }).detach(); 13 | // } 14 | // 15 | // return TRUE; 16 | //} 17 | 18 | uintptr_t __stdcall init_main(const HMODULE h_module) { 19 | game->init(); 20 | return 0; 21 | } 22 | 23 | BOOL APIENTRY DllMain(uintptr_t inst, uint32_t dw_reason_for_call, uint32_t lp_reserved) { 24 | switch (dw_reason_for_call) { 25 | case DLL_PROCESS_ATTACH: 26 | { 27 | DisableThreadLibraryCalls((HMODULE)inst); 28 | 29 | auto current_process = GetCurrentProcess(); 30 | auto priority_class = GetPriorityClass(current_process); 31 | 32 | if (priority_class != HIGH_PRIORITY_CLASS 33 | && priority_class != REALTIME_PRIORITY_CLASS) 34 | SetPriorityClass(current_process, HIGH_PRIORITY_CLASS); 35 | 36 | game = std::make_unique(inst, lp_reserved); 37 | CreateThread(NULL, NULL, reinterpret_cast(init_main), (LPVOID)inst, NULL, NULL); 38 | 39 | return true; 40 | } 41 | default: 42 | return true; 43 | } 44 | 45 | //std::this_thread::sleep_for(std::chrono::milliseconds(100)); 46 | } -------------------------------------------------------------------------------- /cs2_internal/src/framework.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma warning(disable: 4267) 3 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | 19 | #pragma push_macro("max") 20 | #pragma push_macro("min") 21 | #undef max 22 | #undef min 23 | 24 | template 25 | __forceinline T clamp(const T &n, const T &lower, const T &upper) 26 | { 27 | return std::max(lower, std::min(n, upper)); 28 | } 29 | 30 | #pragma pop_macro("max") 31 | #pragma pop_macro("min") 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | #pragma comment(lib, "d3dx11.lib") 38 | -------------------------------------------------------------------------------- /cs2_internal/src/game/draw_manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | constexpr auto game_layer = 16; 6 | constexpr auto invalid_name = static_cast(-1); 7 | 8 | struct draw_manager_t 9 | { 10 | struct icon_info_t 11 | { 12 | uint32_t name = invalid_name; 13 | std::string path; 14 | uint32_t height; 15 | std::shared_ptr tex; 16 | }; 17 | 18 | void destroy_objects(); 19 | void create_objects(); 20 | 21 | void add_icon( 22 | const evo::ren::vec2 &pos, const evo::ren::color &col, const std::shared_ptr &texture, 23 | std::optional params = std::nullopt, bool dropshadow = true) const; 24 | 25 | static std::shared_ptr load_svg_to_texture(uint8_t *data, size_t sz, uint32_t w, uint32_t h); 26 | std::shared_ptr get_panorama_texture(const std::string &path, uint32_t height); 27 | std::shared_ptr get_svg_texture(uint32_t name, uint32_t target_height); 28 | 29 | std::unordered_map svg_icons = { 30 | {FNV1A("taser"), ENC( 31 | "")},}; 40 | 41 | std::shared_ptr buf; 42 | std::atomic_bool dirty_ackn; 43 | std::unordered_map textures; 44 | }; 45 | 46 | extern draw_manager_t draw_mgr; 47 | -------------------------------------------------------------------------------- /cs2_internal/src/game/hook_manager.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | hook_manager_t hook_manager; 7 | 8 | void hook_manager_t::init() 9 | { 10 | if (MH_Initialize() != MH_OK) 11 | return; 12 | 13 | hooks::steam::hkPresent.Create(MEM::GetVFunc(sdk::SwapChain->pDXGISwapChain, 8U), reinterpret_cast(&hooks::steam::present)); 14 | hooks::input_system::hkMouseInputEnabled.Create(MEM::GetVFunc(sdk::Input, 13U), reinterpret_cast(&hooks::input_system::mouse_input_enabled)); 15 | //hooks::client::hkGetFov.Create(MEM::GetVFunc(sdk::Client, 13U), reinterpret_cast(&hooks::client::get_fov)); 16 | hooks::client::hkOnRenderStart.Create(MEM::GetVFunc(sdk::Client, 4U), reinterpret_cast(&hooks::client::on_render_start)); 17 | 18 | 19 | ///create_hook(frame_stage_notify, game->client.at(sdk::offsets::functions::client::frame_stage_notify), &hooks::client::frame_stage_notify); 20 | 21 | ///create_hook(override_view, game->client.at(sdk::offsets::functions::client::override_view), &hooks::client::override_view); 22 | 23 | //create_hook(on_render_start, game->client.at(sdk::offsets::functions::client::on_render_start), &hooks::client::on_render_start); 24 | 25 | ///create_hook(get_fov, game->client.at(sdk::offsets::functions::cameramanager::set_fov), &hooks::client::get_fov); 26 | 27 | ///create_hook(create_move, game->client.at(sdk::offsets::functions::input::csgoinput_create_move), &hooks::client::create_move); 28 | 29 | /////////////////////////////////create_hook(prediction_update, game->client.at(0x7A5860), &hooks::client::prediction_update); 30 | } 31 | 32 | void hook_manager_t::attach() const 33 | { 34 | for (auto &hook : hooks) 35 | hook->attach(); 36 | } 37 | 38 | void hook_manager_t::detach() const 39 | { 40 | for (auto &hook : hooks) 41 | hook->detach(); 42 | } 43 | -------------------------------------------------------------------------------- /cs2_internal/src/game/hook_manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | struct hook_manager_t 8 | { 9 | hook_manager_t() = default; 10 | 11 | void init(); 12 | void attach() const; 13 | void detach() const; 14 | 15 | std::shared_ptr> wnd_proc; 16 | std::shared_ptr> present; 17 | std::shared_ptr> create_move; 18 | std::shared_ptr> frame_stage_notify; 19 | std::shared_ptr> override_view; 20 | std::shared_ptr> on_render_start; 21 | std::shared_ptr> mouse_input_enabled; 22 | std::shared_ptr> get_fov; 23 | std::shared_ptr> prediction_update; 24 | 25 | private: 26 | std::list> hooks; 27 | }; 28 | 29 | extern hook_manager_t hook_manager; 30 | -------------------------------------------------------------------------------- /cs2_internal/src/game/movement.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | struct movement_t 5 | { 6 | static void bhop(); 7 | static void strafe(); 8 | }; 9 | -------------------------------------------------------------------------------- /cs2_internal/src/game/visuals.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linwys/Fatality-Framework/67d119fd9893508f86fd61fa17f4609980776cf1/cs2_internal/src/game/visuals.cpp -------------------------------------------------------------------------------- /cs2_internal/src/game/visuals.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | struct visuals_t 6 | { 7 | enum class esp_item_pos 8 | { 9 | top, 10 | right, 11 | bottom, 12 | left 13 | }; 14 | 15 | struct player_data_t 16 | { 17 | sdk::vector pos{}; 18 | evo::ren::vec2 top{}; 19 | evo::ren::vec2 bot{}; 20 | 21 | struct 22 | { 23 | int top; 24 | int right; 25 | int bottom; 26 | int left; 27 | int text_left; 28 | int text_right; 29 | } offset{}; 30 | 31 | int &get_offset(esp_item_pos item_pos) 32 | { 33 | return item_pos == esp_item_pos::top 34 | ? offset.top 35 | : item_pos == esp_item_pos::right 36 | ? offset.right 37 | : item_pos == esp_item_pos::bottom 38 | ? offset.bottom 39 | : offset.left; 40 | } 41 | 42 | float height{}; 43 | float width{}; 44 | float fade_time{}; 45 | float alpha{}; 46 | float alpha_lerp{}; 47 | float model_alpha{}; 48 | float spawntime{}; 49 | float health_interpolated{}; 50 | bool oof{}; 51 | }; 52 | 53 | struct debug_info_t 54 | { 55 | void add(const char *text) { value = text ? text : "-empty-"; } 56 | 57 | std::string value; 58 | }; 59 | 60 | std::unordered_map values; 61 | 62 | void run(); 63 | void draw_debug_info() const; 64 | static void add_text(player_data_t &player, esp_item_pos pos, const evo::ren::color &color, const std::string &text, bool is_name = false); 65 | static void add_icon( 66 | player_data_t &player, esp_item_pos pos, const evo::ren::color &color, const std::shared_ptr &texture, 67 | std::optional add = std::nullopt, std::optional height_override = std::nullopt); 68 | static void add_bar(player_data_t &player, esp_item_pos pos, const std::vector &colors, float fraction, std::optional value = std::nullopt); 69 | static void draw_bar( 70 | const evo::ren::vec2 &start_pos, int length, bool horizontal, const std::vector &colors, float fraction, 71 | std::optional value = std::nullopt); 72 | 73 | player_data_t players[sdk::max_players]; 74 | 75 | sdk::cview_setup viewset; 76 | }; 77 | 78 | extern visuals_t visuals; 79 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/anim.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | GUI_NAMESPACE; 5 | 6 | void anim_float_color::animate() 7 | { 8 | anim::animate(); 9 | value.f = i(start.f, end.f); 10 | 11 | if (type == ren::act_rgba) 12 | { 13 | value.c.value.r = i(start.c.value.r, end.c.value.r); 14 | value.c.value.g = i(start.c.value.g, end.c.value.g); 15 | value.c.value.b = i(start.c.value.b, end.c.value.b); 16 | value.c.value.a = i(start.c.value.a, end.c.value.a); 17 | } 18 | else 19 | value.c = value.c.hsv((uint16_t)i(start.c.h(), end.c.h()), i(start.c.s(), end.c.s()), i(start.c.v(), end.c.v())).a(i(start.c.value.a, end.c.value.a)); 20 | } 21 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/anim.h: -------------------------------------------------------------------------------- 1 | #ifndef GUI_TESTER_ANIM_H 2 | #define GUI_TESTER_ANIM_H 3 | 4 | #include 5 | #include 6 | 7 | namespace evo::gui 8 | { 9 | class u_fc 10 | { 11 | public: 12 | u_fc(float fl, const ren::color &cl) : 13 | f(fl), c(cl) { } 14 | 15 | float f{}; 16 | ren::color c{}; 17 | }; 18 | 19 | class u_fv 20 | { 21 | public: 22 | u_fv(float fl, const ren::vec2 &vc) : 23 | f(fl), v(vc) { } 24 | 25 | float f{}; 26 | ren::vec2 v{}; 27 | }; 28 | 29 | // shorthand for float + color animation 30 | class anim_float_color : public ren::anim 31 | { 32 | public: 33 | anim_float_color(const float &f, const ren::color &c, float d, char i = ren::ease_linear) : 34 | ren::anim(u_fc(f, c), d, i) { } 35 | 36 | void animate() override; 37 | 38 | char type{}; 39 | }; 40 | } 41 | 42 | #endif //GUI_TESTER_ANIM_H 43 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls.h: -------------------------------------------------------------------------------- 1 | #ifndef GUI_TESTER_CONTROLS_H 2 | #define GUI_TESTER_CONTROLS_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | namespace evo::gui {} 29 | 30 | #endif //GUI_TESTER_CONTROLS_H 31 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/action_item.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace evo::gui 5 | { 6 | using namespace ren; 7 | 8 | void action_item::render() 9 | { 10 | control::render(); 11 | if (!is_visible) 12 | return; 13 | 14 | an->animate(); 15 | 16 | const auto r = area_abs(); 17 | 18 | auto &d = draw.layers[ctx->content_layer]; 19 | d->font = draw.fonts[GUI_HASH("gui_main")]; 20 | d->add_text(r.tl() + vec2{4.f, 4.f}, s, an->value); 21 | } 22 | 23 | void action_item::on_mouse_down(char key) 24 | { 25 | if (key != m_left || is_locked_by_me()) 26 | return; 27 | 28 | is_selected ? unselect() : select(); 29 | 30 | update_parent_value(); 31 | lock_input(); 32 | } 33 | 34 | void action_item::on_mouse_up(char key) 35 | { 36 | unlock_input(); 37 | } 38 | 39 | void action_item::on_mouse_enter() 40 | { 41 | if (is_selected) 42 | return; 43 | 44 | an->direct(colors.text_light); 45 | } 46 | 47 | void action_item::on_mouse_leave() 48 | { 49 | if (is_selected) 50 | return; 51 | 52 | an->direct(colors.text_mid); 53 | } 54 | 55 | void action_item::select() 56 | { 57 | is_selected = true; 58 | an->direct(colors.accent); 59 | } 60 | 61 | void action_item::unselect() 62 | { 63 | is_selected = false; 64 | an->direct(colors.text_mid); 65 | } 66 | 67 | void action_item::update_parent_value() 68 | { 69 | const auto p = ctx->find(GUI_HASH("action_list_popup")); 70 | if (!p) 71 | return; 72 | 73 | p->update_value(v, is_selected); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/action_item.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace evo::gui 6 | { 7 | class action_item : public control 8 | { 9 | public: 10 | action_item(control_id _id, uint32_t val, const std::string &str) : 11 | control(_id, {}, {0.f, 20.f}), v(val), s(str) 12 | { 13 | an = std::make_shared(colors.text_mid, .15f); 14 | 15 | margin.maxs.y = 2.f; 16 | size_to_parent_w = true; 17 | } 18 | 19 | void render() override; 20 | 21 | void on_mouse_enter() override; 22 | void on_mouse_leave() override; 23 | void on_mouse_down(char key) override; 24 | void on_mouse_up(char key) override; 25 | 26 | void select(); 27 | void unselect(); 28 | 29 | bool is_selected{}; 30 | std::shared_ptr an; 31 | 32 | private: 33 | uint32_t v; 34 | std::string s; 35 | 36 | void update_parent_value(); 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/button.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | GUI_NAMESPACE; 4 | 5 | void button::on_mouse_enter() 6 | { 7 | if (is_input_locked()) 8 | return; 9 | 10 | using namespace ren; 11 | if (color.value.a == 0.f) 12 | an->direct(tex ? colors.text : colors.text_dark); 13 | else 14 | an->direct(color.mod_a(.6f)); 15 | } 16 | 17 | void button::on_mouse_leave() 18 | { 19 | if (is_input_locked()) 20 | return; 21 | 22 | using namespace ren; 23 | if (color.value.a == 0.f) 24 | an->direct(tex ? colors.text_dark : colors.text); 25 | else 26 | an->direct(color); 27 | } 28 | 29 | void button::on_mouse_down(char key) 30 | { 31 | if (key != m_left || is_input_locked()) 32 | return; 33 | 34 | using namespace ren; 35 | if (color.value.a == 0.f) 36 | an->direct(tex ? colors.text : colors.accent); 37 | 38 | if (callback) 39 | callback(); 40 | 41 | run_universal_callbacks(); 42 | ctx->do_tick_sound(); 43 | lock_input(); 44 | } 45 | 46 | void button::on_mouse_up(char key) 47 | { 48 | if (key != m_left) 49 | return; 50 | 51 | unlock_input(); 52 | using namespace ren; 53 | if (color.value.a == 0.f) 54 | an->direct(is_mouse_on_me ? (tex ? colors.text : colors.text_dark) : (tex ? colors.text_dark : colors.text)); 55 | } 56 | 57 | void button::on_first_render_call() 58 | { 59 | control::on_first_render_call(); 60 | if (color.value.a == 0.f) 61 | return; 62 | 63 | an->start = an->end = an->value = color; 64 | } 65 | 66 | void button::render() 67 | { 68 | control::render(); 69 | if (!is_visible) 70 | return; 71 | 72 | const auto r = area_abs(); 73 | an->animate(); 74 | 75 | auto &l = draw.layers[ctx->content_layer]; 76 | 77 | if (render_bg || !tex) 78 | l->add_rect_filled_rounded(r, colors.bg_bottom, 2.f); 79 | 80 | l->font = draw.fonts[GUI_HASH("gui_main")]; 81 | if (!tex || !tex->obj) 82 | { 83 | if (center_text) 84 | l->add_text(r.center() + vec2{0.f, 1.f}, text, an->value, text_params::with_vh(align_center, align_center)); 85 | else 86 | l->add_text(r.tl() + vec2{4.f, r.height() * .5f}, text, an->value, text_params::with_v(align_center)); 87 | } 88 | else 89 | { 90 | l->g.texture = tex->obj; 91 | l->add_rect_filled(icon_size.len_sqr() == 0.f ? r.width(r.height()) : rect{r.center() - icon_size * 0.5f, r.center() + icon_size * 0.5f}, an->value); 92 | l->g.texture = {}; 93 | l->add_text(r.tl() + vec2{r.height() + 4.f, r.height() * 0.5f + 1.f}, text, an->value, text_params::with_vh(align_center, align_center)); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/button.h: -------------------------------------------------------------------------------- 1 | #ifndef BUTTON_39B327AF50964C379A9ACB08A427D1EF_H 2 | #define BUTTON_39B327AF50964C379A9ACB08A427D1EF_H 3 | 4 | #include 5 | #include 6 | 7 | namespace evo::gui 8 | { 9 | class button : public control 10 | { 11 | public: 12 | button(control_id id, const std::string &t, const std::shared_ptr &x = {}, const ren::vec2 &p = {}, const ren::vec2 &s = {100.f, 24.f}) : 13 | control(id, p, s), tex(x), text(t) 14 | { 15 | using namespace ren; 16 | an = std::make_shared(x ? colors.text_dark : colors.text, 0.15f); 17 | margin = {2.f, 2.f, 2.f, 2.f}; 18 | 19 | if (x) 20 | size.x += size.y + 4.f; 21 | 22 | type = ctrl_button; 23 | } 24 | 25 | void on_first_render_call() override; 26 | void on_mouse_enter() override; 27 | void on_mouse_leave() override; 28 | void on_mouse_down(char key) override; 29 | void on_mouse_up(char key) override; 30 | 31 | void render() override; 32 | 33 | std::shared_ptr tex{}; 34 | std::string text{}; 35 | bool render_bg{}, center_text{true}; 36 | ren::color color{}; 37 | ren::vec2 icon_size{}; 38 | std::function callback{}; 39 | 40 | private: 41 | std::shared_ptr an; 42 | }; 43 | } 44 | 45 | #endif //BUTTON_39B327AF50964C379A9ACB08A427D1EF_H 46 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/checkbox.h: -------------------------------------------------------------------------------- 1 | #ifndef GUI_TESTER_CHECKBOX_H 2 | #define GUI_TESTER_CHECKBOX_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | namespace evo::gui 14 | { 15 | class checkbox : public control 16 | { 17 | public: 18 | checkbox(control_id id, value_param &v, const ren::vec2 &p = {}) : 19 | control(id, p, {12.f, 12.f}), value(v) 20 | { 21 | using namespace ren; 22 | 23 | margin = {2.f, 6.f, 2.f, 6.f}; 24 | hotkey_type = hkt_checkbox; 25 | an = std::make_shared(colors.outline_light.mod_a(0), 0.1f); 26 | ctx->track_accent_anim(an); 27 | 28 | type = ctrl_checkbox; 29 | } 30 | 31 | void reset() override; 32 | void reset_internal(); 33 | void update_hotkey_table() override; 34 | void update_hotkey_value(hotkey_update upd, hotkey_info v) override; 35 | void set_value(bool v); 36 | 37 | void preserve_hotkey_state() override; 38 | void restore_hotkey_state() override; 39 | 40 | void on_mouse_enter() override; 41 | void on_mouse_leave() override; 42 | void on_mouse_down(char key) override; 43 | void on_mouse_up(char key) override; 44 | 45 | void render() override; 46 | 47 | bool is_radio{}; 48 | value_param &value; 49 | std::function callback{}; 50 | 51 | private: 52 | std::shared_ptr an; 53 | bool old_value{}; 54 | }; 55 | } 56 | 57 | #endif //GUI_TESTER_CHECKBOX_H 58 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/child_tab.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | GUI_NAMESPACE; 4 | 5 | void child_tab::render() 6 | { 7 | control::render(); 8 | if (!is_visible) 9 | return; 10 | 11 | auto &d = draw.layers[ctx->content_layer]; 12 | 13 | const auto r = area_abs(); 14 | 15 | an->animate(); 16 | of->animate(); 17 | 18 | const auto c = an->value; 19 | const auto o = of->value; 20 | d->font = draw.fonts[is_selected ? GUI_HASH("gui_bold") : GUI_HASH("gui_main")]; 21 | 22 | if (is_horizontal) 23 | { 24 | d->add_text(r.center() - vec2{4.f, 0.f}, text, c, text_params::with_vh(align_center, align_center)); 25 | if (o > 0.f) 26 | d->add_rect_filled(r.height(2.f).width((r.width() - 8.f) * o).margin_top(size.y - 2.f), colors.accent); 27 | } 28 | else 29 | { 30 | d->add_text(r.tl() + vec2(6.f, size.y * 0.5f + 1.f), text, c, text_params::with_v(align_center)); 31 | if (o > 0.f) 32 | d->add_rect_filled(r.height(r.height() * o).width(2.f), colors.accent); 33 | } 34 | } 35 | 36 | void child_tab::on_mouse_enter() 37 | { 38 | tab::on_mouse_enter(); 39 | an->direct(colors.text); 40 | } 41 | 42 | void child_tab::on_mouse_leave() 43 | { 44 | tab::on_mouse_leave(); 45 | an->direct(is_selected ? colors.text : colors.text_dark); 46 | } 47 | 48 | void child_tab::on_first_render_call() 49 | { 50 | tab::on_first_render_call(); 51 | 52 | if (!size_to_parent_w) 53 | { 54 | size = draw.fonts[GUI_HASH("gui_bold")]->get_text_size(text); 55 | size.y += 8.f; 56 | size.x += 8.f; 57 | } 58 | else 59 | size.y = draw.fonts[GUI_HASH("gui_bold")]->get_text_size(text).y + 8.f; 60 | 61 | if (is_selected) 62 | { 63 | an->direct(colors.text); 64 | of->direct(1.f, 1.f); 65 | } 66 | } 67 | 68 | void child_tab::select() 69 | { 70 | tab::select(); 71 | an->direct(colors.text); 72 | of->direct(1.f); 73 | } 74 | 75 | void child_tab::unselect() 76 | { 77 | tab::unselect(); 78 | an->direct(colors.text_dark); 79 | of->direct(0.f); 80 | } 81 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/child_tab.h: -------------------------------------------------------------------------------- 1 | #ifndef CHILD_TAB_99D389BCE8FA48AB83690534B479BCC6_H 2 | #define CHILD_TAB_99D389BCE8FA48AB83690534B479BCC6_H 3 | 4 | #include 5 | 6 | namespace evo::gui 7 | { 8 | class child_tab : public tab 9 | { 10 | public: 11 | child_tab(control_id id, const std::string &t, uint64_t l, const std::shared_ptr &i = {}) : 12 | tab(id, t, l, i) 13 | { 14 | using namespace ren; 15 | 16 | size.y = 28.f; 17 | margin = {0.f, 2.f, 0.f, 2.f}; 18 | 19 | an = std::make_shared(colors.text_dark, 0.15f); 20 | of = std::make_shared(0.f, 0.15f, ease_out); 21 | 22 | type = ctrl_child_tab; 23 | 24 | is_breadcrumb = true; 25 | breadcrumb_name = t; 26 | } 27 | 28 | void on_first_render_call() override; 29 | 30 | void on_mouse_enter() override; 31 | void on_mouse_leave() override; 32 | 33 | void select() override; 34 | void unselect() override; 35 | 36 | void render() override; 37 | 38 | std::shared_ptr make_vertical() 39 | { 40 | is_horizontal = false; 41 | size_to_parent_w = true; 42 | return as(); 43 | } 44 | 45 | bool is_horizontal{true}; 46 | 47 | private: 48 | std::shared_ptr an; 49 | std::shared_ptr of; 50 | }; 51 | } 52 | 53 | #endif //CHILD_TAB_99D389BCE8FA48AB83690534B479BCC6_H 54 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/color_picker.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | GUI_NAMESPACE; 6 | 7 | void color_picker::render() 8 | { 9 | control::render(); 10 | 11 | const auto r = area_abs(); 12 | 13 | auto &d = draw.layers[ctx->content_layer]; 14 | d->g.anti_alias = true; 15 | d->add_rect_filled_rounded(r, *value, 2.f); 16 | d->g.anti_alias = {}; 17 | } 18 | 19 | void color_picker::on_mouse_down(char key) 20 | { 21 | if (key == m_left) 22 | { 23 | const auto picker_popup = std::make_shared(control_id{id + 1}, shared_from_this()->as()); 24 | picker_popup->open(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/color_picker.h: -------------------------------------------------------------------------------- 1 | #ifndef COLOR_PICKER_FC7A748F3EEE4C20945E339F7E805589_H 2 | #define COLOR_PICKER_FC7A748F3EEE4C20945E339F7E805589_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace evo::gui 10 | { 11 | class color_picker : public control 12 | { 13 | public: 14 | color_picker(control_id id, value_param &v, bool alpha = true, const ren::vec2 &p = {}, bool left = false) : 15 | control(id, p, {24.f, 8.f}), allow_alpha(alpha), prefer_left(left), value(v) 16 | { 17 | margin = {2.f, 8.f, 2.f, 8.f}; 18 | type = ctrl_color_picker; 19 | } 20 | 21 | void on_mouse_down(char key) override; 22 | void render() override; 23 | 24 | bool allow_alpha{true}; 25 | bool prefer_left{}; 26 | value_param &value; 27 | 28 | std::function callback{}; 29 | }; 30 | } 31 | 32 | #endif //COLOR_PICKER_FC7A748F3EEE4C20945E339F7E805589_H 33 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/combo_box.h: -------------------------------------------------------------------------------- 1 | #ifndef COMBO_BOX_56F5835CBD604AAB9749A2702E6893AF_H 2 | #define COMBO_BOX_56F5835CBD604AAB9749A2702E6893AF_H 3 | 4 | #include 5 | #include 6 | 7 | namespace evo::gui 8 | { 9 | class combo_box : public control_container 10 | { 11 | public: 12 | combo_box(control_id id, value_param &v, const ren::vec2 &p = {}, const ren::vec2 &s = {100.f, 20.f}) : 13 | control_container(id, p, s), value(v) 14 | { 15 | should_process_children = false; 16 | margin = {2.f, 2.f, 2.f, 2.f}; 17 | type = ctrl_combo_box; 18 | hotkey_type = hkt_combo; 19 | } 20 | 21 | void add(const std::shared_ptr &c) override 22 | { 23 | control_container::add(c); 24 | if (!allow_multiple && !legacy_mode && !value.get().first_set_bit()) 25 | value.get().set(0); 26 | } 27 | 28 | void add(const std::vector> &els) 29 | { 30 | for (const auto &e : els) 31 | add(e); 32 | } 33 | 34 | void preserve_hotkey_state() override; 35 | void restore_hotkey_state() override; 36 | 37 | void on_mouse_down(char key) override; 38 | 39 | void reset() override; 40 | void render() override; 41 | 42 | void update_hotkey_table() override; 43 | void update_hotkey_value(hotkey_update upd, hotkey_info v) override; 44 | 45 | value_param &value; 46 | bool allow_multiple{}; 47 | std::function callback{}; 48 | bool legacy_mode{}; 49 | 50 | private: 51 | bits old_value{}; 52 | bool handling_hotkey{}; 53 | }; 54 | } 55 | 56 | #endif //COMBO_BOX_56F5835CBD604AAB9749A2702E6893AF_H 57 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/combo_box_agent.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | GUI_NAMESPACE; 6 | 7 | void combo_box_agent::on_mouse_down(char key) 8 | { 9 | if (key == m_left) 10 | { 11 | const auto combo_popup = std::make_shared(id + 1, shared_from_this()->as(), custom_size); 12 | combo_popup->open(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/combo_box_agent.h: -------------------------------------------------------------------------------- 1 | #ifndef COMBO_BOX_AGENT_H 2 | #define COMBO_BOX_AGENT_H 3 | 4 | #include 5 | 6 | namespace evo::gui 7 | { 8 | class combo_box_agent : public combo_box 9 | { 10 | public: 11 | combo_box_agent(const control_id &id, value_param &v, const ren::vec2 &cs = {160.f, 100.f}, const ren::vec2 &p = {}, const ren::vec2 &s = {100.f, 20.f}) : 12 | combo_box(id, v, p, s), custom_size(cs) { } 13 | 14 | void on_mouse_down(char key) override; 15 | 16 | private: 17 | ren::vec2 custom_size; 18 | }; 19 | } 20 | 21 | #endif //COMBO_BOX_AGENT_H 22 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/control_container.h: -------------------------------------------------------------------------------- 1 | #ifndef GUI_TESTER_CONTROL_CONTAINER_H 2 | #define GUI_TESTER_CONTROL_CONTAINER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace evo::gui 9 | { 10 | class control_container : public control, public container 11 | { 12 | public: 13 | control_container(control_id id) : 14 | control(id) 15 | { 16 | is_container = true; 17 | margin = ren::rect(); 18 | type = ctrl_control_container; 19 | } 20 | 21 | control_container(control_id _id, const ren::vec2 &_pos, const ren::vec2 &_size) : 22 | control(_id, _pos, _size) 23 | { 24 | is_container = true; 25 | margin = ren::rect(); 26 | type = ctrl_control_container; 27 | } 28 | 29 | CALLBACK_TRAIT(container, on_control_added, (const std::shared_ptr& c))(c); 30 | CALLBACK_TRAIT(container, on_control_removed, ())(); 31 | 32 | // called when child received on_draw_param_changed 33 | virtual void on_control_draw_param_changed(std::shared_ptr c, char w) { } 34 | 35 | void add(const std::shared_ptr &c) override; 36 | void remove(const std::shared_ptr &c) override; 37 | void remove(uint64_t id) override; 38 | 39 | CALLBACK_TRAIT(container, remove_all, ())(); 40 | 41 | void refresh() override; 42 | void render() override; 43 | void reset() override; 44 | 45 | CALLBACK_TRAIT_FRC(control); 46 | CALLBACK_TRAIT_MM(control); 47 | CALLBACK_TRAIT_ME(control); 48 | CALLBACK_TRAIT_ML(control); 49 | CALLBACK_TRAIT_MD(control); 50 | CALLBACK_TRAIT_MU(control); 51 | CALLBACK_TRAIT_MW(control); 52 | CALLBACK_TRAIT_KD(control); 53 | CALLBACK_TRAIT_KU(control); 54 | CALLBACK_TRAIT_TI(control); 55 | CALLBACK_TRAIT_DPC(control); 56 | 57 | // calculates max Y 58 | float calc_max_y(); 59 | 60 | // copies out elements to that container 61 | void copy(const std::shared_ptr &c); 62 | 63 | // runs on_first_render_call 64 | void raise_first_render_call(); 65 | 66 | // processes add and remove queues/schedules 67 | void process_queues(); 68 | 69 | ren::rect custom_margin{}; // margin to add to children controls 70 | bool should_process_children{true}; // determines if this container should render it's children 71 | }; 72 | } 73 | 74 | #endif //GUI_TESTER_CONTROL_CONTAINER_H 75 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/group.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | GUI_NAMESPACE; 6 | 7 | void group::render() 8 | { 9 | control::render(); 10 | if (!is_visible) 11 | return; 12 | 13 | const auto r = area_abs(); 14 | 15 | auto &d = draw.layers[ctx->content_layer]; 16 | d->add_rect_filled_rounded(r, colors.bg_block, 4.f); 17 | 18 | for_each_control( 19 | [](std::shared_ptr &c) 20 | { 21 | c->render(); 22 | }); 23 | 24 | d->g.anti_alias = true; 25 | d->add_rect_rounded(r, colors.outline, 4.f); 26 | 27 | const auto fnt = draw.fonts[GUI_HASH("gui_main")]; 28 | const auto txt = fnt->get_text_size(text); 29 | const auto text_area = rect(8.f, -(txt.y * 0.5f)).size(txt + vec2{10.f, 0.f}).translate(r.tl()); 30 | 31 | d->add_rect_filled(text_area.margin_top(txt.y * 0.5f - 1.f).height(2.f), colors.bg_bottom); 32 | d->font = fnt; 33 | d->add_text(text_area.center() + vec2{0.f, 2.f}, text, colors.text, text_params::with_vh(align_center, align_center)); 34 | d->g.anti_alias = false; 35 | } 36 | 37 | void group::add(const std::shared_ptr &c) 38 | { 39 | if (controls.empty()) 40 | control_container::add(c); 41 | else 42 | { 43 | auto f = controls.front(); 44 | if (f->is_container) 45 | f->as()->add(c); 46 | } 47 | } 48 | 49 | void group::remove(uint64_t id) 50 | { 51 | if (!controls.empty()) 52 | { 53 | auto f = controls.front(); 54 | if (f->is_container) 55 | f->as()->remove(id); 56 | } 57 | } 58 | 59 | void group::remove(const std::shared_ptr &c) 60 | { 61 | if (!controls.empty()) 62 | { 63 | auto f = controls.front(); 64 | if (f->is_container) 65 | f->as()->remove(c); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/group.h: -------------------------------------------------------------------------------- 1 | #ifndef GUI_TESTER_GROUP_H 2 | #define GUI_TESTER_GROUP_H 3 | 4 | #include 5 | #include 6 | 7 | namespace evo::gui 8 | { 9 | class group : public control_container 10 | { 11 | public: 12 | group(control_id id, const std::string &t, const ren::vec2 &p, const ren::vec2 &s) : 13 | control_container(id, p, s), text(t) 14 | { 15 | type = ctrl_group; 16 | 17 | is_breadcrumb = true; 18 | breadcrumb_name = t; 19 | } 20 | 21 | void add(const std::shared_ptr &c) override; 22 | void remove(uint64_t id) override; 23 | void remove(const std::shared_ptr &c) override; 24 | 25 | void render() override; 26 | 27 | std::string text{}; 28 | std::string warning{}; 29 | }; 30 | } 31 | 32 | #endif //GUI_TESTER_GROUP_H 33 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/hotkey.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | GUI_NAMESPACE; 5 | 6 | void hotkey::render() 7 | { 8 | control::render(); 9 | if (!is_visible) 10 | return; 11 | 12 | an->animate(); 13 | 14 | const auto r = area_abs(); 15 | const auto txt = r.shrink(4.f).margin_bottom(3.f); 16 | 17 | auto &d = draw.layers[ctx->content_layer]; 18 | d->g.anti_alias = true; 19 | d->add_rect_filled_rounded(r, colors.bg_bottom, 4.f); 20 | d->add_rect_filled_rounded(txt, colors.bg_block_light, 2.f); 21 | d->add_rect_filled_multicolor( 22 | txt.margin_left(2.f).width(txt.width() * .5f - 2.f), {colors.bg_block_light, colors.bg_block.mod_a(.5f), colors.bg_block.mod_a(.5f), colors.bg_block_light,}); 23 | d->add_rect_filled_multicolor( 24 | txt.margin_left(txt.width() * .5f).width(txt.width() * .5f - 2.f), 25 | {colors.bg_block.mod_a(.5f), colors.bg_block_light, colors.bg_block_light, colors.bg_block.mod_a(.5f),}); 26 | 27 | d->add_rect_rounded(r, colors.accent.mod_a(an->value), 4.f); 28 | d->g.anti_alias = false; 29 | 30 | if (ctx->res.icons.keys.contains(*value)) 31 | { 32 | d->g.texture = ctx->res.icons.keys[*value]->obj; 33 | d->add_rect_filled(txt.shrink(4.f), colors.text); 34 | d->g.texture = {}; 35 | } 36 | else 37 | { 38 | auto hk_text = key_to_string_opt(*value).value_or(XOR("")); 39 | //if (*value >= VK_F10 && *value <= VK_F12) 40 | // hk_text = hk_text.substr(1); 41 | 42 | d->font = draw.fonts[GUI_HASH("gui_main")]; 43 | d->add_text(txt.center() + vec2{0.f, 2.f}, hk_text, colors.text, text_params::with_vh(align_center, align_center)); 44 | } 45 | } 46 | 47 | void hotkey::on_mouse_down(char key) 48 | { 49 | if (key == m_left && !is_input_locked()) 50 | { 51 | an->direct(1.f); 52 | lock_input(); 53 | } 54 | else if (is_locked_by_me()) 55 | { 56 | switch (key) 57 | { 58 | case m_left: 59 | *value = VK_LBUTTON; 60 | break; 61 | case m_right: 62 | *value = VK_RBUTTON; 63 | break; 64 | case m_middle: 65 | *value = VK_MBUTTON; 66 | break; 67 | case m_back: 68 | *value = VK_XBUTTON1; 69 | break; 70 | case m_forward: 71 | *value = VK_XBUTTON2; 72 | break; 73 | } 74 | 75 | if (callback) 76 | callback(*value); 77 | 78 | an->direct(0.f); 79 | tooltip = key_to_string(*value); 80 | unlock_input(); 81 | } 82 | } 83 | 84 | void hotkey::on_key_down(uint16_t key) 85 | { 86 | if (!is_locked_by_me()) 87 | return; 88 | 89 | *value = key == VK_ESCAPE ? 0 : key; 90 | if (callback) 91 | callback(*value); 92 | 93 | an->direct(0.f); 94 | tooltip = key_to_string(*value); 95 | unlock_input(); 96 | } 97 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/hotkey_view.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace evo::gui 5 | { 6 | using namespace evo::ren; 7 | 8 | void hotkey_view::render() 9 | { 10 | auto &d = draw.layers[ctx->content_layer]; 11 | d->font = draw.fonts[GUI_HASH("gui_main")]; 12 | 13 | const auto r = area_abs(); 14 | const auto text_area = r.width(r.width() * .5f - 5.f).translate(vec2{5.f, 0.f}); 15 | const auto text_size = d->font->get_text_size(name); 16 | 17 | const auto old_clip = d->g.clip_rect; 18 | if (text_area.width() > text_size.x) 19 | { 20 | is_cut = true; 21 | d->override_clip_rect(text_area); 22 | } 23 | else 24 | is_cut = false; 25 | 26 | d->add_text(text_area.tl() + vec2{0.f, 2.f}, name, colors.text); 27 | 28 | if (is_cut) 29 | { 30 | d->add_rect_filled_multicolor( 31 | text_area.translate(vec2{text_area.width() - 20.f, 0.f}).width(20.f), 32 | {colors.bg_block.mod_a(0.f), colors.bg_block, colors.bg_block, colors.bg_block.mod_a(0.f)}); 33 | 34 | d->g.clip_rect = old_clip; 35 | } 36 | 37 | d->add_text(text_area.tr() + vec2{0.f, 2.f}, beh == hkb_hold ? XOR("Hold") : XOR("Toggle"), colors.text_dark); 38 | 39 | const auto key_size = d->font->get_text_size(key); 40 | const auto key_rect = rect(r.tr()).size(key_size + vec2{8.f, 4.f}).translate(vec2{key_size.x + 4.f, 2.f} * -1.f); 41 | 42 | d->g.anti_alias = true; 43 | d->add_rect_filled_rounded(key_rect, colors.bg_bottom, 3.f); 44 | d->g.anti_alias = false; 45 | 46 | d->add_text(key_rect.tr() + vec2{4.f, 2.f}, key, colors.text); 47 | } 48 | 49 | void hotkey_view::on_mouse_move(const ren::vec2 &p, const ren::vec2 &d) 50 | { 51 | if (!is_cut) 52 | return; 53 | 54 | const auto text_area = area_abs().width(area_abs().width() * .5f - 5.f).translate(vec2{5.f, 0.f}); 55 | tooltip = text_area.contains(p) ? name : std::string{}; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/hotkey_view.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace evo::gui 7 | { 8 | class hotkey_view : public control 9 | { 10 | public: 11 | hotkey_view(control_id _id, const std::string &name, hotkey_behavior beh, uint8_t k) : 12 | control(_id, {}, {0.f, 24.f}), name(name), beh(beh) 13 | { 14 | size_to_parent_w = true; 15 | key = key_to_string((uint16_t)k); 16 | } 17 | 18 | void render() override; 19 | void on_mouse_move(const ren::vec2 &p, const ren::vec2 &d) override; 20 | 21 | private: 22 | std::string name, key; 23 | hotkey_behavior beh{}; 24 | bool is_cut{}; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/hsv_slider.h: -------------------------------------------------------------------------------- 1 | #ifndef HSV_SLIDER_039C5B4FBA7B4A4BB0525D5398DD0BD4_H 2 | #define HSV_SLIDER_039C5B4FBA7B4A4BB0525D5398DD0BD4_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace evo::gui 10 | { 11 | class hsv_slider : public control 12 | { 13 | enum : char 14 | { 15 | e_none, 16 | e_sb, 17 | e_hue, 18 | e_alpha 19 | }; 20 | 21 | public: 22 | hsv_slider(control_id id, value_param &c, bool alpha = true) : 23 | control(id, {}, {200.f, alpha ? 200.f : 160.f}), value(c), allow_alpha(alpha) 24 | { 25 | fake_hue = c->h(); 26 | fake_saturation = c->s(); 27 | fake_brightness = c->v(); 28 | type = ctrl_hsv_slider; 29 | } 30 | 31 | void on_mouse_down(char key) override; 32 | void on_mouse_move(const ren::vec2 &p, const ren::vec2 &d) override; 33 | void on_mouse_up(char key) override; 34 | void reset() override; 35 | void render() override; 36 | 37 | value_param &value; 38 | bool allow_alpha{true}; 39 | std::function callback{}; 40 | 41 | private: 42 | ren::rect get_sb_rect(); 43 | ren::rect get_hue_rect(); 44 | ren::rect get_alpha_rect(); 45 | 46 | char current_edit{}; 47 | 48 | uint16_t fake_hue{}; 49 | float fake_saturation{}; 50 | float fake_brightness{}; 51 | }; 52 | } 53 | 54 | #endif //HSV_SLIDER_039C5B4FBA7B4A4BB0525D5398DD0BD4_H 55 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/image.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace evo::gui 7 | { 8 | class image : public control 9 | { 10 | public: 11 | image(control_id _id, void *ri, ren::vec2 sz) : 12 | control(_id, {}, sz), raw_img(ri) 13 | { 14 | disable_id_display = true; 15 | } 16 | 17 | image(control_id _id, const std::shared_ptr &i) : 18 | control(_id, {}, i->get_size()), raw_img(nullptr), img(i) 19 | { 20 | disable_id_display = true; 21 | } 22 | 23 | void render() override 24 | { 25 | control::render(); 26 | if (!is_visible) 27 | return; 28 | 29 | auto &d = ren::draw.layers[ctx->content_layer]; 30 | d->g.texture = raw_img ? raw_img : img->obj; 31 | d->add_rect_filled(area_abs(), ren::color::white()); 32 | d->g.texture = {}; 33 | 34 | if (rnd) 35 | rnd(shared_from_this()); 36 | } 37 | 38 | void *raw_img; 39 | std::function &)> rnd; 40 | std::shared_ptr img; 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/label.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | GUI_NAMESPACE; 5 | 6 | void label::on_draw_param_changed(char w) 7 | { 8 | control::on_draw_param_changed(w); 9 | if (w == dp_text) 10 | size = fnt->get_text_size(text); 11 | } 12 | 13 | void label::on_first_render_call() 14 | { 15 | // retry, bitch! 16 | fnt = draw.fonts[bold ? GUI_HASH("gui_bold") : GUI_HASH("gui_main")]; 17 | size = {fnt->get_text_size(text).x, 10.f}; 18 | } 19 | 20 | void label::on_mouse_down(char key) 21 | { 22 | // meme thing: let's see if there's a checkbox nearby... 23 | const auto par = get_parent(); 24 | if (!par) 25 | return; 26 | 27 | par->as()->for_each_control_logical( 28 | [&](auto f) 29 | { 30 | if (f->type == ctrl_checkbox) 31 | { 32 | // don't do this shit :) 33 | f->on_mouse_down(key); 34 | f->is_caring_about_hover = f->is_caring_about_parent = true; 35 | ctx->active = nullptr; 36 | lock_input(); 37 | return true; 38 | } 39 | 40 | return false; 41 | }); 42 | } 43 | 44 | void label::on_mouse_up(char key) 45 | { 46 | // do the same meme here again! but only if it's locked 47 | const auto par = get_parent(); 48 | if (!is_locked_by_me() || !par) 49 | return; 50 | 51 | unlock_input(); 52 | } 53 | 54 | void label::on_mouse_enter() 55 | { 56 | const auto par = get_parent(); 57 | if (!par) 58 | return; 59 | 60 | par->as()->for_each_control_logical( 61 | [&](auto f) 62 | { 63 | if (f->type == ctrl_checkbox) 64 | { 65 | f->on_mouse_enter(); 66 | return true; 67 | } 68 | 69 | return false; 70 | }); 71 | } 72 | 73 | void label::on_mouse_leave() 74 | { 75 | const auto par = get_parent(); 76 | if (!par) 77 | return; 78 | 79 | par->as()->for_each_control_logical( 80 | [&](auto f) 81 | { 82 | if (f->type == ctrl_checkbox) 83 | { 84 | f->on_mouse_leave(); 85 | return true; 86 | } 87 | 88 | return false; 89 | }); 90 | } 91 | 92 | void label::render() 93 | { 94 | control::render(); 95 | if (!is_visible) 96 | return; 97 | 98 | auto &d = draw.layers[ctx->content_layer]; 99 | 100 | vec2 offset{}; 101 | if (is_new) 102 | { 103 | d->g.anti_alias = true; 104 | d->add_circle_filled(pos_abs() + vec2{2.f, size.y / 2.f}, 2.f, colors.accent); 105 | d->g.anti_alias = false; 106 | offset.x += 8.f; 107 | } 108 | 109 | d->font = fnt; 110 | d->add_text(pos_abs() + offset, text, col); 111 | } 112 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/label.h: -------------------------------------------------------------------------------- 1 | #ifndef GUI_TESTER_LABEL_H 2 | #define GUI_TESTER_LABEL_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | namespace evo::gui 13 | { 14 | class label : public control 15 | { 16 | public: 17 | label(control_id id, const std::string &s, const ren::color &c = colors.text, bool b = false, const ren::vec2 &p = {}) : 18 | control(id, p, {}), text(s), col(c), bold(b) 19 | { 20 | using namespace ren; 21 | 22 | margin = {0.f, 0.f, 2.f, 0.f}; 23 | type = ctrl_label; 24 | } 25 | 26 | void on_first_render_call() override; 27 | void on_draw_param_changed(char w) override; 28 | void on_mouse_down(char key) override; 29 | void on_mouse_up(char key) override; 30 | void on_mouse_enter() override; 31 | void on_mouse_leave() override; 32 | void render() override; 33 | 34 | void set_text(const std::string &t) 35 | { 36 | text = t; 37 | process_draw_param_changes(dp_text); 38 | } 39 | 40 | std::string text{}; 41 | ren::color col{}; 42 | bool bold{}; 43 | bool is_new{}; 44 | 45 | private: 46 | std::shared_ptr fnt{}; 47 | }; 48 | } 49 | 50 | #endif //GUI_TESTER_LABEL_H 51 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/list.h: -------------------------------------------------------------------------------- 1 | #ifndef LIST_A5E28B10D3264122ACDBE50BFAADD3F5_H 2 | #define LIST_A5E28B10D3264122ACDBE50BFAADD3F5_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace evo::gui 9 | { 10 | class list : public layout 11 | { 12 | public: 13 | list(control_id id, value_param &v, const ren::vec2 &p, const ren::vec2 &s) : 14 | layout(id, p, s, s_vertical), value(v) 15 | { 16 | stack_offset = {}; 17 | 18 | using namespace ren; 19 | 20 | spinner_anim = std::make_shared(0.f, 0.7f); 21 | spinner_anim->on_finished = [](std::shared_ptr> f) 22 | { 23 | f->direct(0.f, 360.f); 24 | }; 25 | 26 | spinner_anim->direct(0.f, 360.f); 27 | 28 | type = ctrl_list; 29 | } 30 | 31 | void on_control_added(const std::shared_ptr &c) override; 32 | 33 | void reset() override; 34 | void soft_reset() override; 35 | void render() override; 36 | 37 | void filter_items(const std::string &str); 38 | void update_selected(std::shared_ptr c); 39 | 40 | value_param &value; 41 | bool allow_multiple{}; 42 | bool legacy_mode{}; // set value instead of bit if allow_multiple is false 43 | bool show_spinner{}; 44 | std::function callback{}; 45 | 46 | private: 47 | std::shared_ptr spinner_anim{}; 48 | }; 49 | } 50 | 51 | #endif //LIST_A5E28B10D3264122ACDBE50BFAADD3F5_H 52 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/loading.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | GUI_NAMESPACE; 5 | 6 | void loading::render() 7 | { 8 | control::render(); 9 | if (!is_visible) 10 | return; 11 | 12 | auto &d = draw.layers[ctx->content_layer]; 13 | d->g.rotation = a->value; 14 | d->g.texture = ctx->res.general.loader->obj; 15 | d->g.anti_alias = true; 16 | d->add_rect_filled(area_abs(), color::white()); 17 | d->g.texture = {}; 18 | d->g.anti_alias = {}; 19 | d->g.rotation = {}; 20 | } 21 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/loading.h: -------------------------------------------------------------------------------- 1 | #ifndef LOADING_65BFEF982D7840ECB1E8CF7850DEA6F6_H 2 | #define LOADING_65BFEF982D7840ECB1E8CF7850DEA6F6_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace evo::gui 9 | { 10 | class loading : public control 11 | { 12 | public: 13 | loading(control_id id, const ren::vec2 &p = {}) : 14 | control(id, p, {16.f, 16.f}) 15 | { 16 | using namespace ren; 17 | 18 | a = std::make_shared(0.f, 0.7f); 19 | a->on_finished = [](std::shared_ptr> f) 20 | { 21 | f->direct(0.f, 360.f); 22 | }; 23 | a->direct(0, 360.f); 24 | 25 | type = ctrl_loading; 26 | } 27 | 28 | void render() override; 29 | 30 | private: 31 | std::shared_ptr a; 32 | }; 33 | } 34 | 35 | #endif //LOADING_65BFEF982D7840ECB1E8CF7850DEA6F6_H 36 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/notification_control.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | GUI_NAMESPACE; 5 | 6 | void evo::gui::notification_control::render() 7 | { 8 | control::render(); 9 | if (!is_visible) 10 | return; 11 | 12 | const auto r = area_abs(); 13 | 14 | auto &d = draw.layers[ctx->content_layer]; 15 | d->add_rect_filled(r, is_odd ? colors.bg_odd : colors.bg_even); 16 | d->font = draw.fonts[GUI_HASH("gui_bold")]; 17 | d->add_text(r.tl() + vec2{5.f, 5.f}, obj->header, colors.text_light); 18 | d->font = draw.fonts[GUI_HASH("gui_main")]; 19 | d->add_text(r.tl() + vec2{5.f, 22.f}, obj->text, colors.text); 20 | } 21 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/notification_control.h: -------------------------------------------------------------------------------- 1 | #ifndef NOTIFICATION_CONTROL_99B876ACDB0544CC961D9A0A347F5F54_H 2 | #define NOTIFICATION_CONTROL_99B876ACDB0544CC961D9A0A347F5F54_H 3 | 4 | #include 5 | #include 6 | 7 | namespace evo::gui 8 | { 9 | class notification_control : public control 10 | { 11 | public: 12 | notification_control(control_id id, bool is_odd, const std::shared_ptr &n) : 13 | control(id, {}, {0.f, 46.f}), is_odd(is_odd), obj(n) 14 | { 15 | size_to_parent_w = true; 16 | type = ctrl_notification_control; 17 | } 18 | 19 | void render() override; 20 | 21 | bool is_odd{}; 22 | std::shared_ptr obj{}; 23 | }; 24 | } 25 | 26 | #endif //NOTIFICATION_CONTROL_99B876ACDB0544CC961D9A0A347F5F54_H 27 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/popup.h: -------------------------------------------------------------------------------- 1 | #ifndef POPUP_694B3C5E6CFA46D0A1962EED742859C1_H 2 | #define POPUP_694B3C5E6CFA46D0A1962EED742859C1_H 3 | 4 | #include 5 | #include 6 | 7 | namespace evo::gui 8 | { 9 | enum popup_type 10 | { 11 | pt_none, 12 | pt_hotkey_popup 13 | }; 14 | 15 | class popup : public control_container 16 | { 17 | public: 18 | popup(control_id id, const ren::vec2 &p, const ren::vec2 &s, bool is_action = false) : 19 | control_container(id, p, s) 20 | { 21 | is_window = true; 22 | is_action_popup = is_action; 23 | priority = ip_popup; 24 | 25 | create(); 26 | type = ctrl_popup; 27 | } 28 | 29 | CALLBACK_TRAIT_RESET(control_container); 30 | CALLBACK_TRAIT_FRC(control_container); 31 | CALLBACK_TRAIT_ME(control_container); 32 | CALLBACK_TRAIT_ML(control_container); 33 | CALLBACK_TRAIT_MW(control_container); 34 | CALLBACK_TRAIT_KD(control_container); 35 | CALLBACK_TRAIT_KU(control_container); 36 | CALLBACK_TRAIT_TI(control_container); 37 | CALLBACK_TRAIT_DPC(control_container); 38 | 39 | void add(const std::shared_ptr &c) override; 40 | 41 | void on_mouse_move(const ren::vec2 &p, const ren::vec2 &d) override; 42 | void on_mouse_down(char key) override; 43 | void on_mouse_up(char key) override; 44 | 45 | void open(); 46 | void close(); 47 | 48 | void begin_render(); 49 | void render() override; 50 | void end_render(); 51 | 52 | bool allow_move{false}; 53 | popup_type p_type{pt_none}; 54 | 55 | private: 56 | std::shared_ptr a; 57 | void create(); 58 | }; 59 | } 60 | 61 | #endif //POPUP_694B3C5E6CFA46D0A1962EED742859C1_H 62 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/public_software_item.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace evo::gui; 7 | using namespace evo::ren; 8 | using namespace gui; 9 | 10 | void public_software_item::init() 11 | { 12 | an = std::make_shared(colors.text, 0.15f); 13 | } 14 | 15 | void public_software_item::render() 16 | { 17 | const auto r = area_abs(); 18 | 19 | DEC(name_str, name); 20 | DEC(license_str, license); 21 | 22 | auto &d = draw.layers[ctx->content_layer]; 23 | d->font = draw.fonts[GUI_HASH("gui_bold")]; 24 | d->add_text(r.tl() + vec2{16.f, 8.f}, name_str, an->value); 25 | d->font = draw.fonts[GUI_HASH("gui_main")]; 26 | d->add_text(r.tl() + vec2{16.f, 23.f}, license_str, colors.text_mid); 27 | } 28 | 29 | void public_software_item::on_mouse_enter() 30 | { 31 | an->direct(colors.accent); 32 | } 33 | 34 | void public_software_item::on_mouse_leave() 35 | { 36 | an->direct(colors.text); 37 | } 38 | 39 | void public_software_item::on_mouse_down(char key) 40 | { 41 | ctx->do_tick_sound(); 42 | if (key == m_left) 43 | std::thread( 44 | [&] 45 | { 46 | DEC(url_str, url); 47 | ShellExecuteA(nullptr, nullptr, url_str.c_str(), nullptr, nullptr, SW_SHOWNORMAL); 48 | }).detach(); 49 | } 50 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/public_software_item.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace gui 6 | { 7 | class public_software_item : public evo::gui::control 8 | { 9 | public: 10 | public_software_item(evo::gui::control_id id, const std::string &name, const std::string &license, const std::string &url) : 11 | evo::gui::control(id, {}, {0.f, 40.f}), name(name), license(license), url(url) 12 | { 13 | size_to_parent_w = true; 14 | init(); 15 | } 16 | 17 | void on_mouse_down(char key) override; 18 | void on_mouse_enter() override; 19 | void on_mouse_leave() override; 20 | 21 | void render() override; 22 | 23 | private: 24 | std::shared_ptr an; 25 | void init(); 26 | 27 | std::string name{}; 28 | std::string license{}; 29 | std::string url{}; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/search_result.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace evo; 5 | 6 | namespace evo::gui 7 | { 8 | using namespace ren; 9 | 10 | void search_result::on_mouse_down(char key) 11 | { 12 | if (key != m_left) 13 | return; 14 | 15 | if (const auto c = ctrl.lock(); c) 16 | c->highlight(); 17 | if (const auto w = wnd.lock(); w) 18 | w->as()->close(); 19 | } 20 | 21 | void search_result::render() 22 | { 23 | if (!is_visible) 24 | return; 25 | 26 | control::render(); 27 | 28 | const auto r = area_abs(); 29 | auto &d = draw.layers[ctx->content_layer]; 30 | d->font = draw.fonts[GUI_HASH("gui_main")]; 31 | 32 | if (is_mouse_on_me) 33 | d->add_rect_filled(r.shrink(1.f), colors.bg_block_light); 34 | 35 | const auto c = ctrl.lock(); 36 | if (!c) 37 | { 38 | d->add_text(r.tl() + vec2{4.f, r.center().y + 3.f}, XOR("Invalid control"), colors.text, text_params::with_v(align_center)); 39 | return; 40 | } 41 | 42 | std::string breadcrumbs; 43 | for (const auto &b : c->get_breadcrumbs()) 44 | breadcrumbs += XOR(" > ") + b; 45 | 46 | if (!breadcrumbs.empty()) 47 | breadcrumbs = breadcrumbs.substr(3); 48 | 49 | if (breadcrumbs.empty()) 50 | { 51 | // hax)) 52 | if (c->parent.lock()->id == GUI_HASH("wnd_main_toolbar")) 53 | breadcrumbs = XOR("TOOLBAR"); 54 | } 55 | 56 | const auto clip = d->g.clip_rect; 57 | d->override_clip_rect(r.padding_right(10.f)); 58 | d->add_text(r.tl() + vec2{8.f, 7.f}, text, colors.text); 59 | d->add_text(r.tl() + vec2{8.f, 23.f}, breadcrumbs, colors.text_mid); 60 | d->g.clip_rect = clip; 61 | 62 | // anti-shitface 63 | const auto col = is_mouse_on_me ? colors.bg_block_light : colors.bg_block; 64 | d->add_rect_filled_multicolor(rect(r.tr()).height(r.height()).width(20.f).margin_right(30.f), {col.mod_a(0.f), col, col, col.mod_a(0.f)}); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/search_result.h: -------------------------------------------------------------------------------- 1 | #ifndef SEARCH_RESULT_F48F91493F2D4D9F870AB2486B8494F5_H 2 | #define SEARCH_RESULT_F48F91493F2D4D9F870AB2486B8494F5_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace evo::gui 9 | { 10 | class search_result : public control 11 | { 12 | public: 13 | search_result(control_id id, std::string text, std::weak_ptr ctrl) : 14 | control(id, {}, {0.f, 40.f}), text(std::move(text)), ctrl(std::move(ctrl)) 15 | { 16 | size_to_parent_w = true; 17 | } 18 | 19 | void on_mouse_down(char key) override; 20 | void render() override; 21 | 22 | std::string text; 23 | std::weak_ptr ctrl; 24 | std::weak_ptr wnd; 25 | }; 26 | } 27 | 28 | #endif //SEARCH_RESULT_F48F91493F2D4D9F870AB2486B8494F5_H 29 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/selectable.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | GUI_NAMESPACE; 4 | 5 | void selectable::on_mouse_enter() 6 | { 7 | if (is_selected) 8 | return; 9 | 10 | using namespace ren; 11 | a->direct(u_fc(0.f, custom_color.value_or(colors.text_light))); 12 | } 13 | 14 | void selectable::on_mouse_leave() 15 | { 16 | if (is_selected) 17 | return; 18 | 19 | using namespace ren; 20 | a->direct(u_fc(0.f, custom_color.value_or(colors.text_mid))); 21 | } 22 | 23 | void selectable::on_mouse_down(char key) 24 | { 25 | const auto p = get_parent()->as(); 26 | if (!p || (is_selected && !p->allow_multiple) || key != m_left) 27 | return; 28 | 29 | ctx->do_tick_sound(); 30 | p->update_selected(shared_from_this()); 31 | lock_input(); 32 | } 33 | 34 | void selectable::on_mouse_up(char key) 35 | { 36 | unlock_input(); 37 | } 38 | 39 | void selectable::render() 40 | { 41 | control::render(); 42 | if (!is_visible) 43 | return; 44 | 45 | a->animate(); 46 | 47 | const auto r = area_abs(); 48 | 49 | auto &l = draw.layers[ctx->content_layer]; 50 | 51 | vec2 off{}; 52 | if (is_loaded) 53 | { 54 | l->g.anti_alias = true; 55 | l->add_circle_filled(r.tl() + vec2{7.f, r.height() * .5f + 1.f}, 2.f, colors.accent); 56 | l->g.anti_alias = false; 57 | 58 | off.x += 10.f; 59 | } 60 | 61 | if (is_selected && custom_color) 62 | off.x += 5.f; 63 | 64 | l->font = is_highlighted || (is_selected && custom_color) ? draw.fonts[GUI_HASH("gui_bold")] : draw.fonts[GUI_HASH("gui_main")]; 65 | l->add_text(r.tl() + vec2(4.f, 4.f) + off, text, a->value.c); 66 | } 67 | 68 | void selectable::select() 69 | { 70 | is_selected = true; 71 | a->direct(u_fc(4.f, custom_color.value_or(colors.accent))); 72 | } 73 | 74 | void selectable::unselect() 75 | { 76 | is_selected = false; 77 | a->direct(u_fc(0.f, custom_color.value_or(is_mouse_on_me ? colors.text_light : colors.text_mid))); 78 | } 79 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/selectable.h: -------------------------------------------------------------------------------- 1 | #ifndef SELECTABLE_C1197FF3B70541469983142C442F8E53_H 2 | #define SELECTABLE_C1197FF3B70541469983142C442F8E53_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace evo::gui 11 | { 12 | class selectable : public control 13 | { 14 | public: 15 | selectable(control_id _id, const std::string &t, char v = -1, const ren::vec2 &s = {0.f, 0.f}) : 16 | control(_id, {}, s), text(t), value(v) 17 | { 18 | init(t, std::nullopt, v, s); 19 | } 20 | 21 | selectable(control_id _id, const std::string &t, ren::color c, char v = -1, const ren::vec2 &s = {0.f, 0.f}) : 22 | control(_id, {}, s), text(t), value(v) 23 | { 24 | init(t, c, v, s); 25 | } 26 | 27 | void init(const std::string &t, std::optional c, char v = -1, const ren::vec2 &s = {0.f, 0.f}) 28 | { 29 | using namespace ren; 30 | 31 | if (size.y == 0.f) 32 | { 33 | size.y = 16.f; 34 | } 35 | 36 | margin.maxs.y = 2.f; 37 | size_to_parent_w = true; 38 | 39 | if (c == std::nullopt) 40 | a = std::make_shared(0.f, colors.text_mid, 0.15f); 41 | else 42 | { 43 | a = std::make_shared(0.f, c.value(), 0.15f); 44 | custom_color = c; 45 | } 46 | 47 | ctx->track_accent_anim(a); 48 | type = ctrl_selectable; 49 | } 50 | 51 | void on_mouse_enter() override; 52 | void on_mouse_leave() override; 53 | void on_mouse_down(char key) override; 54 | void on_mouse_up(char key) override; 55 | 56 | void render() override; 57 | 58 | void select(); 59 | void unselect(); 60 | 61 | std::string text{}; 62 | bool is_odd{}; 63 | bool is_highlighted{}; 64 | bool is_loaded{}; 65 | bool is_selected{}; 66 | int value{}; 67 | int order{}; 68 | std::optional custom_color{}; 69 | 70 | protected: 71 | std::shared_ptr a; 72 | }; 73 | } 74 | 75 | #endif //SELECTABLE_C1197FF3B70541469983142C442F8E53_H 76 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/selectable_game.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linwys/Fatality-Framework/67d119fd9893508f86fd61fa17f4609980776cf1/cs2_internal/src/gui/controls/selectable_game.cpp -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/selectable_inv.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace evo::gui 4 | { 5 | using namespace evo::ren; 6 | 7 | inline const color col_ct = color(69, 143, 255); 8 | inline const color col_t = color(255, 187, 69); 9 | 10 | void selectable_inv::render() 11 | { 12 | control::render(); 13 | if (!is_visible) 14 | return; 15 | 16 | a->animate(); 17 | 18 | const auto r = area_abs(); 19 | 20 | auto &d = draw.layers[ctx->content_layer]; 21 | d->g.anti_alias = true; 22 | d->add_circle_filled(r.tl() + vec2{7.f, r.height() * .5f}, 2.f, is_ct ? col_ct : colors.outline); 23 | d->add_circle_filled(r.tl() + vec2{17.f, r.height() * .5f}, 2.f, is_t ? col_t : colors.outline); 24 | d->g.anti_alias = false; 25 | 26 | d->font = draw.fonts[is_selected ? GUI_HASH("gui_bold") : GUI_HASH("gui_main")]; 27 | auto offset = vec2(27.f, 4.f); 28 | if (is_selected) 29 | offset.x += 5; 30 | d->add_text(r.tl() + offset, text, a->value.c); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/selectable_inv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace evo::gui 6 | { 7 | class selectable_inv : public selectable 8 | { 9 | public: 10 | selectable_inv(control_id id, const std::string &t, const ren::color &c, bool sct, bool st) : 11 | selectable(std::move(id), t, c), is_ct(sct), is_t(st) 12 | { 13 | if (sct || st) 14 | tooltip += XOR("Equipped: "); 15 | if (sct) 16 | tooltip += XOR("CT"); 17 | if (st) 18 | { 19 | if (sct) 20 | tooltip += XOR(", "); 21 | tooltip += XOR("T"); 22 | } 23 | } 24 | 25 | void render() override; 26 | 27 | bool is_ct{}, is_t{}; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/selectable_script.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //namespace evo::gui 4 | //{ 5 | // using namespace ren; 6 | // 7 | // void selectable_script::render() 8 | // { 9 | // control::render(); 10 | // if (!is_visible) 11 | // return; 12 | // 13 | // a->animate(); 14 | // 15 | // const auto r = area_abs(); 16 | // 17 | // auto &l = draw.layers[ctx->content_layer]; 18 | // 19 | // std::shared_ptr tex{}; 20 | // switch (file.type) 21 | // { 22 | // case lua::st_script: 23 | // tex = draw.textures[GUI_HASH("icon_file")]; 24 | // break; 25 | // case lua::st_remote: 26 | // tex = draw.textures[GUI_HASH("icon_cloud")]; 27 | // break; 28 | // default: 29 | // break; 30 | // } 31 | // 32 | // vec2 off{}; 33 | // if (is_loaded) 34 | // { 35 | // l->g.anti_alias = true; 36 | // l->add_circle_filled(r.tl() + vec2{7.f, r.height() * .5f + 3.f}, 2.f, colors.accent); 37 | // l->g.anti_alias = false; 38 | // 39 | // off.x += 10.f; 40 | // } 41 | // 42 | // if (tex) 43 | // { 44 | // l->g.texture = tex->obj; 45 | // l->add_rect_filled(rect(r.tl(), r.tl() + vec2{12.f, 12.f}).translate({off.x + 4.f, 5.f}), a->value.c); 46 | // l->g.texture = {}; 47 | // 48 | // off.x += 16.f; 49 | // } 50 | // 51 | // l->font = is_highlighted ? draw.fonts[GUI_HASH("gui_bold")] : draw.fonts[GUI_HASH("gui_main")]; 52 | // l->add_text(r.tl() + vec2(4.f, 6.f) + off, text, a->value.c); 53 | // } 54 | // 55 | //} 56 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/selectable_script.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | //#include "lua/engine.h" 6 | // 7 | //namespace evo::gui 8 | //{ 9 | // class selectable_script : public selectable 10 | // { 11 | // public: 12 | // selectable_script(control_id id, lua::script_file &f) : 13 | // selectable(std::move(id), f.get_name()), file(f) 14 | // { 15 | // if (f.metadata.description.has_value() || f.metadata.author.has_value()) 16 | // { 17 | // if (f.metadata.description.has_value()) 18 | // tooltip += *f.metadata.description + XOR("."); 19 | // if (f.metadata.author.has_value()) 20 | // { 21 | // if (!tooltip.empty()) 22 | // tooltip += XOR(" "); 23 | // 24 | // tooltip += XOR("Author: ") + *f.metadata.author; 25 | // } 26 | // } 27 | // } 28 | // 29 | // void render() override; 30 | // 31 | // lua::script_file &file; 32 | // }; 33 | //} 34 | -------------------------------------------------------------------------------- /cs2_internal/src/gui/controls/settings.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "gui/popups/settings_popup.h" 4 | #include 5 | 6 | GUI_NAMESPACE; 7 | 8 | void settings::on_first_render_call() 9 | { 10 | // context will be 100% initialized by this time, no issues will pop 11 | // however, this "breaks" it slightly as you need to pick the right time 12 | // to load the config, otherwise it will never process anything 13 | 14 | if (fn) 15 | fn(as()); 16 | 17 | process_queues(); 18 | 19 | const auto par = get_parent(); 20 | if (!par || par->as()->empty()) 21 | return; 22 | 23 | const auto pos_label = par->as()->at(0); 24 | if (pos_label->type != ctrl_label) 25 | return; 26 | 27 | breadcrumb_name = pos_label->as