Compare commits
	
		
			6 commits
		
	
	
		
			
				9d5971e23a
			
			...
			
				a164593cd8
			
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
							
							
								
							
							
	
	
		
			
		
	
	a164593cd8 | 
						
						
							|||
| 
							
							
								
							
							
	
	
		
			
		
	
	e6bec5c0f2 | 
						
						
							|||
| 
							
							
								
							
							
	
	
		
			
		
	
	6e50ef7fb8 | 
						
						
							|||
| 
							
							
								
							
							
	
	
		
			
		
	
	fc37d107e0 | 
						
						
							|||
| 
							
							
								
							
							
	
	
		
			
		
	
	7ee5899e31 | 
						
						
							|||
| 
							
							
								
							
							
	
	
		
			
		
	
	371fbcb04d | 
						
						
							
					 11 changed files with 130 additions and 122 deletions
				
			
		
							
								
								
									
										3
									
								
								.gitmodules
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitmodules
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -13,3 +13,6 @@
 | 
				
			||||||
[submodule "external/ImFileDialog"]
 | 
					[submodule "external/ImFileDialog"]
 | 
				
			||||||
	path = external/ImFileDialog
 | 
						path = external/ImFileDialog
 | 
				
			||||||
	url = https://github.com/dfranx/ImFileDialog.git
 | 
						url = https://github.com/dfranx/ImFileDialog.git
 | 
				
			||||||
 | 
					[submodule "external/svector"]
 | 
				
			||||||
 | 
						path = external/svector
 | 
				
			||||||
 | 
						url = https://github.com/martinus/svector.git
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,6 +35,8 @@ else ()
 | 
				
			||||||
    message(STATUS "ccache not found")
 | 
					    message(STATUS "ccache not found")
 | 
				
			||||||
endif ()
 | 
					endif ()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					add_subdirectory(external/svector)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
 | 
					option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
 | 
				
			||||||
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF)
 | 
					option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF)
 | 
				
			||||||
option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF)
 | 
					option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF)
 | 
				
			||||||
| 
						 | 
					@ -104,7 +106,7 @@ add_executable(BillySheet ${SOURCES})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target_include_directories(BillySheet PRIVATE include include/imgui external/ImFileDialog)
 | 
					target_include_directories(BillySheet PRIVATE include include/imgui external/ImFileDialog)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_target_properties(BillySheet spdlog PROPERTIES
 | 
					set_target_properties(BillySheet spdlog svector PROPERTIES
 | 
				
			||||||
                      CXX_STANDARD 17
 | 
					                      CXX_STANDARD 17
 | 
				
			||||||
                      CXX_STANDARD_REQUIRED ON
 | 
					                      CXX_STANDARD_REQUIRED ON
 | 
				
			||||||
                      CXX_EXTENSIONS OFF
 | 
					                      CXX_EXTENSIONS OFF
 | 
				
			||||||
| 
						 | 
					@ -112,7 +114,7 @@ set_target_properties(BillySheet spdlog PROPERTIES
 | 
				
			||||||
                      # UNITY_BUILD ON
 | 
					                      # UNITY_BUILD ON
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_target_properties(spdlog PROPERTIES UNITY_BUILD ON)
 | 
					set_target_properties(spdlog svector PROPERTIES UNITY_BUILD ON)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_target_properties(glfw PROPERTIES
 | 
					set_target_properties(glfw PROPERTIES
 | 
				
			||||||
                      C_STANDARD 11
 | 
					                      C_STANDARD 11
 | 
				
			||||||
| 
						 | 
					@ -122,27 +124,35 @@ set_target_properties(glfw PROPERTIES
 | 
				
			||||||
                      UNITY_BUILD ON
 | 
					                      UNITY_BUILD ON
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_target_properties(spdlog PROPERTIES UNITY_BUILD ON)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
target_compile_definitions(BillySheet PRIVATE
 | 
					target_compile_definitions(BillySheet PRIVATE
 | 
				
			||||||
                           $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>
 | 
					                           $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>
 | 
				
			||||||
                           $<$<CONFIG:Debug>:SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG>
 | 
					                           $<$<CONFIG:Debug>:SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG>
 | 
				
			||||||
                           $<$<CONFIG:Release>:SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_ERROR>)
 | 
					                           $<$<CONFIG:Release>:SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_ERROR>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target_compile_definitions(spdlog PRIVATE
 | 
					target_compile_definitions(spdlog PRIVATE $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
 | 
				
			||||||
                           $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
 | 
					target_compile_definitions(svector INTERFACE $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
 | 
				
			||||||
 | 
					target_compile_definitions(glfw PRIVATE $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
 | 
				
			||||||
target_compile_definitions(glfw PRIVATE
 | 
					 | 
				
			||||||
                           $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
target_compile_options(spdlog PRIVATE ${COMPILE_FLAGS})
 | 
					target_compile_options(spdlog PRIVATE ${COMPILE_FLAGS})
 | 
				
			||||||
 | 
					target_compile_options(svector INTERFACE ${COMPILE_FLAGS})
 | 
				
			||||||
target_compile_options(glfw PRIVATE ${COMPILE_FLAGS})
 | 
					target_compile_options(glfw PRIVATE ${COMPILE_FLAGS})
 | 
				
			||||||
target_compile_options(BillySheet PRIVATE ${COMPILE_FLAGS})
 | 
					target_compile_options(BillySheet PRIVATE ${COMPILE_FLAGS})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target_link_options(spdlog PRIVATE ${LINKER_OPTIONS})
 | 
					target_link_options(spdlog PRIVATE ${LINKER_OPTIONS})
 | 
				
			||||||
 | 
					target_link_options(svector INTERFACE ${LINKER_OPTIONS})
 | 
				
			||||||
target_link_options(glfw PRIVATE ${LINKER_OPTIONS})
 | 
					target_link_options(glfw PRIVATE ${LINKER_OPTIONS})
 | 
				
			||||||
target_link_options(BillySheet PRIVATE ${LINKER_OPTIONS})
 | 
					target_link_options(BillySheet PRIVATE ${LINKER_OPTIONS})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target_link_libraries(spdlog PRIVATE ${LINKER_FLAGS})
 | 
					target_link_libraries(spdlog PRIVATE ${LINKER_FLAGS})
 | 
				
			||||||
 | 
					target_link_libraries(svector INTERFACE ${LINKER_FLAGS})
 | 
				
			||||||
target_link_libraries(glfw PRIVATE ${LINKER_FLAGS})
 | 
					target_link_libraries(glfw PRIVATE ${LINKER_FLAGS})
 | 
				
			||||||
target_link_libraries(BillySheet glfw spdlog::spdlog_header_only OpenGL::OpenGL GLEW::GLEW nlohmann_json::nlohmann_json ${Boost_LIBRARIES} ${LINKER_FLAGS})
 | 
					target_link_libraries(BillySheet glfw
 | 
				
			||||||
 | 
					                      spdlog::spdlog_header_only
 | 
				
			||||||
 | 
					                      svector::svector
 | 
				
			||||||
 | 
					                      OpenGL::OpenGL
 | 
				
			||||||
 | 
					                      GLEW::GLEW
 | 
				
			||||||
 | 
					                      nlohmann_json::nlohmann_json
 | 
				
			||||||
 | 
					                      ${Boost_LIBRARIES}
 | 
				
			||||||
 | 
					                      ${LINKER_FLAGS}
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								external/svector
									
										
									
									
										vendored
									
									
										Submodule
									
								
							
							
						
						
									
										1
									
								
								external/svector
									
										
									
									
										vendored
									
									
										Submodule
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					Subproject commit 74817cfbdbaceb415508de1ff10a0589bf8f25d7
 | 
				
			||||||
| 
						 | 
					@ -10,6 +10,7 @@
 | 
				
			||||||
#include <functional>
 | 
					#include <functional>
 | 
				
			||||||
#include <variant>
 | 
					#include <variant>
 | 
				
			||||||
#include <string_view>
 | 
					#include <string_view>
 | 
				
			||||||
 | 
					#include <ankerl/svector.h>
 | 
				
			||||||
#include "characteristic/characteristic.hpp"
 | 
					#include "characteristic/characteristic.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// helper type for the visitor
 | 
					// helper type for the visitor
 | 
				
			||||||
| 
						 | 
					@ -45,7 +46,7 @@ namespace character {
 | 
				
			||||||
    class BillyObjects final {
 | 
					    class BillyObjects final {
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        using billyObject = std::variant<weapons, equipments, tools>;
 | 
					        using billyObject = std::variant<weapons, equipments, tools>;
 | 
				
			||||||
        using container = std::array<billyObject, 3>;
 | 
					        using container = ankerl::svector<billyObject, 3>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        static constexpr std::string_view sword{ "Sword" };
 | 
					        static constexpr std::string_view sword{ "Sword" };
 | 
				
			||||||
        static constexpr std::string_view lance{ "Lance" };
 | 
					        static constexpr std::string_view lance{ "Lance" };
 | 
				
			||||||
| 
						 | 
					@ -68,9 +69,7 @@ namespace character {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void pop_object(CharacterSheet &sheet) noexcept;
 | 
					        void pop_object(CharacterSheet &sheet) noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [[nodiscard]] std::pair<const container &, std::int8_t> get_objects() const noexcept {
 | 
					        [[nodiscard]] const container &get_objects() const noexcept { return objects; }
 | 
				
			||||||
            return { objects, end_object };
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
//        void insert_weapon(weapons weapon, CharacterSheet &sheet) noexcept;
 | 
					//        void insert_weapon(weapons weapon, CharacterSheet &sheet) noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,34 +77,30 @@ namespace character {
 | 
				
			||||||
        container objects;
 | 
					        container objects;
 | 
				
			||||||
        std::plus<std::uint32_t> plus;
 | 
					        std::plus<std::uint32_t> plus;
 | 
				
			||||||
        std::minus<std::uint32_t> minus;
 | 
					        std::minus<std::uint32_t> minus;
 | 
				
			||||||
        std::uint8_t end_object{ 0 };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        static void change_carac_weapon(const weapons &arg,
 | 
					        static void change_carac_weapon(const weapons &arg,
 | 
				
			||||||
                                        CharacterSheet &sheet,
 | 
					                CharacterSheet &sheet,
 | 
				
			||||||
                                        characteristic::Characteristic &localHabilete,
 | 
					                characteristic::Characteristic &localHabilete,
 | 
				
			||||||
                                        characteristic::Characteristic &localAdresse,
 | 
					                characteristic::Characteristic &localAdresse,
 | 
				
			||||||
                                        characteristic::Characteristic &localEndurance,
 | 
					                characteristic::Characteristic &localEndurance,
 | 
				
			||||||
                                        const std::function<std::uint32_t(std::uint32_t,
 | 
					                const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &operation) noexcept;
 | 
				
			||||||
                                                                          std::uint32_t)> &operation) noexcept;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        static void change_carac_equipment(const equipments &arg,
 | 
					        static void change_carac_equipment(const equipments &arg,
 | 
				
			||||||
                                           CharacterSheet &sheet,
 | 
					                CharacterSheet &sheet,
 | 
				
			||||||
                                           characteristic::Characteristic &localHabilete,
 | 
					                characteristic::Characteristic &localHabilete,
 | 
				
			||||||
                                           characteristic::Characteristic &localAdresse,
 | 
					                characteristic::Characteristic &localAdresse,
 | 
				
			||||||
                                           characteristic::Characteristic &localEndurance,
 | 
					                characteristic::Characteristic &localEndurance,
 | 
				
			||||||
                                           characteristic::Characteristic &localChance,
 | 
					                characteristic::Characteristic &localChance,
 | 
				
			||||||
                                           const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &primary,
 | 
					                const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &primary,
 | 
				
			||||||
                                           const std::function<std::uint32_t(std::uint32_t,
 | 
					                const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &complement) noexcept;
 | 
				
			||||||
                                                                             std::uint32_t)> &complement) noexcept;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        static void change_carac_tools(const tools &arg,
 | 
					        static void change_carac_tools(const tools &arg,
 | 
				
			||||||
                                       CharacterSheet &sheet,
 | 
					                CharacterSheet &sheet,
 | 
				
			||||||
                                       characteristic::Characteristic &localHabilete,
 | 
					                characteristic::Characteristic &localHabilete,
 | 
				
			||||||
                                       characteristic::Characteristic &localAdresse,
 | 
					                characteristic::Characteristic &localAdresse,
 | 
				
			||||||
                                       characteristic::Characteristic &localEndurance,
 | 
					                characteristic::Characteristic &localEndurance,
 | 
				
			||||||
                                       characteristic::Characteristic &localChance,
 | 
					                characteristic::Characteristic &localChance,
 | 
				
			||||||
                                       const std::function<std::uint32_t(std::uint32_t,
 | 
					                const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &operation) noexcept;
 | 
				
			||||||
                                                                         std::uint32_t)> &operation) noexcept;
 | 
					 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,6 +45,8 @@ namespace character {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        std::uint32_t damage{ 0 };
 | 
					        std::uint32_t damage{ 0 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        std::uint32_t critique{ 0 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        std::uint32_t glory{ 0 };
 | 
					        std::uint32_t glory{ 0 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        std::uint32_t money{ 0 };
 | 
					        std::uint32_t money{ 0 };
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,9 +25,9 @@ namespace character::characteristic {
 | 
				
			||||||
        Characteristic() noexcept = default;
 | 
					        Characteristic() noexcept = default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Characteristic(const std::uint32_t base,
 | 
					        Characteristic(const std::uint32_t base,
 | 
				
			||||||
                       const std::uint32_t carac,
 | 
					                const std::uint32_t carac,
 | 
				
			||||||
                       const std::uint32_t materiel,
 | 
					                const std::uint32_t materiel,
 | 
				
			||||||
                       const std::uint32_t additional) noexcept:
 | 
					                const std::uint32_t additional) noexcept:
 | 
				
			||||||
                base(base), carac(carac), materiel(materiel), additional(additional) { (void) get_total(); }
 | 
					                base(base), carac(carac), materiel(materiel), additional(additional) { (void) get_total(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Characteristic(const Characteristic &charac) noexcept = default;
 | 
					        Characteristic(const Characteristic &charac) noexcept = default;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,10 +37,10 @@ namespace gui::menu {
 | 
				
			||||||
        [[nodiscard]] bool is_edit_mode() const { return edit_mode; }
 | 
					        [[nodiscard]] bool is_edit_mode() const { return edit_mode; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void set_save_path([[maybe_unused]] const Controller &controller,
 | 
					        void set_save_path([[maybe_unused]] const Controller &controller,
 | 
				
			||||||
                           const fs::path &savePath) const { save_path = savePath; }
 | 
					                const fs::path &savePath) const { save_path = savePath; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void set_filename([[maybe_unused]] const Controller &controller,
 | 
					        void set_filename([[maybe_unused]] const Controller &controller,
 | 
				
			||||||
                          const std::string &fileName) const { filename = fileName; }
 | 
					                const std::string &fileName) const { filename = fileName; }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,9 +9,8 @@ namespace character {
 | 
				
			||||||
    using characteristic::Characteristic;
 | 
					    using characteristic::Characteristic;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void BillyObjects::push_object(const billyObject &object, CharacterSheet &sheet) noexcept {
 | 
					    void BillyObjects::push_object(const billyObject &object, CharacterSheet &sheet) noexcept {
 | 
				
			||||||
        if (end_object < 3) {
 | 
					        if (objects.size() < 3) {
 | 
				
			||||||
            objects.at(end_object) = object;
 | 
					            objects.emplace_back(object);
 | 
				
			||||||
            ++end_object;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            auto &local_habilete = static_cast<Characteristic &>(sheet.habilete);
 | 
					            auto &local_habilete = static_cast<Characteristic &>(sheet.habilete);
 | 
				
			||||||
            auto &local_adresse = static_cast<Characteristic &>(sheet.adresse);
 | 
					            auto &local_adresse = static_cast<Characteristic &>(sheet.adresse);
 | 
				
			||||||
| 
						 | 
					@ -26,32 +25,32 @@ namespace character {
 | 
				
			||||||
                    [&](const equipments &arg) {
 | 
					                    [&](const equipments &arg) {
 | 
				
			||||||
                        ++sheet.nb_equipments;
 | 
					                        ++sheet.nb_equipments;
 | 
				
			||||||
                        change_carac_equipment(arg,
 | 
					                        change_carac_equipment(arg,
 | 
				
			||||||
                                               sheet,
 | 
					                                sheet,
 | 
				
			||||||
                                               local_habilete,
 | 
					                                local_habilete,
 | 
				
			||||||
                                               local_adresse,
 | 
					                                local_adresse,
 | 
				
			||||||
                                               local_endurance,
 | 
					                                local_endurance,
 | 
				
			||||||
                                               local_chance,
 | 
					                                local_chance,
 | 
				
			||||||
                                               plus,
 | 
					                                plus,
 | 
				
			||||||
                                               minus);
 | 
					                                minus);
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
                    [&](const tools &arg) {
 | 
					                    [&](const tools &arg) {
 | 
				
			||||||
                        ++sheet.nb_tools;
 | 
					                        ++sheet.nb_tools;
 | 
				
			||||||
                        change_carac_tools(arg,
 | 
					                        change_carac_tools(arg,
 | 
				
			||||||
                                           sheet,
 | 
					                                sheet,
 | 
				
			||||||
                                           local_habilete,
 | 
					                                local_habilete,
 | 
				
			||||||
                                           local_adresse,
 | 
					                                local_adresse,
 | 
				
			||||||
                                           local_endurance,
 | 
					                                local_endurance,
 | 
				
			||||||
                                           local_chance,
 | 
					                                local_chance,
 | 
				
			||||||
                                           plus);
 | 
					                                plus);
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
            }, object);
 | 
					            }, object);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void BillyObjects::pop_object(CharacterSheet &sheet) noexcept {
 | 
					    void BillyObjects::pop_object(CharacterSheet &sheet) noexcept {
 | 
				
			||||||
        if (end_object > 0) {
 | 
					        if (!objects.empty()) {
 | 
				
			||||||
            const auto &obj = objects.at(end_object - 1);
 | 
					            const billyObject obj = objects.back();
 | 
				
			||||||
            --end_object;
 | 
					            objects.pop_back();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            auto &local_habilete = static_cast<Characteristic &>(sheet.habilete);
 | 
					            auto &local_habilete = static_cast<Characteristic &>(sheet.habilete);
 | 
				
			||||||
            auto &local_adresse = static_cast<Characteristic &>(sheet.adresse);
 | 
					            auto &local_adresse = static_cast<Characteristic &>(sheet.adresse);
 | 
				
			||||||
| 
						 | 
					@ -66,36 +65,35 @@ namespace character {
 | 
				
			||||||
                    [&](const equipments &arg) {
 | 
					                    [&](const equipments &arg) {
 | 
				
			||||||
                        --sheet.nb_equipments;
 | 
					                        --sheet.nb_equipments;
 | 
				
			||||||
                        change_carac_equipment(arg,
 | 
					                        change_carac_equipment(arg,
 | 
				
			||||||
                                               sheet,
 | 
					                                sheet,
 | 
				
			||||||
                                               local_habilete,
 | 
					                                local_habilete,
 | 
				
			||||||
                                               local_adresse,
 | 
					                                local_adresse,
 | 
				
			||||||
                                               local_endurance,
 | 
					                                local_endurance,
 | 
				
			||||||
                                               local_chance,
 | 
					                                local_chance,
 | 
				
			||||||
                                               minus,
 | 
					                                minus,
 | 
				
			||||||
                                               plus);
 | 
					                                plus);
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
                    [&](const tools &arg) {
 | 
					                    [&](const tools &arg) {
 | 
				
			||||||
                        --sheet.nb_tools;
 | 
					                        --sheet.nb_tools;
 | 
				
			||||||
                        change_carac_tools(arg,
 | 
					                        change_carac_tools(arg,
 | 
				
			||||||
                                           sheet,
 | 
					                                sheet,
 | 
				
			||||||
                                           local_habilete,
 | 
					                                local_habilete,
 | 
				
			||||||
                                           local_adresse,
 | 
					                                local_adresse,
 | 
				
			||||||
                                           local_endurance,
 | 
					                                local_endurance,
 | 
				
			||||||
                                           local_chance,
 | 
					                                local_chance,
 | 
				
			||||||
                                           minus);
 | 
					                                minus);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
            }, obj);
 | 
					            }, obj);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void BillyObjects::change_carac_tools(const tools &arg,
 | 
					    void BillyObjects::change_carac_tools(const tools &arg,
 | 
				
			||||||
                                          CharacterSheet &sheet,
 | 
					            CharacterSheet &sheet,
 | 
				
			||||||
                                          Characteristic &localHabilete,
 | 
					            Characteristic &localHabilete,
 | 
				
			||||||
                                          Characteristic &localAdresse,
 | 
					            Characteristic &localAdresse,
 | 
				
			||||||
                                          Characteristic &localEndurance,
 | 
					            Characteristic &localEndurance,
 | 
				
			||||||
                                          Characteristic &localChance,
 | 
					            Characteristic &localChance,
 | 
				
			||||||
                                          const std::function<std::uint32_t(std::uint32_t,
 | 
					            const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &operation) noexcept {
 | 
				
			||||||
                                                                            std::uint32_t)> &operation) noexcept {
 | 
					 | 
				
			||||||
        switch (arg) {
 | 
					        switch (arg) {
 | 
				
			||||||
            case tools::Fourche:
 | 
					            case tools::Fourche:
 | 
				
			||||||
                localHabilete.materiel = operation(localHabilete.materiel, 1);
 | 
					                localHabilete.materiel = operation(localHabilete.materiel, 1);
 | 
				
			||||||
| 
						 | 
					@ -114,14 +112,13 @@ namespace character {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void BillyObjects::change_carac_equipment(const equipments &arg,
 | 
					    void BillyObjects::change_carac_equipment(const equipments &arg,
 | 
				
			||||||
                                              CharacterSheet &sheet,
 | 
					            CharacterSheet &sheet,
 | 
				
			||||||
                                              Characteristic &localHabilete,
 | 
					            Characteristic &localHabilete,
 | 
				
			||||||
                                              Characteristic &localAdresse,
 | 
					            Characteristic &localAdresse,
 | 
				
			||||||
                                              Characteristic &localEndurance,
 | 
					            Characteristic &localEndurance,
 | 
				
			||||||
                                              Characteristic &localChance,
 | 
					            Characteristic &localChance,
 | 
				
			||||||
                                              const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &primary,
 | 
					            const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &primary,
 | 
				
			||||||
                                              const std::function<std::uint32_t(std::uint32_t,
 | 
					            const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &complement) noexcept {
 | 
				
			||||||
                                                                                std::uint32_t)> &complement) noexcept {
 | 
					 | 
				
			||||||
        switch (arg) {
 | 
					        switch (arg) {
 | 
				
			||||||
            case equipments::Chainmail:
 | 
					            case equipments::Chainmail:
 | 
				
			||||||
                localHabilete.materiel = complement(localHabilete.materiel, 1);
 | 
					                localHabilete.materiel = complement(localHabilete.materiel, 1);
 | 
				
			||||||
| 
						 | 
					@ -143,12 +140,11 @@ namespace character {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void BillyObjects::change_carac_weapon(const weapons &arg,
 | 
					    void BillyObjects::change_carac_weapon(const weapons &arg,
 | 
				
			||||||
                                           CharacterSheet &sheet,
 | 
					            CharacterSheet &sheet,
 | 
				
			||||||
                                           Characteristic &localHabilete,
 | 
					            Characteristic &localHabilete,
 | 
				
			||||||
                                           Characteristic &localAdresse,
 | 
					            Characteristic &localAdresse,
 | 
				
			||||||
                                           Characteristic &localEndurance,
 | 
					            Characteristic &localEndurance,
 | 
				
			||||||
                                           const std::function<std::uint32_t(std::uint32_t,
 | 
					            const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &operation) noexcept {
 | 
				
			||||||
                                                                             std::uint32_t)> &operation) noexcept {
 | 
					 | 
				
			||||||
        switch (arg) {
 | 
					        switch (arg) {
 | 
				
			||||||
            case weapons::Sword:
 | 
					            case weapons::Sword:
 | 
				
			||||||
                localHabilete.materiel = operation(localHabilete.materiel, 4);
 | 
					                localHabilete.materiel = operation(localHabilete.materiel, 4);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,13 +53,14 @@ void gui::Gui::render_gui(const Controller &controller) {
 | 
				
			||||||
        menu.gui();
 | 
					        menu.gui();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ImGui::BeginCombo("Classe",
 | 
					        if (ImGui::BeginCombo("Classe",
 | 
				
			||||||
                              GuiData::classes[static_cast<std::uint32_t>(data.billy.get_current_class())].data(),
 | 
					                GuiData::classes[static_cast<std::uint32_t>(data.billy.get_current_class())].data(),
 | 
				
			||||||
                              ImGuiComboFlags_PopupAlignLeft)) {
 | 
					                ImGuiComboFlags_PopupAlignLeft)) {
 | 
				
			||||||
            for (std::size_t i = 0; i < GuiData::classes.size(); ++i) {
 | 
					            for (std::size_t i = 0; i < GuiData::classes.size(); ++i) {
 | 
				
			||||||
                const bool is_selected = (data.billy.get_current_class() == static_cast<character::classe>(i));
 | 
					                const bool is_selected = (data.billy.get_current_class() == static_cast<character::classe>(i));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (is_selected)
 | 
					                if (is_selected) {
 | 
				
			||||||
                    ImGui::SetItemDefaultFocus();
 | 
					                    ImGui::SetItemDefaultFocus();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            ImGui::EndCombo();
 | 
					            ImGui::EndCombo();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -131,8 +132,8 @@ void gui::Gui::characteristic_gui(const Characteristic &characteristic) noexcept
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void gui::Gui::habilete_menu() noexcept {
 | 
					void gui::Gui::habilete_menu() noexcept {
 | 
				
			||||||
    ImGui::BeginChild("habilete",
 | 
					    ImGui::BeginChild("habilete",
 | 
				
			||||||
                      ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f),
 | 
					            ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f),
 | 
				
			||||||
                      ImGuiChildFlags_Border);
 | 
					            ImGuiChildFlags_Border);
 | 
				
			||||||
    ImGui::Text("Habileté");
 | 
					    ImGui::Text("Habileté");
 | 
				
			||||||
    characteristic_gui(static_cast<const Characteristic &>(data.billy.get_habilete()));
 | 
					    characteristic_gui(static_cast<const Characteristic &>(data.billy.get_habilete()));
 | 
				
			||||||
    ImGui::EndChild();
 | 
					    ImGui::EndChild();
 | 
				
			||||||
| 
						 | 
					@ -140,8 +141,8 @@ void gui::Gui::habilete_menu() noexcept {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void gui::Gui::adresse_menu() noexcept {
 | 
					void gui::Gui::adresse_menu() noexcept {
 | 
				
			||||||
    ImGui::BeginChild("adresse",
 | 
					    ImGui::BeginChild("adresse",
 | 
				
			||||||
                      ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f),
 | 
					            ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f),
 | 
				
			||||||
                      ImGuiChildFlags_Border);
 | 
					            ImGuiChildFlags_Border);
 | 
				
			||||||
    ImGui::Text("Adresse");
 | 
					    ImGui::Text("Adresse");
 | 
				
			||||||
    characteristic_gui(static_cast<const Characteristic &>(data.billy.get_adresse()));
 | 
					    characteristic_gui(static_cast<const Characteristic &>(data.billy.get_adresse()));
 | 
				
			||||||
    ImGui::EndChild();
 | 
					    ImGui::EndChild();
 | 
				
			||||||
| 
						 | 
					@ -149,8 +150,8 @@ void gui::Gui::adresse_menu() noexcept {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void gui::Gui::endurance_menu() noexcept {
 | 
					void gui::Gui::endurance_menu() noexcept {
 | 
				
			||||||
    ImGui::BeginChild("endurance",
 | 
					    ImGui::BeginChild("endurance",
 | 
				
			||||||
                      ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f),
 | 
					            ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f),
 | 
				
			||||||
                      ImGuiChildFlags_Border);
 | 
					            ImGuiChildFlags_Border);
 | 
				
			||||||
    ImGui::Text("Endurance");
 | 
					    ImGui::Text("Endurance");
 | 
				
			||||||
    characteristic_gui(static_cast<const Characteristic &>(data.billy.get_endurance()));
 | 
					    characteristic_gui(static_cast<const Characteristic &>(data.billy.get_endurance()));
 | 
				
			||||||
    ImGui::EndChild();
 | 
					    ImGui::EndChild();
 | 
				
			||||||
| 
						 | 
					@ -158,25 +159,25 @@ void gui::Gui::endurance_menu() noexcept {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void gui::Gui::chance_menu() noexcept {
 | 
					void gui::Gui::chance_menu() noexcept {
 | 
				
			||||||
    ImGui::BeginChild("chance",
 | 
					    ImGui::BeginChild("chance",
 | 
				
			||||||
                      ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f),
 | 
					            ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f),
 | 
				
			||||||
                      ImGuiChildFlags_Border);
 | 
					            ImGuiChildFlags_Border);
 | 
				
			||||||
    ImGui::Text("Chance");
 | 
					    ImGui::Text("Chance");
 | 
				
			||||||
    characteristic_gui(static_cast<const Characteristic&>(data.billy.get_chance()));
 | 
					    characteristic_gui(static_cast<const Characteristic &>(data.billy.get_chance()));
 | 
				
			||||||
    ImGui::EndChild();
 | 
					    ImGui::EndChild();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void gui::Gui::stat_second_menu() noexcept {
 | 
					void gui::Gui::stat_second_menu() noexcept {
 | 
				
			||||||
    ImGui::BeginChild("stats secondaire",
 | 
					    ImGui::BeginChild("stats secondaire",
 | 
				
			||||||
                      ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.4f),
 | 
					            ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.4f),
 | 
				
			||||||
                      ImGuiChildFlags_Border);
 | 
					            ImGuiChildFlags_Border);
 | 
				
			||||||
    ImGui::Text("STAT. SECONDAIRES");
 | 
					    ImGui::Text("STAT. SECONDAIRES");
 | 
				
			||||||
    ImGui::EndChild();
 | 
					    ImGui::EndChild();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void gui::Gui::materiel_menu() noexcept {
 | 
					void gui::Gui::materiel_menu() noexcept {
 | 
				
			||||||
    ImGui::BeginChild("materiel",
 | 
					    ImGui::BeginChild("materiel",
 | 
				
			||||||
                      ImVec2(ImGui::GetWindowWidth() / 3, 0),
 | 
					            ImVec2(ImGui::GetWindowWidth() / 3, 0),
 | 
				
			||||||
                      ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY);
 | 
					            ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY);
 | 
				
			||||||
    ImGui::Text("Matériel");
 | 
					    ImGui::Text("Matériel");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ImGui::BeginChild("weapons", ImVec2(0, 0), ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY);
 | 
					    ImGui::BeginChild("weapons", ImVec2(0, 0), ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY);
 | 
				
			||||||
| 
						 | 
					@ -205,16 +206,16 @@ void gui::Gui::materiel_menu() noexcept {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void gui::Gui::gloire_menu() noexcept {
 | 
					void gui::Gui::gloire_menu() noexcept {
 | 
				
			||||||
    ImGui::BeginChild("gloire",
 | 
					    ImGui::BeginChild("gloire",
 | 
				
			||||||
                      ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.1f),
 | 
					            ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.1f),
 | 
				
			||||||
                      ImGuiChildFlags_Border);
 | 
					            ImGuiChildFlags_Border);
 | 
				
			||||||
    ImGui::Text("Gloire");
 | 
					    ImGui::Text("Gloire");
 | 
				
			||||||
    ImGui::EndChild();
 | 
					    ImGui::EndChild();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void gui::Gui::richesse_menu() noexcept {
 | 
					void gui::Gui::richesse_menu() noexcept {
 | 
				
			||||||
    ImGui::BeginChild("richesse",
 | 
					    ImGui::BeginChild("richesse",
 | 
				
			||||||
                      ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.1f),
 | 
					            ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.1f),
 | 
				
			||||||
                      ImGuiChildFlags_Border);
 | 
					            ImGuiChildFlags_Border);
 | 
				
			||||||
    ImGui::Text("Richesse");
 | 
					    ImGui::Text("Richesse");
 | 
				
			||||||
    ImGui::EndChild();
 | 
					    ImGui::EndChild();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,8 +41,8 @@ void gui::menu::Menu::gui() const noexcept {
 | 
				
			||||||
            if (ImGui::MenuItem("Open file")) {
 | 
					            if (ImGui::MenuItem("Open file")) {
 | 
				
			||||||
                SPDLOG_DEBUG("Opening file");
 | 
					                SPDLOG_DEBUG("Opening file");
 | 
				
			||||||
                ifd::FileDialog::Instance().Open(data.open_character_key,
 | 
					                ifd::FileDialog::Instance().Open(data.open_character_key,
 | 
				
			||||||
                                                 "Open a character sheet",
 | 
					                        "Open a character sheet",
 | 
				
			||||||
                                                 "Character sheet (*.json){.json},.*");
 | 
					                        "Character sheet (*.json){.json},.*");
 | 
				
			||||||
                SPDLOG_DEBUG("File opened");
 | 
					                SPDLOG_DEBUG("File opened");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,8 +57,8 @@ void gui::menu::Menu::gui() const noexcept {
 | 
				
			||||||
            if (ImGui::MenuItem("Save as...")) {
 | 
					            if (ImGui::MenuItem("Save as...")) {
 | 
				
			||||||
                SPDLOG_DEBUG("Saving with file dialog");
 | 
					                SPDLOG_DEBUG("Saving with file dialog");
 | 
				
			||||||
                ifd::FileDialog::Instance().Save(data.save_character_key,
 | 
					                ifd::FileDialog::Instance().Save(data.save_character_key,
 | 
				
			||||||
                                                 "Save character sheet as...",
 | 
					                        "Save character sheet as...",
 | 
				
			||||||
                                                 "*.json {.json}");
 | 
					                        "*.json {.json}");
 | 
				
			||||||
                SPDLOG_DEBUG("File saved with dialog");
 | 
					                SPDLOG_DEBUG("File saved with dialog");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,11 +21,11 @@ gui::Window::Window() {
 | 
				
			||||||
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
 | 
					    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
 | 
				
			||||||
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
 | 
					    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
 | 
				
			||||||
    wwindow = std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)>(glfwCreateWindow(720,
 | 
					    wwindow = std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)>(glfwCreateWindow(720,
 | 
				
			||||||
                                                                                          1280,
 | 
					                    1280,
 | 
				
			||||||
                                                                                          "Billy Sheet tracker",
 | 
					                    "Billy Sheet tracker",
 | 
				
			||||||
                                                                                          nullptr,
 | 
					                    nullptr,
 | 
				
			||||||
                                                                                          nullptr),
 | 
					                    nullptr),
 | 
				
			||||||
                                                                         delete_glfw_window);
 | 
					            delete_glfw_window);
 | 
				
			||||||
    if (!wwindow) {
 | 
					    if (!wwindow) {
 | 
				
			||||||
        glfwTerminate();
 | 
					        glfwTerminate();
 | 
				
			||||||
        SPDLOG_CRITICAL("No GLFW window created, nullptr.");
 | 
					        SPDLOG_CRITICAL("No GLFW window created, nullptr.");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue