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"]
 | 
			
		||||
	path = external/ImFileDialog
 | 
			
		||||
	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")
 | 
			
		||||
endif ()
 | 
			
		||||
 | 
			
		||||
add_subdirectory(external/svector)
 | 
			
		||||
 | 
			
		||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
 | 
			
		||||
option(GLFW_BUILD_EXAMPLES "Build the GLFW example 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)
 | 
			
		||||
 | 
			
		||||
set_target_properties(BillySheet spdlog PROPERTIES
 | 
			
		||||
set_target_properties(BillySheet spdlog svector PROPERTIES
 | 
			
		||||
                      CXX_STANDARD 17
 | 
			
		||||
                      CXX_STANDARD_REQUIRED ON
 | 
			
		||||
                      CXX_EXTENSIONS OFF
 | 
			
		||||
| 
						 | 
				
			
			@ -112,7 +114,7 @@ set_target_properties(BillySheet spdlog PROPERTIES
 | 
			
		|||
                      # 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
 | 
			
		||||
                      C_STANDARD 11
 | 
			
		||||
| 
						 | 
				
			
			@ -122,27 +124,35 @@ set_target_properties(glfw PROPERTIES
 | 
			
		|||
                      UNITY_BUILD ON
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
set_target_properties(spdlog PROPERTIES UNITY_BUILD ON)
 | 
			
		||||
 | 
			
		||||
target_compile_definitions(BillySheet PRIVATE
 | 
			
		||||
                           $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>
 | 
			
		||||
                           $<$<CONFIG:Debug>:SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG>
 | 
			
		||||
                           $<$<CONFIG:Release>:SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_ERROR>)
 | 
			
		||||
 | 
			
		||||
target_compile_definitions(spdlog PRIVATE
 | 
			
		||||
                           $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
 | 
			
		||||
 | 
			
		||||
target_compile_definitions(glfw PRIVATE
 | 
			
		||||
                           $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
 | 
			
		||||
target_compile_definitions(spdlog PRIVATE $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
 | 
			
		||||
target_compile_definitions(svector INTERFACE $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
 | 
			
		||||
target_compile_definitions(glfw PRIVATE $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
 | 
			
		||||
 | 
			
		||||
target_compile_options(spdlog PRIVATE ${COMPILE_FLAGS})
 | 
			
		||||
target_compile_options(svector INTERFACE ${COMPILE_FLAGS})
 | 
			
		||||
target_compile_options(glfw PRIVATE ${COMPILE_FLAGS})
 | 
			
		||||
target_compile_options(BillySheet PRIVATE ${COMPILE_FLAGS})
 | 
			
		||||
 | 
			
		||||
target_link_options(spdlog PRIVATE ${LINKER_OPTIONS})
 | 
			
		||||
target_link_options(svector INTERFACE ${LINKER_OPTIONS})
 | 
			
		||||
target_link_options(glfw PRIVATE ${LINKER_OPTIONS})
 | 
			
		||||
target_link_options(BillySheet PRIVATE ${LINKER_OPTIONS})
 | 
			
		||||
 | 
			
		||||
target_link_libraries(spdlog PRIVATE ${LINKER_FLAGS})
 | 
			
		||||
target_link_libraries(svector INTERFACE ${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 <variant>
 | 
			
		||||
#include <string_view>
 | 
			
		||||
#include <ankerl/svector.h>
 | 
			
		||||
#include "characteristic/characteristic.hpp"
 | 
			
		||||
 | 
			
		||||
// helper type for the visitor
 | 
			
		||||
| 
						 | 
				
			
			@ -45,7 +46,7 @@ namespace character {
 | 
			
		|||
    class BillyObjects final {
 | 
			
		||||
    public:
 | 
			
		||||
        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 lance{ "Lance" };
 | 
			
		||||
| 
						 | 
				
			
			@ -68,9 +69,7 @@ namespace character {
 | 
			
		|||
 | 
			
		||||
        void pop_object(CharacterSheet &sheet) noexcept;
 | 
			
		||||
 | 
			
		||||
        [[nodiscard]] std::pair<const container &, std::int8_t> get_objects() const noexcept {
 | 
			
		||||
            return { objects, end_object };
 | 
			
		||||
        }
 | 
			
		||||
        [[nodiscard]] const container &get_objects() const noexcept { return objects; }
 | 
			
		||||
 | 
			
		||||
//        void insert_weapon(weapons weapon, CharacterSheet &sheet) noexcept;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -78,15 +77,13 @@ namespace character {
 | 
			
		|||
        container objects;
 | 
			
		||||
        std::plus<std::uint32_t> plus;
 | 
			
		||||
        std::minus<std::uint32_t> minus;
 | 
			
		||||
        std::uint8_t end_object{ 0 };
 | 
			
		||||
 | 
			
		||||
        static void change_carac_weapon(const weapons &arg,
 | 
			
		||||
                CharacterSheet &sheet,
 | 
			
		||||
                characteristic::Characteristic &localHabilete,
 | 
			
		||||
                characteristic::Characteristic &localAdresse,
 | 
			
		||||
                characteristic::Characteristic &localEndurance,
 | 
			
		||||
                                        const std::function<std::uint32_t(std::uint32_t,
 | 
			
		||||
                                                                          std::uint32_t)> &operation) noexcept;
 | 
			
		||||
                const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &operation) noexcept;
 | 
			
		||||
 | 
			
		||||
        static void change_carac_equipment(const equipments &arg,
 | 
			
		||||
                CharacterSheet &sheet,
 | 
			
		||||
| 
						 | 
				
			
			@ -95,8 +92,7 @@ namespace character {
 | 
			
		|||
                characteristic::Characteristic &localEndurance,
 | 
			
		||||
                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)> &complement) noexcept;
 | 
			
		||||
                const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &complement) noexcept;
 | 
			
		||||
 | 
			
		||||
        static void change_carac_tools(const tools &arg,
 | 
			
		||||
                CharacterSheet &sheet,
 | 
			
		||||
| 
						 | 
				
			
			@ -104,8 +100,7 @@ namespace character {
 | 
			
		|||
                characteristic::Characteristic &localAdresse,
 | 
			
		||||
                characteristic::Characteristic &localEndurance,
 | 
			
		||||
                characteristic::Characteristic &localChance,
 | 
			
		||||
                                       const std::function<std::uint32_t(std::uint32_t,
 | 
			
		||||
                                                                         std::uint32_t)> &operation) noexcept;
 | 
			
		||||
                const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &operation) noexcept;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,6 +45,8 @@ namespace character {
 | 
			
		|||
 | 
			
		||||
        std::uint32_t damage{ 0 };
 | 
			
		||||
 | 
			
		||||
        std::uint32_t critique{ 0 };
 | 
			
		||||
 | 
			
		||||
        std::uint32_t glory{ 0 };
 | 
			
		||||
 | 
			
		||||
        std::uint32_t money{ 0 };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,9 +9,8 @@ namespace character {
 | 
			
		|||
    using characteristic::Characteristic;
 | 
			
		||||
 | 
			
		||||
    void BillyObjects::push_object(const billyObject &object, CharacterSheet &sheet) noexcept {
 | 
			
		||||
        if (end_object < 3) {
 | 
			
		||||
            objects.at(end_object) = object;
 | 
			
		||||
            ++end_object;
 | 
			
		||||
        if (objects.size() < 3) {
 | 
			
		||||
            objects.emplace_back(object);
 | 
			
		||||
 | 
			
		||||
            auto &local_habilete = static_cast<Characteristic &>(sheet.habilete);
 | 
			
		||||
            auto &local_adresse = static_cast<Characteristic &>(sheet.adresse);
 | 
			
		||||
| 
						 | 
				
			
			@ -49,9 +48,9 @@ namespace character {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    void BillyObjects::pop_object(CharacterSheet &sheet) noexcept {
 | 
			
		||||
        if (end_object > 0) {
 | 
			
		||||
            const auto &obj = objects.at(end_object - 1);
 | 
			
		||||
            --end_object;
 | 
			
		||||
        if (!objects.empty()) {
 | 
			
		||||
            const billyObject obj = objects.back();
 | 
			
		||||
            objects.pop_back();
 | 
			
		||||
 | 
			
		||||
            auto &local_habilete = static_cast<Characteristic &>(sheet.habilete);
 | 
			
		||||
            auto &local_adresse = static_cast<Characteristic &>(sheet.adresse);
 | 
			
		||||
| 
						 | 
				
			
			@ -94,8 +93,7 @@ namespace character {
 | 
			
		|||
            Characteristic &localAdresse,
 | 
			
		||||
            Characteristic &localEndurance,
 | 
			
		||||
            Characteristic &localChance,
 | 
			
		||||
                                          const std::function<std::uint32_t(std::uint32_t,
 | 
			
		||||
                                                                            std::uint32_t)> &operation) noexcept {
 | 
			
		||||
            const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &operation) noexcept {
 | 
			
		||||
        switch (arg) {
 | 
			
		||||
            case tools::Fourche:
 | 
			
		||||
                localHabilete.materiel = operation(localHabilete.materiel, 1);
 | 
			
		||||
| 
						 | 
				
			
			@ -120,8 +118,7 @@ namespace character {
 | 
			
		|||
            Characteristic &localEndurance,
 | 
			
		||||
            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)> &complement) noexcept {
 | 
			
		||||
            const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &complement) noexcept {
 | 
			
		||||
        switch (arg) {
 | 
			
		||||
            case equipments::Chainmail:
 | 
			
		||||
                localHabilete.materiel = complement(localHabilete.materiel, 1);
 | 
			
		||||
| 
						 | 
				
			
			@ -147,8 +144,7 @@ namespace character {
 | 
			
		|||
            Characteristic &localHabilete,
 | 
			
		||||
            Characteristic &localAdresse,
 | 
			
		||||
            Characteristic &localEndurance,
 | 
			
		||||
                                           const std::function<std::uint32_t(std::uint32_t,
 | 
			
		||||
                                                                             std::uint32_t)> &operation) noexcept {
 | 
			
		||||
            const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &operation) noexcept {
 | 
			
		||||
        switch (arg) {
 | 
			
		||||
            case weapons::Sword:
 | 
			
		||||
                localHabilete.materiel = operation(localHabilete.materiel, 4);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,9 +58,10 @@ void gui::Gui::render_gui(const Controller &controller) {
 | 
			
		|||
            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));
 | 
			
		||||
 | 
			
		||||
                if (is_selected)
 | 
			
		||||
                if (is_selected) {
 | 
			
		||||
                    ImGui::SetItemDefaultFocus();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            ImGui::EndCombo();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -161,7 +162,7 @@ void gui::Gui::chance_menu() noexcept {
 | 
			
		|||
            ImVec2(ImGui::GetWindowWidth() / 3, ImGui::GetWindowHeight() * 0.2f),
 | 
			
		||||
            ImGuiChildFlags_Border);
 | 
			
		||||
    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();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue