├── .gitignore ├── 02.EnvironmentSetup ├── 01.Project_template_modules │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 02.Project_template_headers │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.cpp │ ├── utilities.h │ └── vcpkg.json ├── 03.Windows_setup.md ├── 04.Linux_setup.md ├── 05.Mac_setup.md ├── 06.Docker_setup.md ├── 07.Compiler_explorer_setup.md └── images │ ├── before_break_point.png │ ├── cmake_build.png │ ├── cmake_select_configure_presets.png │ ├── cmake_select_configure_presets_clang.png │ ├── code_lldb_launch.png │ ├── debug_window.png │ ├── line_14.png │ ├── play_button.png │ └── run_and_debug.png ├── 03.FirstSteps ├── 02.FirstCppProgramBasics │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 03.CppProgramExecutionModel │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 04.GUIChallenge │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 05.BuildingWithCMakeManually.md └── 06.BuildingWithCMakePresets.md ├── 04.VariablesAndDatatypesAndOperations ├── 01.Variables_data_types_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 02.Integer_modifiers_characters_text_auto_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 03.Operations_math_functions_weird_integers_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 04.Bitwise_operators_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 05.Bitwise_operator_examples_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json └── 06.Challenge_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 05.StreamsAndFormattingLiteralsConstants ├── 01.Input_output_streams_and_formatting_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 02.Format_library_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 03.Literals_and_constants_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json └── 04.Challenge │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 06.FlowControl ├── 01.If_switch_ternary_operator_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 02.Loops_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json └── 03.Challenge_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 07.Sequences ├── 01.Std_array_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 02.Std_vector_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 03.Std_string_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 04.Built_in_array_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 05.Random_numbers_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 06.Fortune_tellter_ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json └── 07.Challenge │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 08.Pointers_dynamic_memory_arrays ├── 01.Pointers │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── pointers_1.ixx │ ├── pointers_2.ixx │ ├── pointers_3.ixx │ ├── pointers_4.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 02.Dynamic_memory_allocation │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── dynamic_memory_allocation_1.ixx │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 03.SmartPointers │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── shared_pointers.ixx │ ├── unique_pointers.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 04.References │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 05.Challenge │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json └── 06.Challenge2 │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 09.Characters_and_strings ├── 01.Characters_and_strings │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── handling_c_strings.ixx │ ├── handling_characters.ixx │ ├── handling_std_strings.ixx │ ├── main.cpp │ ├── string_literals.ixx │ ├── string_views.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 02.Challenges │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── challenges.md │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json └── 03.Challenge_ftxui_palindrome │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 10.Functions ├── 01.Function_basics │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── compare.ixx │ ├── compare_impl.cpp │ ├── main.cpp │ ├── math.ixx │ ├── math_impl.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 02.Passing_parameters │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 03.Sequences_and_array_parameters │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 04.Constexpr_consteval_functions │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 05.Arguments_to_main │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 06.Function_overloading │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── overloading_1.ixx │ ├── overloading_2.ixx │ ├── overloading_4.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 07.Lambda_functions │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 08.Attributes_static_vars_recursion │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── attributes.ixx │ ├── main.cpp │ ├── recursion.ixx │ ├── static_vars.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 09.Challenge_1 │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json └── 10.Challenge_2 │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── arial.ttf │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 11.FileIO ├── 01.Reading_and_writing_files_text_binary │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── binary_files.ixx │ ├── main.cpp │ ├── text_files.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 02.Practice_csv_json │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── csv.ixx │ ├── json.ixx │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json └── 03.Challenge │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 12.Custom_types ├── 01.Custom_types_basics │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── ct1.ixx │ ├── ct10.ixx │ ├── ct11.ixx │ ├── ct12.ixx │ ├── ct13.ixx │ ├── ct14.ixx │ ├── ct15.ixx │ ├── ct16.ixx │ ├── ct17.ixx │ ├── ct2.ixx │ ├── ct3.ixx │ ├── ct4.cpp │ ├── ct4.ixx │ ├── ct5.ixx │ ├── ct6.ixx │ ├── ct7.ixx │ ├── ct8.ixx │ ├── ct9.ixx │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 02.Pixels_in_canvas │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── canvas.cpp │ ├── canvas.ixx │ ├── main.cpp │ ├── pixel.cpp │ ├── pixel.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 03.Move_semantics │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── canvas.cpp │ ├── canvas.ixx │ ├── main.cpp │ ├── move_semantics_01.ixx │ ├── move_semantics_02.ixx │ ├── move_semantics_03.ixx │ ├── pixel.cpp │ ├── pixel.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 04.Class_members │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── canvas.cpp │ ├── canvas.ixx │ ├── main.cpp │ ├── pixel.cpp │ ├── pixel.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 05.Constexpr_custom_types │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── main.cpp │ ├── time.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 06.Challenge_1 │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── game.cpp │ ├── game.ixx │ ├── main.cpp │ └── vcpkg.json ├── 07.Challenge_2 │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── game.cpp │ ├── game.h │ ├── main.cpp │ └── vcpkg.json └── 08.Challenge_3 │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── board.ixx │ ├── main.cpp │ ├── utilities.ixx │ └── vcpkg.json ├── 13.Project_tetris ├── 01.Tetromino │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── board.ixx │ ├── main.cpp │ ├── tetromino.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 02.Movement │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── board.ixx │ ├── main.cpp │ ├── tetromino.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 03.Next_piece_preview │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── board.ixx │ ├── main.cpp │ ├── tetromino.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 04.Score_mechanism │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── arial.ttf │ ├── board.ixx │ ├── main.cpp │ ├── tetromino.ixx │ ├── utilities.ixx │ └── vcpkg.json ├── 05.Structure │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── arial.ttf │ ├── board.ixx │ ├── board_entity.ixx │ ├── game.ixx │ ├── gamestate.ixx │ ├── main.cpp │ ├── tetromino.ixx │ ├── utilities.ixx │ └── vcpkg.json └── 06.Subdirs │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── arial.ttf │ ├── src │ ├── CMakeLists.txt │ ├── board │ │ ├── board.ixx │ │ └── board_entity.ixx │ ├── game │ │ ├── game.ixx │ │ └── gamestate.ixx │ ├── main.cpp │ ├── pieces │ │ └── tetromino.ixx │ └── utils │ │ └── utilities.ixx │ └── vcpkg.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /02.EnvironmentSetup/01.Project_template_modules/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /02.EnvironmentSetup/01.Project_template_modules/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /02.EnvironmentSetup/01.Project_template_modules/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Project description 3 | . Topic #1 4 | . Topic #2 5 | */ 6 | 7 | #include 8 | import utilities; 9 | 10 | int main(){ 11 | fmt::print("Hello, World!\n"); 12 | fmt::print("One\n"); 13 | fmt::print("Two\n"); 14 | fmt::print("Three\n"); 15 | return 0; 16 | } -------------------------------------------------------------------------------- /02.EnvironmentSetup/01.Project_template_modules/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | export module utilities; -------------------------------------------------------------------------------- /02.EnvironmentSetup/01.Project_template_modules/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /02.EnvironmentSetup/02.Project_template_headers/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /02.EnvironmentSetup/02.Project_template_headers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | 13 | find_package(fmt CONFIG REQUIRED) 14 | 15 | #We're using the project name as the target name, but you can change it to make them different. 16 | #With this setup, the name of the executable will be the same as the project name. 17 | add_executable(${PROJECT_NAME} main.cpp utilities.cpp) 18 | 19 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /02.EnvironmentSetup/02.Project_template_headers/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Project description 3 | . Topic #1 4 | . Topic #2 5 | */ 6 | 7 | 8 | #include "utilities.h" 9 | 10 | int main() { 11 | 12 | } -------------------------------------------------------------------------------- /02.EnvironmentSetup/02.Project_template_headers/utilities.cpp: -------------------------------------------------------------------------------- 1 | #include "utilities.h" 2 | -------------------------------------------------------------------------------- /02.EnvironmentSetup/02.Project_template_headers/utilities.h: -------------------------------------------------------------------------------- 1 | #pragma once -------------------------------------------------------------------------------- /02.EnvironmentSetup/02.Project_template_headers/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /02.EnvironmentSetup/07.Compiler_explorer_setup.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/02.EnvironmentSetup/07.Compiler_explorer_setup.md -------------------------------------------------------------------------------- /02.EnvironmentSetup/images/before_break_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/02.EnvironmentSetup/images/before_break_point.png -------------------------------------------------------------------------------- /02.EnvironmentSetup/images/cmake_build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/02.EnvironmentSetup/images/cmake_build.png -------------------------------------------------------------------------------- /02.EnvironmentSetup/images/cmake_select_configure_presets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/02.EnvironmentSetup/images/cmake_select_configure_presets.png -------------------------------------------------------------------------------- /02.EnvironmentSetup/images/cmake_select_configure_presets_clang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/02.EnvironmentSetup/images/cmake_select_configure_presets_clang.png -------------------------------------------------------------------------------- /02.EnvironmentSetup/images/code_lldb_launch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/02.EnvironmentSetup/images/code_lldb_launch.png -------------------------------------------------------------------------------- /02.EnvironmentSetup/images/debug_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/02.EnvironmentSetup/images/debug_window.png -------------------------------------------------------------------------------- /02.EnvironmentSetup/images/line_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/02.EnvironmentSetup/images/line_14.png -------------------------------------------------------------------------------- /02.EnvironmentSetup/images/play_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/02.EnvironmentSetup/images/play_button.png -------------------------------------------------------------------------------- /02.EnvironmentSetup/images/run_and_debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/02.EnvironmentSetup/images/run_and_debug.png -------------------------------------------------------------------------------- /03.FirstSteps/02.FirstCppProgramBasics/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /03.FirstSteps/02.FirstCppProgramBasics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /03.FirstSteps/02.FirstCppProgramBasics/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include //Global module fragment 4 | 5 | export module utilities; // Module definition 6 | 7 | //Module purview 8 | export int add_number(int first_parameter, int second_parameter){ 9 | return first_parameter + second_parameter; 10 | } 11 | 12 | export void do_work(){ 13 | fmt::print("Hello"); 14 | fmt::print("World"); 15 | fmt::print("\n"); //This prints a new line character 16 | 17 | int num1 {5}; 18 | int num2 {6}; 19 | //int result = num1 + num2; 20 | int result = add_number(num1,num2); 21 | fmt::println("Result: {}", result); 22 | fmt::println("Doing something inside do_work"); 23 | } 24 | -------------------------------------------------------------------------------- /03.FirstSteps/02.FirstCppProgramBasics/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /03.FirstSteps/03.CppProgramExecutionModel/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /03.FirstSteps/03.CppProgramExecutionModel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /03.FirstSteps/03.CppProgramExecutionModel/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Exploring the C++ program execution model 3 | */ 4 | 5 | // One line comment 6 | 7 | #include 8 | #include 9 | 10 | import utilities; 11 | 12 | 13 | int f_add(int a, int b){ 14 | return a + b; 15 | } 16 | 17 | void print_msg( std::string_view msg){ 18 | fmt::println("{}", msg); 19 | } 20 | 21 | int main() { 22 | int a = 10; 23 | int b = 5; 24 | int c; 25 | 26 | print_msg("Statement 1"); 27 | print_msg("Statement 2"); 28 | c = f_add(a, b); 29 | fmt::println("Result: {}", c); 30 | print_msg("Statement 3"); 31 | print_msg("Statement 4"); 32 | 33 | return 0; 34 | } -------------------------------------------------------------------------------- /03.FirstSteps/03.CppProgramExecutionModel/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | #include 5 | 6 | export module utilities; // Name doesn't have to match the .ixx file 7 | -------------------------------------------------------------------------------- /03.FirstSteps/03.CppProgramExecutionModel/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /03.FirstSteps/04.GUIChallenge/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /03.FirstSteps/04.GUIChallenge/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | find_package(SFML COMPONENTS system window graphics CONFIG REQUIRED) 16 | 17 | #We're using the project name as the target name, but you can change it to make them different. 18 | #With this setup, the name of the executable will be the same as the project name. 19 | add_executable(${PROJECT_NAME} main.cpp) 20 | 21 | target_sources(${PROJECT_NAME} 22 | PUBLIC 23 | FILE_SET CXX_MODULES FILES 24 | utilities.ixx 25 | ) 26 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt sfml-graphics) -------------------------------------------------------------------------------- /03.FirstSteps/04.GUIChallenge/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . A simple project using sfml with cmake and vcpkg, using c+20 modules 3 | */ 4 | 5 | // One line comment 6 | 7 | 8 | import utilities; 9 | 10 | int main() { 11 | 12 | app(); 13 | 14 | return 0; 15 | 16 | } -------------------------------------------------------------------------------- /03.FirstSteps/04.GUIChallenge/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include // Global module fragment 4 | 5 | export module utilities; 6 | 7 | export void app(){ 8 | 9 | sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!"); 10 | sf::CircleShape shape(100.f); 11 | shape.setFillColor(sf::Color::Green); 12 | 13 | while (window.isOpen()) 14 | { 15 | sf::Event event; 16 | while (window.pollEvent(event)) 17 | { 18 | if (event.type == sf::Event::Closed) 19 | window.close(); 20 | } 21 | 22 | window.clear(); 23 | window.draw(shape); 24 | window.display(); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /03.FirstSteps/04.GUIChallenge/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/01.Variables_data_types_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/01.Variables_data_types_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/01.Variables_data_types_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Exploring variables and data types 3 | */ 4 | 5 | #include 6 | 7 | // One line comment 8 | import utilities; 9 | 10 | int main() { 11 | 12 | //number_systems(); 13 | 14 | //floating_point_types(); 15 | 16 | numeric_limits(); 17 | 18 | 19 | } -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/01.Variables_data_types_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/02.Integer_modifiers_characters_text_auto_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/02.Integer_modifiers_characters_text_auto_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/02.Integer_modifiers_characters_text_auto_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Topics: 3 | . Initialization: 4 | . Braced initialization 5 | . Function style initialization 6 | . Assignment initialization 7 | . Integer modifiers 8 | . Floating point numbers: 9 | . Precision 10 | . Scientific notation 11 | . Infinity and nan 12 | . Characters and text 13 | . Collections of characters 14 | . std::vector 15 | . std::array 16 | . std::string 17 | . auto 18 | */ 19 | 20 | #include 21 | 22 | // One line comment 23 | import utilities; 24 | 25 | int main() { 26 | //braced_initialization(); 27 | //functional_initialization(); 28 | //assignment_initialization(); 29 | //integer_modifiers(); 30 | //floating_point_numbers(); 31 | //infinity_nan(); 32 | //bool_type(); 33 | //characters_and_text(); 34 | //collections_of_characters(); 35 | auto_keyword(); 36 | } -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/02.Integer_modifiers_characters_text_auto_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/03.Operations_math_functions_weird_integers_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/03.Operations_math_functions_weird_integers_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/03.Operations_math_functions_weird_integers_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/04.Bitwise_operators_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/04.Bitwise_operators_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/04.Bitwise_operators_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Topics: 3 | . Printing integers in binary 4 | . Shift operators 5 | . Logical bitwise operators 6 | . Compound bitwise operators 7 | . Masks 8 | */ 9 | #include 10 | 11 | import utilities; 12 | 13 | int main(){ 14 | //print_ints_binary(); 15 | //bitwise_shift_operators(); 16 | //logical_bitwise_operators(); 17 | //compound_bitwise_operators(); 18 | masks(); 19 | } -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/04.Bitwise_operators_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/05.Bitwise_operator_examples_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/05.Bitwise_operator_examples_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/05.Bitwise_operator_examples_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Bitwise operator examples: 3 | . Masks 4 | . Packing color information. 5 | */ 6 | 7 | import utilities; 8 | 9 | int main(){ 10 | 11 | //use_options_v0(false, false, true, true, true, false, true, false); 12 | //fmt::println("----------------"); 13 | //use_options_v1(mask_bit_2 | mask_bit_3 | mask_bit_4 | mask_bit_6); 14 | pack_color_information(); 15 | 16 | } -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/05.Bitwise_operator_examples_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/06.Challenge_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/06.Challenge_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | find_package(SFML COMPONENTS system window graphics CONFIG REQUIRED) 16 | 17 | #We're using the project name as the target name, but you can change it to make them different. 18 | #With this setup, the name of the executable will be the same as the project name. 19 | add_executable(${PROJECT_NAME} main.cpp) 20 | 21 | target_sources(${PROJECT_NAME} 22 | PUBLIC 23 | FILE_SET CXX_MODULES FILES 24 | utilities.ixx 25 | ) 26 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt sfml-graphics) -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/06.Challenge_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . A simple project using sfml with cmake and vcpkg, using c+20 modules 3 | */ 4 | 5 | // One line comment 6 | 7 | 8 | import utilities; 9 | 10 | int main() { 11 | 12 | app(); 13 | 14 | return 0; 15 | 16 | } -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/06.Challenge_/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include // Global module fragment 4 | 5 | export module utilities; 6 | 7 | export void app(){ 8 | 9 | //Store data in pre-defined variable 10 | int width {200}; 11 | int height {200}; 12 | float circle_radius {100.f}; 13 | std::string title {"SFML works!"}; 14 | sf::Color shape_color{sf::Color::Green}; 15 | sf::Color background_color{sf::Color::Red}; 16 | 17 | 18 | sf::RenderWindow window(sf::VideoMode(width, height), title); 19 | sf::CircleShape shape(circle_radius); 20 | shape.setFillColor(shape_color); 21 | 22 | while (window.isOpen()) 23 | { 24 | sf::Event event; 25 | while (window.pollEvent(event)) 26 | { 27 | if (event.type == sf::Event::Closed) 28 | window.close(); 29 | } 30 | 31 | window.clear(background_color); 32 | window.draw(shape); 33 | window.display(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /04.VariablesAndDatatypesAndOperations/06.Challenge_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/01.Input_output_streams_and_formatting_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/01.Input_output_streams_and_formatting_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/01.Input_output_streams_and_formatting_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Topics: 3 | . Input and output streams 4 | . Stream formatting 5 | . The format library 6 | . Literals 7 | . Constants 8 | */ 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | import utilities; 15 | 16 | int main(){ 17 | input_output_iostream(); 18 | output_formatting(); 19 | } -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/01.Input_output_streams_and_formatting_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/02.Format_library_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/02.Format_library_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/02.Format_library_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Explore the format library in C++20 and C++23 3 | */ 4 | 5 | //#include 6 | //#include 7 | #include 8 | #include 9 | 10 | import utilities; 11 | 12 | int main(){ 13 | //standard_format_facilities(); 14 | external_format_facilities(); 15 | } -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/02.Format_library_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/03.Literals_and_constants_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/03.Literals_and_constants_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/03.Literals_and_constants_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Topics: 3 | . Literals 4 | . Constants 5 | . constexpr variables 6 | . constexpr functions 7 | . consteval functions 8 | . constinit 9 | */ 10 | #include 11 | 12 | import utilities; 13 | 14 | //constinit : C++20. Guarantees that the variable is initialized at compile time. 15 | //Initialization with a run-time value will lead to a compiler error. 16 | const constinit int age{24}; 17 | 18 | int randomizer = 5; 19 | //constinit int car_count{add(3,randomizer)}; // Error. randomizer is not a compile time value 20 | 21 | int main(){ 22 | 23 | //literals(); 24 | //constants(); 25 | //constexpr_variables(); 26 | //constexpr_functions(); 27 | //consteval_functions(); 28 | 29 | /* 30 | //constinit double height{1.72}; //Error: 'height': 'constinit' only allowed on a variable 31 | //declaration with static or thread storage duration 32 | */ 33 | 34 | } -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/03.Literals_and_constants_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/04.Challenge/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/04.Challenge/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | find_package(SFML COMPONENTS system window graphics CONFIG REQUIRED) 16 | 17 | #We're using the project name as the target name, but you can change it to make them different. 18 | #With this setup, the name of the executable will be the same as the project name. 19 | add_executable(${PROJECT_NAME} main.cpp) 20 | 21 | target_sources(${PROJECT_NAME} 22 | PUBLIC 23 | FILE_SET CXX_MODULES FILES 24 | utilities.ixx 25 | ) 26 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt sfml-graphics) -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/04.Challenge/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . A simple project using sfml with cmake and vcpkg, using c+20 modules 3 | */ 4 | 5 | // One line comment 6 | 7 | 8 | import utilities; 9 | 10 | int main() { 11 | 12 | app(); 13 | 14 | return 0; 15 | 16 | } -------------------------------------------------------------------------------- /05.StreamsAndFormattingLiteralsConstants/04.Challenge/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /06.FlowControl/01.If_switch_ternary_operator_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /06.FlowControl/01.If_switch_ternary_operator_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /06.FlowControl/01.If_switch_ternary_operator_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Topics: 3 | . If, switch, short circuit evaluations and ternary operator, std::unreachable 4 | . Loops: for, while, do while 5 | . std::unreachable (C++ 23) 6 | */ 7 | 8 | #include 9 | 10 | import utilities; 11 | 12 | 13 | 14 | 15 | int main(){ 16 | //if_statement(); 17 | //switch_statement(); 18 | //short_circuit_evaluations(); 19 | //ternary_operator(); 20 | std_unreachable(); 21 | 22 | } -------------------------------------------------------------------------------- /06.FlowControl/01.If_switch_ternary_operator_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /06.FlowControl/02.Loops_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /06.FlowControl/02.Loops_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /06.FlowControl/02.Loops_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Topics: 3 | . Loops: for, while, do-while 4 | . ATTENTION: Use the debugger to step through the loops. 5 | */ 6 | #include 7 | #include 8 | #include 9 | 10 | import utilities; 11 | 12 | int main(){ 13 | //for_loop(); 14 | //while_loop(); 15 | //infinite_loop(); 16 | //decrementing_loops(); 17 | break_continue(); 18 | } -------------------------------------------------------------------------------- /06.FlowControl/02.Loops_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /06.FlowControl/03.Challenge_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /06.FlowControl/03.Challenge_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | find_package(SFML COMPONENTS system window graphics CONFIG REQUIRED) 16 | 17 | #We're using the project name as the target name, but you can change it to make them different. 18 | #With this setup, the name of the executable will be the same as the project name. 19 | add_executable(${PROJECT_NAME} main.cpp) 20 | 21 | target_sources(${PROJECT_NAME} 22 | PUBLIC 23 | FILE_SET CXX_MODULES FILES 24 | utilities.ixx 25 | ) 26 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt sfml-graphics) -------------------------------------------------------------------------------- /06.FlowControl/03.Challenge_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . GUI Challenge: SFML 3 | . Practice control flow: 4 | 5 | 0. Understanding the while loop in the application 6 | 7 | 1. Add more key events: 8 | C-> Increase the circle size: radius += 10.f; 9 | D-> Decrease the circle size: radius -= 10.f; 10 | 11 | 2. Add mouse events: 12 | Left-> color = sf::Color::Magenta; 13 | Right-> color = sf::Color::Cyan; 14 | 15 | 3. Conditional rendering: 16 | . If radius> 150.f -> color = sf::Color::Gray; 17 | . If radius< 150.f -> color = sf::Color::Black; 18 | 19 | 4: Add a timer: 20 | . Change the color every 5 seconds. 21 | . This also shows how we can setup a counter. 22 | . classes: 23 | . sf::Clock 24 | . sf::Time 25 | */ 26 | 27 | // One line comment 28 | 29 | 30 | import utilities; 31 | 32 | int main() { 33 | 34 | app(); 35 | 36 | return 0; 37 | 38 | } -------------------------------------------------------------------------------- /06.FlowControl/03.Challenge_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /07.Sequences/01.Std_array_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /07.Sequences/01.Std_array_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /07.Sequences/01.Std_array_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /07.Sequences/02.Std_vector_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /07.Sequences/02.Std_vector_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /07.Sequences/02.Std_vector_/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | #include 5 | 6 | export module utilities; 7 | -------------------------------------------------------------------------------- /07.Sequences/02.Std_vector_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /07.Sequences/03.Std_string_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /07.Sequences/03.Std_string_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /07.Sequences/03.Std_string_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Topic: 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | import utilities; 9 | 10 | int main(){ 11 | //declare_and_initialize(); 12 | //construction(); 13 | //access_and_modify(); 14 | //appending_and_concatenation(); 15 | //substrings_and_finding(); 16 | //comparison(); 17 | length_capacity_clear(); 18 | } -------------------------------------------------------------------------------- /07.Sequences/03.Std_string_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /07.Sequences/04.Built_in_array_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /07.Sequences/04.Built_in_array_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /07.Sequences/04.Built_in_array_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Exploring built in arrays 3 | . Topics: 4 | . Declaration and initialization 5 | . Size of an array 6 | . Array of characters 7 | . Array bounds 8 | . Random number generation old style 9 | . Random number generation modern C++ 10 | . Multi-dimensional array 11 | . Multi-dimensional array of characters 12 | */ 13 | 14 | #include 15 | #include 16 | 17 | import utilities; 18 | 19 | int main(){ 20 | 21 | //declaration_and_initialization(); 22 | //size_of_an_array(); 23 | //arrays_of_characters(); 24 | //array_bounds(); 25 | 26 | } -------------------------------------------------------------------------------- /07.Sequences/04.Built_in_array_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /07.Sequences/05.Random_numbers_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /07.Sequences/05.Random_numbers_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /07.Sequences/05.Random_numbers_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Topics: 3 | . Random number generation old style 4 | . Random number generation modern C++ 5 | . An example 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | import utilities; 13 | 14 | int main(){ 15 | //random_num_old_style(); 16 | //random_num_modern_cpp(); 17 | random_num_example(); 18 | 19 | } -------------------------------------------------------------------------------- /07.Sequences/05.Random_numbers_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /07.Sequences/06.Fortune_tellter_/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /07.Sequences/06.Fortune_tellter_/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 11 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 12 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 13 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 14 | 15 | find_package(fmt CONFIG REQUIRED) 16 | 17 | #We're using the project name as the target name, but you can change it to make them different. 18 | #With this setup, the name of the executable will be the same as the project name. 19 | add_executable(${PROJECT_NAME} main.cpp) 20 | 21 | target_sources(${PROJECT_NAME} 22 | PUBLIC 23 | FILE_SET CXX_MODULES FILES 24 | utilities.ixx 25 | ) 26 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /07.Sequences/06.Fortune_tellter_/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Fortune tellet project 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | import utilities; 12 | 13 | int main(){ 14 | //fortune_teller_good(); 15 | fortune_teller_bad(); 16 | } -------------------------------------------------------------------------------- /07.Sequences/06.Fortune_tellter_/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /07.Sequences/07.Challenge/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /07.Sequences/07.Challenge/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 11 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 12 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 13 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 14 | 15 | find_package(fmt CONFIG REQUIRED) 16 | find_package(SFML COMPONENTS system window graphics CONFIG REQUIRED) 17 | 18 | #We're using the project name as the target name, but you can change it to make them different. 19 | #With this setup, the name of the executable will be the same as the project name. 20 | add_executable(${PROJECT_NAME} main.cpp) 21 | 22 | target_sources(${PROJECT_NAME} 23 | PUBLIC 24 | FILE_SET CXX_MODULES FILES 25 | utilities.ixx 26 | ) 27 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt sfml-graphics) -------------------------------------------------------------------------------- /07.Sequences/07.Challenge/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/01.Pointers/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/01.Pointers/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Pointers: 3 | . Topics: (Each of these may be a lecture) 4 | . Pointer basics: declaration and initialization 5 | . Pointers and constness 6 | . Pointers and arrays 7 | . Pointer arithmetic 8 | */ 9 | 10 | #include 11 | import utilities; 12 | 13 | int main(){ 14 | 15 | pointer_basics(); 16 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/01.Pointers/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | export module utilities; 4 | 5 | import pointers_1; 6 | import pointers_2; 7 | import pointers_3; 8 | import pointers_4; 9 | 10 | export void pointer_basics(){ 11 | 12 | //Pointer basics 13 | //pointers_1::pointer_declaration_initialization(); 14 | //pointers_1::assignment_and_access(); 15 | //pointers_1::pointer_to_char(); 16 | 17 | 18 | //Pointers and const 19 | //pointers_2::raw_modifiable_variables(); 20 | //pointers_2::non_const_pointer_to_non_const_data(); 21 | //pointers_2::pointer_to_const(); 22 | //pointers_2::where_const_applies(); 23 | //pointers_2::const_data_const_pointer(); 24 | //pointers_2::non_const_data_const_pointer(); 25 | 26 | 27 | //Relationship between arrays and pointers 28 | //pointers_3::pointers_arrays_relationship(); 29 | //pointers_3::swapping_addresses(); 30 | 31 | //Pointer arithmetics 32 | //pointers_4::pointer_arithmetic_navigation(); 33 | //pointers_4::pointer_arithmetic_distance(); 34 | pointers_4::pointer_arithmetic_compare_pointers(); 35 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/01.Pointers/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/02.Dynamic_memory_allocation/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/02.Dynamic_memory_allocation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | dynamic_memory_allocation_1.ixx 25 | ) 26 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/02.Dynamic_memory_allocation/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Dynamic memory allocation and pointers 3 | . Topics: 4 | . new and delete 5 | . dangling pointers 6 | . when new fails 7 | . null pointer safety 8 | . memory leaks 9 | . dynamic arrays 10 | . static arrays vs dynamic arrays 11 | */ 12 | 13 | import utilities; 14 | 15 | int main(){ 16 | dynamic_memory_allocation_demo(); 17 | 18 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/02.Dynamic_memory_allocation/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | export module utilities; 4 | 5 | import dynamic_memory_allocation; 6 | 7 | 8 | export void dynamic_memory_allocation_demo(){ 9 | //dynamic_memory_allocation::pointer_review(); 10 | //dynamic_memory_allocation::pointers_gone_bad(); 11 | //dynamic_memory_allocation::dynamic_heap_memory(); 12 | //dynamic_memory_allocation::dangling_pointers(); 13 | //dynamic_memory_allocation::when_new_fails(); 14 | //dynamic_memory_allocation::null_ptr_safety(); 15 | //dynamic_memory_allocation::memory_leaks(); 16 | dynamic_memory_allocation::dynamic_arrays(); 17 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/02.Dynamic_memory_allocation/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/03.SmartPointers/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/03.SmartPointers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | unique_pointers.ixx 25 | shared_pointers.ixx 26 | ) 27 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/03.SmartPointers/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | import utilities; 6 | 7 | int main(){ 8 | 9 | smart_pointers_demo(); 10 | 11 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/03.SmartPointers/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | export module utilities; 4 | 5 | import unique_pointers; 6 | import shared_pointers; 7 | 8 | 9 | export void smart_pointers_demo(){ 10 | 11 | //unique_pointers::tinker_with_unique_pointers(); 12 | shared_pointers::tinker_with_shared_pointers(); 13 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/03.SmartPointers/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/04.References/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/04.References/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/04.References/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Exploring references 3 | . Topics: 4 | . Declaring and using references 5 | . Compare pointers to references 6 | . References and const 7 | . references with range based for loop 8 | 9 | */ 10 | 11 | import utilities; 12 | 13 | int main(){ 14 | //declaring_and_using_references(); 15 | //comparing_pointers_and_references(); 16 | //references_and_const(); 17 | ref_with_range_based_for_loop(); 18 | 19 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/04.References/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/05.Challenge/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/05.Challenge/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | find_package(SFML COMPONENTS system window graphics CONFIG REQUIRED) 16 | 17 | #We're using the project name as the target name, but you can change it to make them different. 18 | #With this setup, the name of the executable will be the same as the project name. 19 | add_executable(${PROJECT_NAME} main.cpp) 20 | 21 | target_sources(${PROJECT_NAME} 22 | PUBLIC 23 | FILE_SET CXX_MODULES FILES 24 | utilities.ixx 25 | ) 26 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt sfml-graphics) -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/05.Challenge/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Explore dynamic memory with the shape animator sfml application: 3 | . dm_1: storing the data in a std::vector 4 | . dm_2: storing the data in dynamic arrays: new and delete 5 | . dm_3: storing the data in dynamic arrays: smart pointers 6 | 7 | */ 8 | 9 | import utilities; 10 | 11 | int main(){ 12 | 13 | //This is the best way to go 14 | /* 15 | dm_1::app(); 16 | */ 17 | 18 | //This is the worst way to go 19 | /* 20 | dm_2::app(); 21 | */ 22 | 23 | //This is the second worst way 24 | dm_3::app(); 25 | 26 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/05.Challenge/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/06.Challenge2/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/06.Challenge2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | #find_package(fmt CONFIG REQUIRED) 15 | find_package(ftxui CONFIG REQUIRED) 16 | 17 | #We're using the project name as the target name, but you can change it to make them different. 18 | #With this setup, the name of the executable will be the same as the project name. 19 | add_executable(${PROJECT_NAME} main.cpp) 20 | 21 | target_sources(${PROJECT_NAME} 22 | PUBLIC 23 | FILE_SET CXX_MODULES FILES 24 | utilities.ixx 25 | ) 26 | target_link_libraries(${PROJECT_NAME} PRIVATE ftxui::dom ftxui::screen ftxui::component) -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/06.Challenge2/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Exploring the ftxui library 3 | */ 4 | 5 | import utilities; 6 | 7 | int main(){ 8 | 9 | //The basics 10 | /* 11 | ftxui_it1::app(); 12 | */ 13 | 14 | //Interactiviey 15 | ftxui_it2::app(); 16 | 17 | return 0; 18 | 19 | } -------------------------------------------------------------------------------- /08.Pointers_dynamic_memory_arrays/06.Challenge2/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "ftxui" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /09.Characters_and_strings/01.Characters_and_strings/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /09.Characters_and_strings/01.Characters_and_strings/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Manipulating characters: 3 | . Topics: 4 | . is_al_num 5 | . is_alphabetic 6 | . is_blank 7 | . is_upercase 8 | . is_digit 9 | . change_to_lowercase 10 | */ 11 | 12 | import utilities; 13 | 14 | int main(){ 15 | 16 | //handling_characters_demo(); 17 | //handling_c_strings_demo(); 18 | //handling_std_strings_demo(); 19 | //string_literals_demo(); 20 | string_views_demo(); 21 | 22 | } -------------------------------------------------------------------------------- /09.Characters_and_strings/01.Characters_and_strings/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /09.Characters_and_strings/02.Challenges/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /09.Characters_and_strings/02.Challenges/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /09.Characters_and_strings/02.Challenges/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Challenges for chapter 9: characters and strings 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | import utilities; 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | int main(){ 20 | 21 | //challenge_1::app(); 22 | //challenge_2::app(); 23 | //challenge_3::app(); 24 | challenge_4::app(); 25 | 26 | 27 | } -------------------------------------------------------------------------------- /09.Characters_and_strings/02.Challenges/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /09.Characters_and_strings/03.Challenge_ftxui_palindrome/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /09.Characters_and_strings/03.Challenge_ftxui_palindrome/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | find_package(ftxui CONFIG REQUIRED) 16 | 17 | #We're using the project name as the target name, but you can change it to make them different. 18 | #With this setup, the name of the executable will be the same as the project name. 19 | add_executable(${PROJECT_NAME} main.cpp) 20 | 21 | target_sources(${PROJECT_NAME} 22 | PUBLIC 23 | FILE_SET CXX_MODULES FILES 24 | utilities.ixx 25 | ) 26 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt ftxui::dom ftxui::screen ftxui::component) -------------------------------------------------------------------------------- /09.Characters_and_strings/03.Challenge_ftxui_palindrome/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Palindrome checker app using the ftxui library 3 | */ 4 | 5 | import utilities; 6 | 7 | int main(){ 8 | 9 | ftxui_palindrome_app::app(); 10 | 11 | } -------------------------------------------------------------------------------- /09.Characters_and_strings/03.Challenge_ftxui_palindrome/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "ftxui" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /10.Functions/01.Function_basics/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /10.Functions/01.Function_basics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp compare_impl.cpp math_impl.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | compare.ixx 25 | math.ixx 26 | ) 27 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /10.Functions/01.Function_basics/compare.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | export module compare; 4 | 5 | //Iteration 1 of separating functions across multiple files 6 | namespace it_1 7 | { 8 | export int maximum(int a, int b) { 9 | if (a > b) 10 | return a; 11 | else 12 | return b; 13 | } 14 | 15 | export int minimum(int a, int b) { 16 | if (a < b) 17 | return a; 18 | else 19 | return b; 20 | } 21 | 22 | } // namespace it_1 23 | 24 | namespace it_2 25 | { 26 | export int maximum(int a, int b); // Function declaration , prototype 27 | // Signature doesn't include return type 28 | export int minimum(int a, int b); 29 | 30 | } // namespace it_2 31 | 32 | -------------------------------------------------------------------------------- /10.Functions/01.Function_basics/compare_impl.cpp: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | module compare; 4 | 5 | namespace it_2 6 | { 7 | int maximum(int a, int b) { 8 | if (a > b) 9 | return a; 10 | else 11 | return b; 12 | } 13 | 14 | int minimum(int a, int b) { 15 | if (a < b) 16 | return a; 17 | else 18 | return b; 19 | } 20 | 21 | } // namespace it_2 22 | -------------------------------------------------------------------------------- /10.Functions/01.Function_basics/math.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | export module math; 4 | 5 | namespace it_1 6 | { 7 | //A function to add up two numbers 8 | export int add(int a, int b){ 9 | 10 | //Body of the function 11 | return a + b; 12 | 13 | } 14 | 15 | export int inc_mult(int a, int b) { 16 | int result = ((++a) * (++b)); 17 | return result; 18 | } 19 | 20 | } // namespace it_1 21 | 22 | 23 | namespace it_2 24 | { 25 | export int add(int a, int b); 26 | export int inc_mult(int a, int b); 27 | 28 | } // namespace it_2 29 | 30 | 31 | -------------------------------------------------------------------------------- /10.Functions/01.Function_basics/math_impl.cpp: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | module math; 4 | 5 | namespace it_2 6 | { 7 | //A function to add up two numbers 8 | int add(int a, int b){ 9 | 10 | //Body of the function 11 | return a + b; 12 | 13 | } 14 | 15 | int inc_mult(int a, int b) { 16 | int result = ((++a) * (++b)); 17 | return result; 18 | } 19 | 20 | } // namespace it_2 21 | -------------------------------------------------------------------------------- /10.Functions/01.Function_basics/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module utilities; 6 | 7 | //Function that takes one input and doesn't return anything 8 | 9 | export void print_number(auto number){ 10 | fmt::println("number: {}", number); 11 | } 12 | 13 | 14 | // Function that doesnt' take parameters and returns nothing 15 | export void say_hello() 16 | { 17 | fmt::println("Hello there"); 18 | return;// You could omit this return statement for functions returning void 19 | } -------------------------------------------------------------------------------- /10.Functions/01.Function_basics/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /10.Functions/02.Passing_parameters/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /10.Functions/02.Passing_parameters/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /10.Functions/02.Passing_parameters/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | export module utilities; -------------------------------------------------------------------------------- /10.Functions/02.Passing_parameters/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /10.Functions/03.Sequences_and_array_parameters/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /10.Functions/03.Sequences_and_array_parameters/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /10.Functions/03.Sequences_and_array_parameters/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | export module utilities; -------------------------------------------------------------------------------- /10.Functions/03.Sequences_and_array_parameters/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /10.Functions/04.Constexpr_consteval_functions/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /10.Functions/04.Constexpr_consteval_functions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /10.Functions/04.Constexpr_consteval_functions/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | /* 3 | . constexpr and consteval functions 4 | . constexpr function: 5 | . Can be evaluated at compile time or runtime, depending on how it is used. If all inputs are constant expressions, it is evaluated at compile time; otherwise, it is evaluated at runtime. 6 | 7 | . consteval function: 8 | . Must be evaluated only at compile time. If called in a context that cannot guarantee compile-time evaluation, it results in a compilation error. 9 | 10 | */ 11 | #include 12 | 13 | import utilities; 14 | 15 | int main(){ 16 | // For the evaluation to take place at compile time, we have 17 | // to remember to store the return value in a constexpr result variable. 18 | int run_time_mulitplier {10}; // Run time 19 | 20 | int result = get_value(run_time_mulitplier); 21 | fmt::println("value: {}", result); 22 | 23 | } -------------------------------------------------------------------------------- /10.Functions/04.Constexpr_consteval_functions/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | export module utilities; 4 | 5 | // Marking a function as constexpr gives it the potential 6 | // to be evaluated at compile time 7 | /* 8 | export constexpr int get_value(int multiplier) { 9 | return 3 * multiplier; 10 | } 11 | */ 12 | 13 | 14 | // Evaluate this function at compile time. If you can't 15 | // do that throw a compiler error 16 | export consteval int get_value(int multiplier) { 17 | return 3 * multiplier; 18 | } -------------------------------------------------------------------------------- /10.Functions/04.Constexpr_consteval_functions/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /10.Functions/05.Arguments_to_main/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /10.Functions/05.Arguments_to_main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /10.Functions/05.Arguments_to_main/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Arguments to main: 3 | . Grab and use the arguments: the concepts 4 | . Show calculator example, getting operands and operator from the command line. 5 | . Multiplication uses the x character, not the * character. 6 | */ 7 | 8 | #include 9 | 10 | import utilities; 11 | 12 | int main(int argc, char* argv[]){ 13 | 14 | //process_arguments(argc, argv); 15 | calculator(argc, argv); 16 | 17 | 18 | } -------------------------------------------------------------------------------- /10.Functions/05.Arguments_to_main/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /10.Functions/06.Function_overloading/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /10.Functions/06.Function_overloading/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | overloading_1.ixx 25 | overloading_2.ixx 26 | overloading_4.ixx 27 | 28 | ) 29 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /10.Functions/06.Function_overloading/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Function overloading: 3 | . Concept: Functions with the same name but different parameters. 4 | . The differences may be in the type of the parameters or the number of parameters. 5 | . The return type is not considered. 6 | . Basic examples 7 | . Overloading to handle arrays and pointers 8 | . Overloading std::getline: an example. 9 | . Some fun examples 10 | */ 11 | 12 | import utilities; 13 | 14 | int main(){ 15 | 16 | //overloading_1_demo(); 17 | //overloading_2_demo(); 18 | //overloading_3_demo(); 19 | overloading_4_demo(); 20 | 21 | } -------------------------------------------------------------------------------- /10.Functions/06.Function_overloading/overloading_1.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module overloading_1; 6 | 7 | namespace overloading_1 8 | { 9 | export void print(int value){ 10 | fmt::println("Integer: {}", value); 11 | } 12 | 13 | export void print(int value1, int value2){ 14 | fmt::println("Integer1: {}, Integer2: {} ", value1, value2); 15 | } 16 | 17 | export void print(double value){ 18 | fmt::println("Double: {}", value); 19 | } 20 | 21 | export void print(const std::string& value){ 22 | fmt::println("String: {}", value); 23 | } 24 | 25 | } // namespace overloading_1 26 | -------------------------------------------------------------------------------- /10.Functions/06.Function_overloading/overloading_2.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module overloading_2; 6 | 7 | namespace overloading_2 8 | { 9 | export void process(int* array, size_t size) { 10 | fmt::println("Processing array of size {}", size); 11 | } 12 | 13 | export void process(int value) { 14 | fmt::println("Processing single value: {}", value); 15 | } 16 | 17 | } // namespace overloading_2 18 | -------------------------------------------------------------------------------- /10.Functions/06.Function_overloading/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /10.Functions/07.Lambda_functions/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /10.Functions/07.Lambda_functions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | ) 25 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /10.Functions/07.Lambda_functions/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Lambda functions: 3 | . Declaring a lambda function and calling it through a name 4 | . Declare a lambda function and call it directly 5 | . Lambda function that takes parameters 6 | . Lambda function that returns something 7 | . Explicitly specify the return type 8 | . Capture lists 9 | */ 10 | 11 | #include 12 | 13 | import utilities; 14 | 15 | int main(){ 16 | //declare_and_use_lambda_func(); 17 | //capture_lists(); 18 | //capture_by_value_modification(); 19 | //capture_by_reference_modification(); 20 | //capture_all_by_value(); 21 | capture_all_by_reference(); 22 | } -------------------------------------------------------------------------------- /10.Functions/07.Lambda_functions/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /10.Functions/08.Attributes_static_vars_recursion/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /10.Functions/08.Attributes_static_vars_recursion/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | attributes.ixx 25 | static_vars.ixx 26 | recursion.ixx 27 | ) 28 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /10.Functions/08.Attributes_static_vars_recursion/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Attributes 3 | . recursion 4 | . static variables in functions 5 | */ 6 | 7 | import utilities; 8 | 9 | int main(){ 10 | 11 | //attributes_demo(); 12 | //static_vars_demo(); 13 | //recursion_demo(); 14 | 15 | } -------------------------------------------------------------------------------- /10.Functions/08.Attributes_static_vars_recursion/static_vars.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module static_vars; 6 | 7 | namespace static_vars 8 | { 9 | //Static variables in functions: This allows us to keep track of the number of times a function has been called. 10 | 11 | export void user_login(){ 12 | static size_t login_count {0}; 13 | ++login_count; 14 | fmt::println("Welcome back! This is your login attempt number: {}", login_count); 15 | } 16 | 17 | 18 | } // namespace static_vars 19 | -------------------------------------------------------------------------------- /10.Functions/08.Attributes_static_vars_recursion/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /10.Functions/09.Challenge_1/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /10.Functions/09.Challenge_1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | find_package(SFML COMPONENTS system window graphics CONFIG REQUIRED) 16 | 17 | #We're using the project name as the target name, but you can change it to make them different. 18 | #With this setup, the name of the executable will be the same as the project name. 19 | add_executable(${PROJECT_NAME} main.cpp) 20 | 21 | target_sources(${PROJECT_NAME} 22 | PUBLIC 23 | FILE_SET CXX_MODULES FILES 24 | utilities.ixx 25 | ) 26 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt sfml-system sfml-network sfml-graphics sfml-window) -------------------------------------------------------------------------------- /10.Functions/09.Challenge_1/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Breaking up the sfml application into functions 3 | */ 4 | 5 | import utilities; 6 | 7 | int main(){ 8 | 9 | //it_1::app(); 10 | it_2::app(); 11 | 12 | } -------------------------------------------------------------------------------- /10.Functions/09.Challenge_1/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /10.Functions/10.Challenge_2/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /10.Functions/10.Challenge_2/arial.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/10.Functions/10.Challenge_2/arial.ttf -------------------------------------------------------------------------------- /10.Functions/10.Challenge_2/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . ftxui calculator 3 | . sfml apps 4 | */ 5 | 6 | import utilities; 7 | 8 | int main(int argc, char* argv[]){ 9 | 10 | //it_1::app(); 11 | //it_2::app(); 12 | it_3::app(argc, argv); 13 | 14 | } -------------------------------------------------------------------------------- /10.Functions/10.Challenge_2/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml", 7 | "ftxui" 8 | ], 9 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 10 | } -------------------------------------------------------------------------------- /11.FileIO/01.Reading_and_writing_files_text_binary/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /11.FileIO/01.Reading_and_writing_files_text_binary/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | text_files.ixx 25 | binary_files.ixx 26 | ) 27 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /11.FileIO/01.Reading_and_writing_files_text_binary/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /11.FileIO/02.Practice_csv_json/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /11.FileIO/02.Practice_csv_json/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | csv.ixx 25 | json.ixx 26 | ) 27 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /11.FileIO/02.Practice_csv_json/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | A project to practice reading and writing json and csv data from our C++ program 3 | */ 4 | 5 | import utilities; 6 | 7 | int main(){ 8 | 9 | //csv_demo(); 10 | json_demo(); 11 | 12 | } -------------------------------------------------------------------------------- /11.FileIO/02.Practice_csv_json/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module utilities; 6 | 7 | import csv; 8 | import json; 9 | 10 | 11 | export void csv_demo(){ 12 | 13 | std::filesystem::path file_path = R"(D:\sample_file.csv)"; // Windows 14 | //std::filesystem::path file_path = R"(/path/to/your/sample_file.csv)"; // Linux 15 | 16 | //Write CSV data 17 | csv::write_csv(file_path); 18 | 19 | //Read and display CSV data 20 | csv::read_csv(file_path); 21 | 22 | } 23 | 24 | export void json_demo(){ 25 | 26 | std::filesystem::path file_path = R"(D:\sample_file.json)"; // Windows 27 | //std::filesystem::path file_path = R"(/path/to/your/sample_file.json)"; // Linux 28 | 29 | // Write JSON data 30 | json::write_json(file_path); 31 | 32 | // Read and display the JSON data 33 | json::read_json(file_path); 34 | 35 | } -------------------------------------------------------------------------------- /11.FileIO/02.Practice_csv_json/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /11.FileIO/03.Challenge/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /11.FileIO/03.Challenge/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | find_package(ftxui CONFIG REQUIRED) 16 | 17 | #We're using the project name as the target name, but you can change it to make them different. 18 | #With this setup, the name of the executable will be the same as the project name. 19 | add_executable(${PROJECT_NAME} main.cpp) 20 | 21 | target_sources(${PROJECT_NAME} 22 | PUBLIC 23 | FILE_SET CXX_MODULES FILES 24 | utilities.ixx 25 | ) 26 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt ftxui::dom ftxui::screen ftxui::component ) -------------------------------------------------------------------------------- /11.FileIO/03.Challenge/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Contact manager application using ftxui 3 | . adding contacts 4 | . deleting contacts 5 | . listing contacts 6 | . persisting contacts to a file 7 | . can read and write contacts to a file 8 | */ 9 | 10 | import utilities; 11 | 12 | int main(){ 13 | 14 | it_1::app(); 15 | 16 | } -------------------------------------------------------------------------------- /11.FileIO/03.Challenge/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "ftxui" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /12.Custom_types/01.Custom_types_basics/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /12.Custom_types/01.Custom_types_basics/ct1.ixx: -------------------------------------------------------------------------------- 1 | /* 2 | . The syntax to create classes 3 | . private and private keywords 4 | . struct and class 5 | . class makes things private by default 6 | . sturct makes things public by default 7 | . create object of our class 8 | . Access data inside of the class: 9 | . reading 10 | . changing information in the class object 11 | . Move the code of the class into a module file. 12 | */ 13 | module; 14 | 15 | #include 16 | 17 | export module ct1; 18 | 19 | namespace ct1 20 | { 21 | export class Pixel{ 22 | public: 23 | uint32_t m_color{0xFF000000}; 24 | unsigned int m_pos_x{0}; 25 | unsigned int m_pos_y{0}; 26 | }; 27 | 28 | 29 | /* 30 | export struct Pixel{ 31 | //public: 32 | uint32_t m_color{0xFF000000}; 33 | unsigned int m_pos_x{0}; 34 | unsigned int m_pos_y{0}; 35 | }; 36 | */ 37 | 38 | } // namespace ct1 39 | -------------------------------------------------------------------------------- /12.Custom_types/01.Custom_types_basics/ct4.cpp: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | #include 5 | 6 | module ct4; 7 | 8 | namespace ct4 9 | { 10 | //Implementations 11 | //Constructor 12 | Pixel::Pixel(uint32_t color, unsigned int x, unsigned int y){ 13 | m_color = color; 14 | m_pos_x = x; 15 | m_pos_y = y; 16 | } 17 | 18 | //Destructor 19 | Pixel::~Pixel(){ 20 | //Release the memory 21 | fmt::println("Pixel object destroyed..."); 22 | } 23 | 24 | //Getters 25 | uint32_t Pixel::get_color() const{ 26 | //m_color = 0xffffffff; 27 | return m_color; 28 | } 29 | 30 | unsigned int Pixel::get_x() const{ 31 | return m_pos_x; 32 | } 33 | 34 | unsigned int Pixel::get_y() const{ 35 | return m_pos_y; 36 | } 37 | 38 | //Setters: 39 | void Pixel::set_color(uint32_t color){ 40 | this->m_color = color; 41 | } 42 | 43 | void Pixel::set_x(unsigned int x){ 44 | this->m_pos_x = x; 45 | } 46 | 47 | void Pixel::set_y(unsigned int y){ 48 | this->m_pos_y = y; 49 | } 50 | 51 | } // namespace ct4 52 | -------------------------------------------------------------------------------- /12.Custom_types/01.Custom_types_basics/ct4.ixx: -------------------------------------------------------------------------------- 1 | /* 2 | . Separating declarations from definitions in different files. 3 | . module interface file: ct4.ixx 4 | . module implementation file: ct4.cpp 5 | */ 6 | module; 7 | 8 | #include 9 | 10 | export module ct4; 11 | 12 | namespace ct4 13 | { 14 | export class Pixel{ 15 | public: 16 | Pixel() = default; 17 | Pixel(uint32_t color, unsigned int x, unsigned int y); 18 | ~Pixel(); 19 | 20 | //Getters 21 | uint32_t get_color() const; 22 | unsigned int get_x() const; 23 | unsigned int get_y() const; 24 | 25 | //Setters: 26 | void set_color(uint32_t color); 27 | void set_x(unsigned int x); 28 | void set_y(unsigned int y); 29 | private: 30 | uint32_t m_color{0xFF000000}; 31 | unsigned int m_pos_x{0}; 32 | unsigned int m_pos_y{0}; 33 | }; 34 | 35 | } // namespace ct4 36 | -------------------------------------------------------------------------------- /12.Custom_types/01.Custom_types_basics/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Basics of classes in C++ 3 | */ 4 | 5 | 6 | 7 | import utilities; 8 | 9 | 10 | 11 | 12 | int main(){ 13 | 14 | //ct1_demo(); 15 | //ct2_demo(); 16 | //ct3_demo(); 17 | //ct4_demo(); 18 | //ct5_demo(); 19 | //ct6_demo(); 20 | //ct7_demo(); 21 | //ct8_demo(); 22 | //ct9_demo(); 23 | //ct10_demo(); 24 | //ct13_demo(); 25 | //ct14_demo(); 26 | //ct15_demo_pod(); 27 | //ct15_demo_non_pod(); 28 | //ct16_demo(); 29 | ct17_demo(); 30 | 31 | 32 | } -------------------------------------------------------------------------------- /12.Custom_types/01.Custom_types_basics/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /12.Custom_types/02.Pixels_in_canvas/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /12.Custom_types/02.Pixels_in_canvas/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp pixel.cpp canvas.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | pixel.ixx 25 | canvas.ixx 26 | ) 27 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /12.Custom_types/02.Pixels_in_canvas/pixel.cpp: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | #include 5 | 6 | module pixel; 7 | 8 | 9 | Pixel::Pixel(uint32_t initial_color, Position initial_position) 10 | : m_color(initial_color), m_position(initial_position) 11 | { 12 | } 13 | 14 | 15 | void Pixel::set_color(uint32_t color) { 16 | if (color > 0xFFFFFFFF) { 17 | throw std::out_of_range("Invalid color value. Must be a 24-bit hex value."); 18 | } 19 | m_color = color; 20 | } 21 | 22 | uint32_t Pixel::get_color() const { 23 | return m_color; 24 | } 25 | 26 | void Pixel::set_position(Position pos) { 27 | m_position = pos; 28 | } 29 | 30 | Position Pixel::get_position() const { 31 | return m_position; 32 | } 33 | -------------------------------------------------------------------------------- /12.Custom_types/02.Pixels_in_canvas/pixel.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module pixel; 6 | 7 | export struct Position { 8 | unsigned int x{0}; 9 | unsigned int y{0}; 10 | }; 11 | 12 | export class Pixel { 13 | public: 14 | Pixel() = default; 15 | Pixel(uint32_t initial_color, Position initial_position); 16 | 17 | void set_color(uint32_t color); 18 | uint32_t get_color() const; 19 | 20 | void set_position(Position position); 21 | Position get_position() const; 22 | 23 | private: 24 | uint32_t m_color{0xFFFFFF}; // Default to white color in hex 25 | Position m_position{0, 0}; // Default initialized anyway. 26 | }; -------------------------------------------------------------------------------- /12.Custom_types/02.Pixels_in_canvas/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | #include 5 | 6 | export module utilities; 7 | 8 | import canvas; 9 | 10 | export void canvas_demo(){ 11 | 12 | // Create a canvas and set a pixel at (5, 5) on the stack. 13 | /* 14 | raw::Canvas canvas{10, 10}; 15 | Pixel pixel(0xFF0000, Position{5, 5}); 16 | canvas.modify_pixel(5, 5, pixel); 17 | canvas.print(); 18 | */ 19 | 20 | 21 | //Use facilities in the modern namespace 22 | // Use the entities in the modern namespace 23 | auto canvas = std::make_unique(10, 10); 24 | auto pixel = std::make_unique(0xFF0000, Position{5, 5}); 25 | canvas->modify_pixel(5, 5, *pixel); 26 | //canvas->print(); 27 | 28 | fmt::println("Before copying"); 29 | auto canvas2 = std::make_unique(10, 10); 30 | canvas2->print(); 31 | fmt::println("After copying"); 32 | *canvas2 = *canvas; 33 | canvas2->print(); 34 | 35 | } -------------------------------------------------------------------------------- /12.Custom_types/02.Pixels_in_canvas/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /12.Custom_types/03.Move_semantics/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /12.Custom_types/03.Move_semantics/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Move semantics: 3 | .#1: Lvalues and rvalues 4 | 5 | .#2: Rvalue references 6 | 7 | .#3: Moving temporaries around 8 | 9 | .#4: Move constructor and move assignment operator 10 | 11 | .#5: Moving lvalues with std::move 12 | 13 | .#6: Invalidate pointers after move 14 | 15 | .#7: Move only types 16 | 17 | .#8: Passing by rvalue reference 18 | */ 19 | #include 20 | 21 | import utilities; 22 | 23 | 24 | 25 | int main(){ 26 | 27 | //move_semantics_01_demo(); 28 | //move_semantics_02_demo(); 29 | move_semantics_03_demo(); 30 | 31 | 32 | 33 | 34 | } -------------------------------------------------------------------------------- /12.Custom_types/03.Move_semantics/move_semantics_03.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | #include 5 | 6 | export module move_semantics_03; 7 | 8 | import canvas; 9 | 10 | namespace move_semantics_03 11 | { 12 | raw::Canvas make_canvas(std::size_t width, std::size_t height){ 13 | return raw::Canvas(width, height); 14 | } 15 | 16 | export void canvas_move_semantics_demo_1(){ 17 | std::vector canvases(3); 18 | 19 | for(size_t i{0} ; i < 3 ; ++i){ 20 | fmt::println("Iteration: {}", i); 21 | canvases[i] = make_canvas(10,10); 22 | fmt::println(""); 23 | } 24 | } 25 | 26 | 27 | export void canvas_move_semantics_demo_2(){ 28 | raw::Canvas c(10,10); 29 | c = make_canvas(20,20); 30 | 31 | raw::Canvas c2 (30,30); 32 | c = c2; 33 | fmt::println("All done."); 34 | } 35 | 36 | } // namespace move_semantics_03; 37 | -------------------------------------------------------------------------------- /12.Custom_types/03.Move_semantics/pixel.cpp: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | #include 5 | 6 | module pixel; 7 | 8 | 9 | Pixel::Pixel(uint32_t initial_color, Position initial_position) 10 | : m_color(initial_color), m_position(initial_position) 11 | { 12 | } 13 | 14 | 15 | void Pixel::set_color(uint32_t color) { 16 | if (color > 0xFFFFFFFF) { 17 | throw std::out_of_range("Invalid color value. Must be a 24-bit hex value."); 18 | } 19 | m_color = color; 20 | } 21 | 22 | uint32_t Pixel::get_color() const { 23 | return m_color; 24 | } 25 | 26 | void Pixel::set_position(Position pos) { 27 | m_position = pos; 28 | } 29 | 30 | Position Pixel::get_position() const { 31 | return m_position; 32 | } 33 | -------------------------------------------------------------------------------- /12.Custom_types/03.Move_semantics/pixel.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module pixel; 6 | 7 | export struct Position { 8 | unsigned int x{0}; 9 | unsigned int y{0}; 10 | }; 11 | 12 | export class Pixel { 13 | public: 14 | Pixel() = default; 15 | Pixel(uint32_t initial_color, Position initial_position); 16 | 17 | void set_color(uint32_t color); 18 | uint32_t get_color() const; 19 | 20 | void set_position(Position position); 21 | Position get_position() const; 22 | 23 | private: 24 | uint32_t m_color{0xFFFFFF}; // Default to white color in hex 25 | Position m_position{0, 0}; // Default initialized anyway. 26 | }; -------------------------------------------------------------------------------- /12.Custom_types/03.Move_semantics/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | export module utilities; 4 | 5 | import move_semantics_01; 6 | import move_semantics_02; 7 | import move_semantics_03; 8 | 9 | export void move_semantics_01_demo(){ 10 | move_semantics_01::try_out_move_semantics(); 11 | } 12 | 13 | 14 | export void move_semantics_02_demo(){ 15 | move_semantics_02::try_out_move_semantics(); 16 | } 17 | 18 | export void move_semantics_03_demo(){ 19 | //move_semantics_03::canvas_move_semantics_demo_1(); 20 | move_semantics_03::canvas_move_semantics_demo_2(); 21 | } -------------------------------------------------------------------------------- /12.Custom_types/03.Move_semantics/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /12.Custom_types/04.Class_members/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /12.Custom_types/04.Class_members/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp pixel.cpp canvas.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | pixel.ixx 25 | canvas.ixx 26 | ) 27 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /12.Custom_types/04.Class_members/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . More on class members: 3 | . static functions 4 | . static variables 5 | . const members 6 | . reference members 7 | */ 8 | 9 | import utilities; 10 | 11 | int main(){ 12 | 13 | static_functions_demo(); 14 | 15 | } -------------------------------------------------------------------------------- /12.Custom_types/04.Class_members/pixel.cpp: -------------------------------------------------------------------------------- 1 | module; 2 | #include 3 | 4 | module pixel; 5 | 6 | Pixel::Pixel(uint32_t initial_color, Position initial_position) 7 | : m_color(initial_color), m_position(initial_position) {} 8 | 9 | 10 | void Pixel::set_color(uint32_t color) { 11 | if (color > 0xFFFFFF) { 12 | throw std::out_of_range("Invalid color value. Must be a 24-bit hex value."); 13 | } 14 | m_color = color; 15 | } 16 | 17 | void Pixel::set_position(Position pos) { 18 | m_position = pos; 19 | } -------------------------------------------------------------------------------- /12.Custom_types/04.Class_members/pixel.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module pixel; 6 | 7 | export struct Position { 8 | unsigned int x{0}; 9 | unsigned int y{0}; 10 | }; 11 | 12 | export class Pixel { 13 | public: 14 | Pixel() = default; 15 | Pixel(uint32_t initial_color, Position initial_position); 16 | 17 | void set_color(uint32_t color); 18 | inline uint32_t get_color() const { return m_color; } 19 | 20 | void set_position(Position position); 21 | inline Position get_position() const{ return m_position; } 22 | 23 | private: 24 | uint32_t m_color{0xFFFFFF}; // Default to white color in hex 25 | Position m_position; 26 | }; -------------------------------------------------------------------------------- /12.Custom_types/04.Class_members/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module utilities; 6 | 7 | import canvas; 8 | 9 | export void static_functions_demo(){ 10 | 11 | //Before we introduce reference members 12 | raw::Configuration config1{ 800, 600, "My Canvas", false }; 13 | raw::Canvas canvas1 = raw::Canvas::create_default_canvas(config1); 14 | raw::Canvas canvas2= raw::Canvas::create_default_canvas(config1); 15 | raw::Canvas canvas3= raw::Canvas::create_default_canvas(config1); 16 | raw::Canvas canvas4 = raw::Canvas::create_default_canvas(config1); 17 | 18 | fmt::print("Total canvas count: {}\n", raw::Canvas::get_total_canvas_count()); 19 | 20 | //After we introduce reference members 21 | /* 22 | raw::Configuration config1{ 800, 600, "My Canvas", false }; 23 | raw::Canvas canvas1{ 10, 10, config1 }; 24 | //canvas1.print(); 25 | 26 | 27 | auto canvas2 = raw::Canvas::create_default_canvas(config1); 28 | canvas2.print(); 29 | */ 30 | 31 | 32 | 33 | fmt::println("Done."); 34 | 35 | 36 | } -------------------------------------------------------------------------------- /12.Custom_types/04.Class_members/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /12.Custom_types/05.Constexpr_custom_types/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /12.Custom_types/05.Constexpr_custom_types/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp) 19 | 20 | target_sources(${PROJECT_NAME} 21 | PUBLIC 22 | FILE_SET CXX_MODULES FILES 23 | utilities.ixx 24 | time.ixx 25 | ) 26 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -------------------------------------------------------------------------------- /12.Custom_types/05.Constexpr_custom_types/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Constexpr and consteval classes: 3 | 4 | . The requirement for a class to be constexpr is that it provides: 5 | . A constexpr constructor 6 | . Constexpr or consteval classes can have non constexpr member functions. 7 | . see the print_time() function in the Time24 class. 8 | . A constexpr function member function can't call a non-constexpr function. 9 | . fmt::println is not constexpr in the fmt library. 10 | . We can't call it from the print_time() function. 11 | . The definitions of constexpr or consteval functions must be available in 12 | the module interface file. If you put it in the implementation file, 13 | you may face issues. 14 | */ 15 | 16 | import utilities; 17 | 18 | int main(){ 19 | 20 | use_time_demo(); 21 | 22 | } -------------------------------------------------------------------------------- /12.Custom_types/05.Constexpr_custom_types/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module utilities; 6 | 7 | import time; 8 | 9 | export void use_time_demo(){ 10 | 11 | it_1::Time24 t1{12, 30}; // Run-time object 12 | fmt::print("Time: {:02}:{:02}\n", t1.get_hour(), t1.get_minute()); 13 | t1.add_minutes(45); 14 | fmt::print("Time: {:02}:{:02}\n", t1.get_hour(), t1.get_minute()); 15 | t1.add_hours(2); 16 | fmt::print("Time: {:02}:{:02}\n", t1.get_hour(), t1.get_minute()); 17 | 18 | 19 | constexpr it_1::Time24 t2{23, 59}; // Compile-time object 20 | fmt::print("Time: {:02}:{:02}\n", t2.get_hour(), t2.get_minute()); 21 | //t2.add_minutes(2); // This will not compile. constexpr implies const 22 | 23 | 24 | int scores [t2.get_hour()] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 25 | 26 | //t3 is from a consteval class 27 | it_2::Time24 t3{12, 30}; // Run-time object 28 | t3.add_minutes(45); // Error. conseval class can't be used to create run time objects, modifiable objects. 29 | 30 | } -------------------------------------------------------------------------------- /12.Custom_types/05.Constexpr_custom_types/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt" 6 | ], 7 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 8 | } -------------------------------------------------------------------------------- /12.Custom_types/06.Challenge_1/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /12.Custom_types/06.Challenge_1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp game.cpp) 19 | find_package(SFML COMPONENTS system window graphics audio CONFIG REQUIRED) 20 | 21 | target_sources(${PROJECT_NAME} 22 | PUBLIC 23 | FILE_SET CXX_MODULES FILES 24 | game.ixx 25 | ) 26 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt sfml-graphics) -------------------------------------------------------------------------------- /12.Custom_types/06.Challenge_1/game.cpp: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | module game; 6 | 7 | Game::Game() : window_{sf::VideoMode(800, 600), "Tetris"} {} 8 | 9 | void Game::run() 10 | { 11 | while (window_.isOpen()) { 12 | process_events(); // Handle user input 13 | render(); 14 | } 15 | } 16 | 17 | void Game::handle_key_press(sf::Keyboard::Key key) 18 | { 19 | if (key == sf::Keyboard::K) { 20 | fmt::println("K key pressed!"); 21 | } 22 | } 23 | 24 | void Game::process_events() 25 | { 26 | sf::Event event; 27 | while (window_.pollEvent(event)) { 28 | switch (event.type) { 29 | case sf::Event::Closed: 30 | window_.close(); 31 | break; 32 | case sf::Event::KeyPressed: 33 | handle_key_press(event.key.code); 34 | break; 35 | default: 36 | break; 37 | } 38 | } 39 | } 40 | 41 | 42 | void Game::render(){ 43 | window_.clear(sf::Color::Green); 44 | window_.display(); 45 | } -------------------------------------------------------------------------------- /12.Custom_types/06.Challenge_1/game.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module game; 6 | export class Game { 7 | public: 8 | Game(); 9 | void run(); 10 | 11 | private: 12 | void handle_key_press(sf::Keyboard::Key key); 13 | void process_events(); 14 | void render(); 15 | 16 | sf::RenderWindow window_; 17 | }; -------------------------------------------------------------------------------- /12.Custom_types/06.Challenge_1/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Organize a basic SFML application into classes. 3 | */ 4 | 5 | import game; 6 | 7 | int main(){ 8 | Game game; 9 | game.run(); 10 | 11 | } -------------------------------------------------------------------------------- /12.Custom_types/06.Challenge_1/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /12.Custom_types/07.Challenge_2/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /12.Custom_types/07.Challenge_2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | 13 | find_package(fmt CONFIG REQUIRED) 14 | find_package(SFML COMPONENTS system window graphics audio CONFIG REQUIRED) 15 | 16 | #We're using the project name as the target name, but you can change it to make them different. 17 | #With this setup, the name of the executable will be the same as the project name. 18 | add_executable(${PROJECT_NAME} main.cpp game.cpp) 19 | 20 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt sfml-graphics) -------------------------------------------------------------------------------- /12.Custom_types/07.Challenge_2/game.cpp: -------------------------------------------------------------------------------- 1 | #include "game.h" 2 | #include 3 | 4 | Game::Game() : window_{sf::VideoMode(800, 600), "Tetris"} {} 5 | 6 | void Game::run() 7 | { 8 | while (window_.isOpen()) { 9 | process_events(); // Handle user input 10 | render(); 11 | } 12 | } 13 | 14 | void Game::handle_key_press(sf::Keyboard::Key key) 15 | { 16 | if (key == sf::Keyboard::K) { 17 | fmt::println("K key pressed!"); 18 | } 19 | } 20 | 21 | void Game::process_events() 22 | { 23 | sf::Event event; 24 | while (window_.pollEvent(event)) { 25 | switch (event.type) { 26 | case sf::Event::Closed: 27 | window_.close(); 28 | break; 29 | case sf::Event::KeyPressed: 30 | handle_key_press(event.key.code); 31 | break; 32 | default: 33 | break; 34 | } 35 | } 36 | } 37 | 38 | 39 | void Game::render(){ 40 | window_.clear(sf::Color::Green); 41 | window_.display(); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /12.Custom_types/07.Challenge_2/game.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | class Game { 5 | public: 6 | Game(); 7 | void run(); 8 | 9 | private: 10 | void handle_key_press(sf::Keyboard::Key key); 11 | void process_events(); 12 | void render(); 13 | 14 | sf::RenderWindow window_; 15 | }; -------------------------------------------------------------------------------- /12.Custom_types/07.Challenge_2/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Organize the basic SFML application using the header based compilation model 3 | */ 4 | 5 | #include "game.h" 6 | 7 | int main() { 8 | Game game; 9 | game.run(); 10 | } -------------------------------------------------------------------------------- /12.Custom_types/07.Challenge_2/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /12.Custom_types/08.Challenge_3/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /12.Custom_types/08.Challenge_3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | find_package(fmt CONFIG REQUIRED) 15 | find_package(SFML COMPONENTS system window graphics audio CONFIG REQUIRED) 16 | 17 | #We're using the project name as the target name, but you can change it to make them different. 18 | #With this setup, the name of the executable will be the same as the project name. 19 | add_executable(${PROJECT_NAME} main.cpp) 20 | 21 | target_sources(${PROJECT_NAME} 22 | PUBLIC 23 | FILE_SET CXX_MODULES FILES 24 | utilities.ixx 25 | board.ixx 26 | ) 27 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt sfml-graphics) -------------------------------------------------------------------------------- /12.Custom_types/08.Challenge_3/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . A board that acts as a starting point for a Tetris game. 3 | . Board class represents the grid data. 4 | . BoardEntity class handles the graphical representation of the board. 5 | . We wire up everything in the main function. 6 | */ 7 | import utilities; 8 | 9 | int main(){ 10 | app(); 11 | 12 | } -------------------------------------------------------------------------------- /12.Custom_types/08.Challenge_3/utilities.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module utilities; 6 | 7 | import board; 8 | 9 | void handleInput(sf::RenderWindow& window) { 10 | sf::Event event; 11 | while (window.pollEvent(event)) { 12 | if (event.type == sf::Event::Closed) { 13 | window.close(); 14 | } 15 | } 16 | } 17 | 18 | export void app(){ 19 | 20 | sf::RenderWindow window(sf::VideoMode(Board::WIDTH * Board::BLOCK_SIZE, 21 | Board::HEIGHT * Board::BLOCK_SIZE), 22 | "Tetris"); 23 | Board board; 24 | board.initialize(); 25 | BoardEntity entity(board); 26 | 27 | while ((window.isOpen())) 28 | { 29 | handleInput(window); 30 | window.clear(); 31 | entity.draw(window); 32 | window.display(); 33 | } 34 | } -------------------------------------------------------------------------------- /12.Custom_types/08.Challenge_3/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /13.Project_tetris/01.Tetromino/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /13.Project_tetris/01.Tetromino/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . A board that acts as a starting point for a Tetris game. 3 | . Board class represents the grid data. 4 | . BoardEntity class handles the graphical representation of the board. 5 | . We wire up everything in the main function. 6 | */ 7 | import utilities; 8 | 9 | int main(){ 10 | app(); 11 | 12 | } -------------------------------------------------------------------------------- /13.Project_tetris/01.Tetromino/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /13.Project_tetris/02.Movement/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /13.Project_tetris/02.Movement/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . A board that acts as a starting point for a Tetris game. 3 | . Board class represents the grid data. 4 | . BoardEntity class handles the graphical representation of the board. 5 | . We wire up everything in the main function. 6 | */ 7 | import utilities; 8 | 9 | int main(){ 10 | app(); 11 | 12 | } -------------------------------------------------------------------------------- /13.Project_tetris/02.Movement/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /13.Project_tetris/03.Next_piece_preview/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /13.Project_tetris/03.Next_piece_preview/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /13.Project_tetris/04.Score_mechanism/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /13.Project_tetris/04.Score_mechanism/arial.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/13.Project_tetris/04.Score_mechanism/arial.ttf -------------------------------------------------------------------------------- /13.Project_tetris/04.Score_mechanism/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This project adds the following: 3 | . Line clearing 4 | . Done in the game loop in the falling logic: 5 | // Clear lines and update score 6 | int lines = board.clear_complete_lines(); 7 | score += lines * 100; // 100 points per line 8 | . Score keeping 9 | . Game over detection 10 | . Visual feedback when game over and score 11 | */ 12 | import utilities; 13 | 14 | int main(){ 15 | app(); 16 | } -------------------------------------------------------------------------------- /13.Project_tetris/04.Score_mechanism/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /13.Project_tetris/05.Structure/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /13.Project_tetris/05.Structure/arial.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/13.Project_tetris/05.Structure/arial.ttf -------------------------------------------------------------------------------- /13.Project_tetris/05.Structure/board_entity.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module board_entity; 6 | 7 | import board; 8 | 9 | export class BoardEntity { 10 | public: 11 | explicit BoardEntity(const Board& board) : board_(board) {} 12 | 13 | void draw(sf::RenderWindow& window) const { 14 | sf::RectangleShape block(sf::Vector2f(Board::BLOCK_SIZE, Board::BLOCK_SIZE)); 15 | block.setOutlineColor(sf::Color::White); 16 | block.setOutlineThickness(1.0f); 17 | 18 | auto grid = board_.get_grid(); 19 | for (int y = 0; y < Board::HEIGHT; ++y) { 20 | for (int x = 0; x < Board::WIDTH; ++x) { 21 | block.setPosition(x * Board::BLOCK_SIZE, y * Board::BLOCK_SIZE); 22 | block.setFillColor(Board::BLOCK_COLORS[grid[y][x]]); 23 | window.draw(block); 24 | } 25 | } 26 | } 27 | 28 | private: 29 | const Board& board_; 30 | }; -------------------------------------------------------------------------------- /13.Project_tetris/05.Structure/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Extract some noisy code from the utilities module into some classes: 3 | . Game 4 | . GameState 5 | . BoardEntity 6 | */ 7 | import game; 8 | 9 | int main(){ 10 | Game game; 11 | game.run(); 12 | return 0; 13 | } -------------------------------------------------------------------------------- /13.Project_tetris/05.Structure/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } -------------------------------------------------------------------------------- /13.Project_tetris/06.Subdirs/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Binaries and shortcuts 2 | *.exe 3 | *.lnk 4 | *.AppImage 5 | 6 | # Autogenerated files 7 | 8 | # dlls needed to run the binary 9 | *.dll 10 | 11 | # Build Directories and toolchain-generated files 12 | build/ 13 | obj/ 14 | bin/ 15 | lib/ 16 | x64/ 17 | Debug/ 18 | install/ 19 | Release/ 20 | *.layout 21 | *.depend 22 | scons-local* 23 | .sconsign.dblite 24 | /*.d 25 | /vcpkg/ 26 | 27 | # Test Reports 28 | test-report.xml 29 | 30 | # User-installed plugins 31 | /plugins/ 32 | 33 | # OS-specific generated files 34 | .DS_Store 35 | *.db 36 | 37 | # IDEs (no support implied) 38 | .cache 39 | .devcontainer 40 | .vscode 41 | .vs 42 | .metadata 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | *.sap 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | *.VC.db 55 | *.VC.VC.opendb 56 | *.suo 57 | *.sln 58 | *.vcxproj* 59 | *.userosscache 60 | *.sln.docstates 61 | *.xcodeproj/** 62 | .idea/ 63 | .idea_modules/ 64 | compile_commands.json 65 | CMakeUserPresets.json 66 | .gitmodules 67 | 68 | # static code analysis 69 | /.scannerwork -------------------------------------------------------------------------------- /13.Project_tetris/06.Subdirs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #The root CMakeLists.txt file. 2 | cmake_minimum_required(VERSION 3.28) 3 | 4 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") 5 | 6 | #The project name is set here. In this case it's Rocket, but you can change it to whatever you want. 7 | project(Rocket VERSION 1.0.0 LANGUAGES CXX) 8 | 9 | #Require C++23 10 | set(CXX_STANDARD_REQUIRED ON) #Make C++23 a hard requirement 11 | set(CMAKE_CXX_STANDARD 23) # Default C++ standard for targets 12 | set(CMAKE_CXX_SCAN_FOR_MODULES ON) 13 | 14 | add_subdirectory(src) 15 | 16 | -------------------------------------------------------------------------------- /13.Project_tetris/06.Subdirs/arial.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rutura/cpp23m/dcf17cdda130c0dd1af67973eec8c9580f03606b/13.Project_tetris/06.Subdirs/arial.ttf -------------------------------------------------------------------------------- /13.Project_tetris/06.Subdirs/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(fmt CONFIG REQUIRED) 2 | find_package(SFML COMPONENTS system window graphics audio CONFIG REQUIRED) 3 | 4 | #We're using the project name as the target name, but you can change it to make them different. 5 | #With this setup, the name of the executable will be the same as the project name. 6 | add_executable(${PROJECT_NAME} main.cpp) 7 | 8 | target_sources(${PROJECT_NAME} 9 | PUBLIC 10 | FILE_SET CXX_MODULES FILES 11 | utils/utilities.ixx 12 | board/board.ixx 13 | board/board_entity.ixx 14 | pieces/tetromino.ixx 15 | game/gamestate.ixx 16 | game/game.ixx 17 | ) 18 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt sfml-graphics) -------------------------------------------------------------------------------- /13.Project_tetris/06.Subdirs/src/board/board_entity.ixx: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | #include 4 | 5 | export module board_entity; 6 | 7 | import board; 8 | 9 | export class BoardEntity { 10 | public: 11 | explicit BoardEntity(const Board& board) : board_(board) {} 12 | 13 | void draw(sf::RenderWindow& window) const { 14 | sf::RectangleShape block(sf::Vector2f(Board::BLOCK_SIZE, Board::BLOCK_SIZE)); 15 | block.setOutlineColor(sf::Color::White); 16 | block.setOutlineThickness(1.0f); 17 | 18 | auto grid = board_.get_grid(); 19 | for (int y = 0; y < Board::HEIGHT; ++y) { 20 | for (int x = 0; x < Board::WIDTH; ++x) { 21 | block.setPosition(x * Board::BLOCK_SIZE, y * Board::BLOCK_SIZE); 22 | block.setFillColor(Board::BLOCK_COLORS[grid[y][x]]); 23 | window.draw(block); 24 | } 25 | } 26 | } 27 | 28 | private: 29 | const Board& board_; 30 | }; -------------------------------------------------------------------------------- /13.Project_tetris/06.Subdirs/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | . Extract some noisy code from the utilities module into some classes: 3 | . Game 4 | . GameState 5 | . BoardEntity 6 | */ 7 | import game; 8 | 9 | int main(){ 10 | Game game; 11 | game.run(); 12 | return 0; 13 | } -------------------------------------------------------------------------------- /13.Project_tetris/06.Subdirs/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rocket", 3 | "version": "0.1.0", 4 | "dependencies": [ 5 | "fmt", 6 | "sfml" 7 | ], 8 | "builtin-baseline": "4e08971f3ddc13018ca858a692efe92d3b6b9fce" 9 | } --------------------------------------------------------------------------------