Compare commits
	
		
			3 commits
		
	
	
		
			
				7d1a0473ff
			
			...
			
				3e65ac5fe9
			
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3e65ac5fe9 | |||
| 8dbf55d5d2 | |||
| 2755f4827e | 
					 28 changed files with 6148 additions and 5837 deletions
				
			
		|  | @ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.19 FATAL_ERROR) | |||
| 
 | ||||
| project(UnitTest CXX) | ||||
| 
 | ||||
| include(../external/catch2/contrib/Catch.cmake) | ||||
| include(../external/catch2/extras/Catch.cmake) | ||||
| 
 | ||||
| add_executable(UnitTest adummy.cpp characteristics_tests.cpp) | ||||
| 
 | ||||
|  | @ -17,7 +17,7 @@ target_include_directories(UnitTest PRIVATE ${CMAKE_SOURCE_DIR}/include) | |||
| target_compile_definitions(UnitTest PRIVATE ${DEF_COMP}) | ||||
| target_compile_options(UnitTest PRIVATE ${COMPILE_FLAGS}) | ||||
| target_link_options(UnitTest PRIVATE ${LINKER_OPTIONS}) | ||||
| target_link_libraries(UnitTest ${LINKER_FLAGS} Catch2 nlohmann_json::nlohmann_json) | ||||
| target_link_libraries(UnitTest ${LINKER_FLAGS} Catch2::Catch2WithMain nlohmann_json::nlohmann_json) | ||||
| 
 | ||||
| enable_testing() | ||||
| catch_discover_tests(UnitTest WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} REPORTER junit OUTPUT_DIR ${CMAKE_SOURCE_DIR} OUTPUT_PREFIX cppspec- OUTPUT_SUFFIX .xml) | ||||
|  |  | |||
|  | @ -1,2 +1,3 @@ | |||
| #define CATCH_CONFIG_MAIN | ||||
| #include <catch2/catch.hpp> | ||||
| 
 | ||||
| #include <catch2/catch_all.hpp> | ||||
|  | @ -1,4 +1,4 @@ | |||
| #include <catch2/catch.hpp> | ||||
| #include <catch2/catch_all.hpp> | ||||
| #include "characteristic/adresse.hpp" | ||||
| #include "characteristic/chance.hpp" | ||||
| #include "characteristic/endurance.hpp" | ||||
|  |  | |||
							
								
								
									
										2
									
								
								external/catch2
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								external/catch2
									
										
									
									
										vendored
									
									
								
							|  | @ -1 +1 @@ | |||
| Subproject commit 216713a4066b79d9803d374f261ccb30c0fb451f | ||||
| Subproject commit 05e10dfccc28c7f973727c54f850237d07d5e10f | ||||
							
								
								
									
										2
									
								
								external/glfw
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								external/glfw
									
										
									
									
										vendored
									
									
								
							|  | @ -1 +1 @@ | |||
| Subproject commit 7d5a16ce714f0b5f4efa3262de22e4d948851525 | ||||
| Subproject commit e2c92645460f680fd272fd2eed591efb2be7dc31 | ||||
							
								
								
									
										2
									
								
								external/json
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								external/json
									
										
									
									
										vendored
									
									
								
							|  | @ -1 +1 @@ | |||
| Subproject commit 4f8fba14066156b73f1189a2b8bd568bde5284c5 | ||||
| Subproject commit 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03 | ||||
							
								
								
									
										2
									
								
								external/spdlog
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								external/spdlog
									
										
									
									
										vendored
									
									
								
							|  | @ -1 +1 @@ | |||
| Subproject commit eb3220622e73a4889eee355ffa37972b3cac3df5 | ||||
| Subproject commit 7c02e204c92545f869e2f04edaab1f19fe8b19fd | ||||
|  | @ -12,7 +12,7 @@ namespace gui { | |||
| } | ||||
| 
 | ||||
| namespace character { | ||||
| 	enum class classe : std::uint32_t { | ||||
|     enum class classe : std::uint8_t { | ||||
|         Guerrier = 0, | ||||
|         Prudent = 1, | ||||
|         Paysan = 2, | ||||
|  | @ -51,6 +51,14 @@ namespace character { | |||
|     public: | ||||
|         CharacterSheet() = default; | ||||
| 
 | ||||
|         CharacterSheet(const CharacterSheet &sheet) noexcept = default; | ||||
| 
 | ||||
|         CharacterSheet(CharacterSheet &&sheet) noexcept = default; | ||||
| 
 | ||||
|         CharacterSheet &operator=(const CharacterSheet &characterSheet) noexcept = default; | ||||
| 
 | ||||
|         CharacterSheet &operator=(CharacterSheet &&characterSheet) noexcept = default; | ||||
| 
 | ||||
|         ~CharacterSheet() noexcept = default; | ||||
| 
 | ||||
|         [[nodiscard]] const std::string &get_caractere() const { return caractere; } | ||||
|  |  | |||
|  | @ -17,7 +17,10 @@ namespace character::characteristic { | |||
|     public: | ||||
|         Characteristic() noexcept = default; | ||||
| 
 | ||||
| 		Characteristic(const std::uint32_t base, const std::uint32_t carac, const std::uint32_t materiel, const std::uint32_t additional) noexcept: | ||||
|         Characteristic(const std::uint32_t base, | ||||
|                        const std::uint32_t carac, | ||||
|                        const std::uint32_t materiel, | ||||
|                        const std::uint32_t additional) noexcept: | ||||
|                 base(base), carac(carac), materiel(materiel), additional(additional) {} | ||||
| 
 | ||||
|         Characteristic(const Characteristic &charac) noexcept = default; | ||||
|  |  | |||
|  | @ -17,7 +17,8 @@ private: | |||
| public: | ||||
|     Controller() = delete; | ||||
| 
 | ||||
| 	explicit Controller(character::CharacterSheet &sheet, gui::menu::MenuData &menuData) : sheet(sheet), menu_data(menuData) {} | ||||
|     explicit Controller(character::CharacterSheet &sheet, gui::menu::MenuData &menuData) : | ||||
|             sheet(sheet), menu_data(menuData) {} | ||||
| 
 | ||||
|     ~Controller() noexcept = default; | ||||
| 
 | ||||
|  |  | |||
|  | @ -36,9 +36,11 @@ namespace gui::menu { | |||
| 
 | ||||
|         [[nodiscard]] bool is_edit_mode() const { return edit_mode; } | ||||
| 
 | ||||
| 		void set_save_path([[maybe_unused]] const Controller &controller, const fs::path &savePath) const { save_path = savePath; } | ||||
|         void set_save_path([[maybe_unused]] const Controller &controller, | ||||
|                            const fs::path &savePath) const { save_path = savePath; } | ||||
| 
 | ||||
| 		void set_filename([[maybe_unused]] const Controller &controller, const std::string &fileName) const { filename = fileName; } | ||||
|         void set_filename([[maybe_unused]] const Controller &controller, | ||||
|                           const std::string &fileName) const { filename = fileName; } | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -23,7 +23,8 @@ namespace gui { | |||
| 
 | ||||
|         ~Window() noexcept = default; | ||||
| 
 | ||||
| 		[[nodiscard]] const std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)> &get_window() const { return wwindow; } | ||||
|         [[nodiscard]] const std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)> & | ||||
|         get_window() const { return wwindow; } | ||||
| 
 | ||||
|         [[nodiscard]] bool should_close() const noexcept; | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										1541
									
								
								include/stb_image.h
									
										
									
									
									
								
							
							
						
						
									
										1541
									
								
								include/stb_image.h
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -8,7 +8,8 @@ | |||
| #include "character_sheet.hpp" | ||||
| #include "controller.hpp" | ||||
| 
 | ||||
| gui::Gui::Gui(Window &window, GuiData &data, menu::MenuData &menuData) : data(data), menu(menuData), font("font/DejaVuSans.ttf") { | ||||
| gui::Gui::Gui(Window &window, GuiData &data, menu::MenuData &menuData) : | ||||
|         data(data), menu(menuData), font("font/DejaVuSans.ttf") { | ||||
|     SPDLOG_DEBUG("Creating GUI"); | ||||
|     (void) ImGui::CreateContext(); | ||||
|     ImGui::StyleColorsDark(); | ||||
|  | @ -116,13 +117,16 @@ void gui::Gui::habilete_menu() noexcept { | |||
|     ImGui::BeginChild("habilete", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), true); | ||||
|     ImGui::Text("Habileté"); | ||||
|     data.base.second = data.billy.get_habilete().get_base(); | ||||
| 	data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Habilete : characChanged::None; | ||||
|     data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Habilete | ||||
|                                                                                           : characChanged::None; | ||||
| 
 | ||||
|     data.carac.second = data.billy.get_habilete().get_carac(); | ||||
| 	data.carac.first = ImGui::InputInt("Carac", reinterpret_cast<int *>(&data.carac.second)) ? characChanged::Habilete : characChanged::None; | ||||
|     data.carac.first = ImGui::InputInt("Carac", reinterpret_cast<int *>(&data.carac.second)) ? characChanged::Habilete | ||||
|                                                                                              : characChanged::None; | ||||
| 
 | ||||
|     data.materiel.second = data.billy.get_habilete().get_materiel(); | ||||
| 	data.materiel.first = ImGui::InputInt("Matériel", reinterpret_cast<int *>(&data.materiel.second)) ? characChanged::Habilete : characChanged::None; | ||||
|     data.materiel.first = ImGui::InputInt("Matériel", reinterpret_cast<int *>(&data.materiel.second)) | ||||
|                           ? characChanged::Habilete : characChanged::None; | ||||
| 
 | ||||
|     data.additional.second = data.billy.get_habilete().get_additional(); | ||||
|     data.additional.first = ImGui::InputInt("Additionnel", reinterpret_cast<int *>(&data.additional.second)) ? | ||||
|  | @ -135,13 +139,16 @@ void gui::Gui::adresse_menu() noexcept { | |||
|     ImGui::BeginChild("adresse", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), true); | ||||
|     ImGui::Text("Adresse"); | ||||
|     data.base.second = data.billy.get_adresse().get_base(); | ||||
| 	data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Adresse : characChanged::None; | ||||
|     data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Adresse | ||||
|                                                                                           : characChanged::None; | ||||
| 
 | ||||
|     data.carac.second = data.billy.get_adresse().get_carac(); | ||||
| 	data.carac.first = ImGui::InputInt("Carac", reinterpret_cast<int *>(&data.carac.second)) ? characChanged::Adresse : characChanged::None; | ||||
|     data.carac.first = ImGui::InputInt("Carac", reinterpret_cast<int *>(&data.carac.second)) ? characChanged::Adresse | ||||
|                                                                                              : characChanged::None; | ||||
| 
 | ||||
|     data.materiel.second = data.billy.get_adresse().get_materiel(); | ||||
| 	data.materiel.first = ImGui::InputInt("Matériel", reinterpret_cast<int *>(&data.materiel.second)) ? characChanged::Adresse : characChanged::None; | ||||
|     data.materiel.first = ImGui::InputInt("Matériel", reinterpret_cast<int *>(&data.materiel.second)) | ||||
|                           ? characChanged::Adresse : characChanged::None; | ||||
| 
 | ||||
|     data.additional.second = data.billy.get_adresse().get_additional(); | ||||
|     data.additional.first = ImGui::InputInt("Additionnel", reinterpret_cast<int *>(&data.additional.second)) ? | ||||
|  | @ -155,10 +162,12 @@ void gui::Gui::endurance_menu() noexcept { | |||
|     ImGui::Text("Endurance"); | ||||
| 
 | ||||
|     data.base.second = data.billy.get_endurance().get_base(); | ||||
| 	data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Endurance : characChanged::None; | ||||
|     data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Endurance | ||||
|                                                                                           : characChanged::None; | ||||
| 
 | ||||
|     data.carac.second = data.billy.get_endurance().get_carac(); | ||||
| 	data.carac.first = ImGui::InputInt("Carac", reinterpret_cast<int *>(&data.carac.second)) ? characChanged::Endurance : characChanged::None; | ||||
|     data.carac.first = ImGui::InputInt("Carac", reinterpret_cast<int *>(&data.carac.second)) ? characChanged::Endurance | ||||
|                                                                                              : characChanged::None; | ||||
| 
 | ||||
|     data.materiel.second = data.billy.get_endurance().get_materiel(); | ||||
|     data.materiel.first = ImGui::InputInt("Matériel", reinterpret_cast<int *>(&data.materiel.second)) ? | ||||
|  | @ -176,13 +185,16 @@ void gui::Gui::chance_menu() noexcept { | |||
|     ImGui::BeginChild("chance", ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f), true); | ||||
|     ImGui::Text("Chance"); | ||||
|     data.base.second = data.billy.get_chance().get_base(); | ||||
| 	data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Chance : characChanged::None; | ||||
|     data.base.first = ImGui::InputInt("Base", reinterpret_cast<int *>(&data.base.second)) ? characChanged::Chance | ||||
|                                                                                           : characChanged::None; | ||||
| 
 | ||||
|     data.carac.second = data.billy.get_chance().get_carac(); | ||||
| 	data.carac.first = ImGui::InputInt("Carac", reinterpret_cast<int *>(&data.carac.second)) ? characChanged::Chance : characChanged::None; | ||||
|     data.carac.first = ImGui::InputInt("Carac", reinterpret_cast<int *>(&data.carac.second)) ? characChanged::Chance | ||||
|                                                                                              : characChanged::None; | ||||
| 
 | ||||
|     data.materiel.second = data.billy.get_chance().get_materiel(); | ||||
| 	data.materiel.first = ImGui::InputInt("Matériel", reinterpret_cast<int *>(&data.materiel.second)) ? characChanged::Chance : characChanged::None; | ||||
|     data.materiel.first = ImGui::InputInt("Matériel", reinterpret_cast<int *>(&data.materiel.second)) | ||||
|                           ? characChanged::Chance : characChanged::None; | ||||
| 
 | ||||
|     data.additional.second = data.billy.get_chance().get_additional(); | ||||
|     data.additional.first = ImGui::InputInt("Additionnel", reinterpret_cast<int *>(&data.additional.second)) ? | ||||
|  |  | |||
|  | @ -40,7 +40,9 @@ void gui::menu::Menu::gui() const noexcept { | |||
|         if (ImGui::BeginMenu("File")) { | ||||
|             if (ImGui::MenuItem("Open file")) { | ||||
|                 SPDLOG_DEBUG("Opening file"); | ||||
| 				ifd::FileDialog::Instance().Open(data.open_character_key, "Open a character sheet", "Character sheet (*.json){.json},.*"); | ||||
|                 ifd::FileDialog::Instance().Open(data.open_character_key, | ||||
|                                                  "Open a character sheet", | ||||
|                                                  "Character sheet (*.json){.json},.*"); | ||||
|                 SPDLOG_DEBUG("File opened"); | ||||
|             } | ||||
| 
 | ||||
|  | @ -54,7 +56,9 @@ void gui::menu::Menu::gui() const noexcept { | |||
| 
 | ||||
|             if (ImGui::MenuItem("Save as...")) { | ||||
|                 SPDLOG_DEBUG("Saving with file dialog"); | ||||
| 				ifd::FileDialog::Instance().Save(data.save_character_key, "Save character sheet as...", "*.json {.json}"); | ||||
|                 ifd::FileDialog::Instance().Save(data.save_character_key, | ||||
|                                                  "Save character sheet as...", | ||||
|                                                  "*.json {.json}"); | ||||
|                 SPDLOG_DEBUG("File saved with dialog"); | ||||
|             } | ||||
| 
 | ||||
|  |  | |||
|  | @ -20,7 +20,11 @@ gui::Window::Window() { | |||
|     } | ||||
|     glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); | ||||
|     glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); | ||||
| 	wwindow = std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)>(glfwCreateWindow(720, 1280, "Billy Sheet tracker", nullptr, nullptr), | ||||
|     wwindow = std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)>(glfwCreateWindow(720, | ||||
|                                                                                           1280, | ||||
|                                                                                           "Billy Sheet tracker", | ||||
|                                                                                           nullptr, | ||||
|                                                                                           nullptr), | ||||
|                                                                          delete_glfw_window); | ||||
|     if (!wwindow) { | ||||
|         glfwTerminate(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue