Adding main characteristics

This commit is contained in:
Pcornat 2022-01-10 21:16:05 +01:00
parent 029acbbbb3
commit 4b5ec33d74
Signed by: Pcornat
GPG Key ID: 2F3932FF46D9ECA0
14 changed files with 124 additions and 8 deletions

View File

@ -21,7 +21,13 @@ set(SOURCE_HEADERS
include/imgui/imstb_truetype.h
include/gui.hpp
include/gui_data.hpp
include/window.hpp)
include/window.hpp
include/billy_sheet.hpp
include/characteristic/habilete.hpp
include/characteristic/adresse.hpp
include/characteristic/endurance.hpp
include/characteristic/chance.hpp
)
set(SOURCE_FILES
src/imgui/imgui.cpp
@ -33,7 +39,12 @@ set(SOURCE_FILES
src/main.cpp
src/gui.cpp
src/gui_data.cpp
src/window.cpp)
src/window.cpp
src/billy_sheet.cpp
src/characteristic/adresse.cpp
src/characteristic/endurance.cpp
src/characteristic/chance.cpp
)
set(SOURCES
${SOURCE_HEADERS}
@ -75,7 +86,7 @@ set(COMPILE_FLAGS
-Wall
-Wextra
-Wpedantic
-Wpadded
# -Wpadded
-pedantic
-ffunction-sections
-fdata-sections

16
include/billy_sheet.hpp Normal file
View File

@ -0,0 +1,16 @@
#ifndef BILLYSHEET_BILLY_SHEET_HPP
#define BILLYSHEET_BILLY_SHEET_HPP
#include <random>
namespace character {
class BillySheet {
private:
std::mt19937_64 engine{ std::random_device{ "rdseed" }() };
std::string caractere{};
};
}
#endif //BILLYSHEET_BILLY_SHEET_HPP

View File

@ -0,0 +1,17 @@
#ifndef BILLYSHEET_ADRESSE_HPP
#define BILLYSHEET_ADRESSE_HPP
#include <cstdint>
namespace character::characteristic {
class Adresse {
private:
const std::uint32_t base{ 1 };
std::uint32_t carac{ 0 };
std::uint32_t materiel{ 0 };
std::uint32_t additional{ 0 };
};
}
#endif //BILLYSHEET_ADRESSE_HPP

View File

@ -0,0 +1,17 @@
#ifndef BILLYSHEET_CHANCE_HPP
#define BILLYSHEET_CHANCE_HPP
#include <cstdint>
namespace character::characteristic {
class Chance {
private:
const std::uint32_t base{ 3 };
std::uint32_t carac{ 0 };
std::uint32_t materiel{ 0 };
std::uint32_t additional{ 0 };
};
}
#endif //BILLYSHEET_CHANCE_HPP

View File

@ -0,0 +1,21 @@
//
// Created by postaron on 10/01/2022.
//
#ifndef BILLYSHEET_ENDURANCE_HPP
#define BILLYSHEET_ENDURANCE_HPP
#include <cstdint>
namespace character::characteristic {
class Endurance {
private:
const std::uint32_t base{ 2 };
std::uint32_t carac{ 0 };
std::uint32_t materiel{ 0 };
std::uint32_t additional{ 0 };
};
}
#endif //BILLYSHEET_ENDURANCE_HPP

View File

@ -0,0 +1,17 @@
#ifndef BILLYSHEET_HABILETE_HPP
#define BILLYSHEET_HABILETE_HPP
#include <cstdint>
namespace character::characteristic {
class Habilete final {
private:
const std::uint32_t base{ 2 };
std::uint32_t carac{ 0 };
std::uint32_t materiel{ 0 };
std::uint32_t additional{ 0 };
};
}
#endif //BILLYSHEET_HABILETE_HPP

View File

@ -1,6 +1,8 @@
#ifndef BILLYSHEET_GUI_DATA_HPP
#define BILLYSHEET_GUI_DATA_HPP
#include "billy_sheet.hpp"
#include <spdlog/spdlog.h>
namespace gui {
class Window;
@ -9,10 +11,12 @@ namespace gui {
private:
Window &window;
character::BillySheet billy;
public:
GuiData() = delete;
explicit GuiData(Window &wwindow) : window(wwindow) {}
explicit GuiData(Window &wwindow) : window(wwindow) { SPDLOG_DEBUG("Creating GUI Data"); }
[[nodiscard]] Window &get_window() const;

1
src/billy_sheet.cpp Normal file
View File

@ -0,0 +1 @@
#include "billy_sheet.hpp"

View File

@ -0,0 +1,5 @@
//
// Created by postaron on 10/01/2022.
//
#include "characteristic/adresse.hpp"

View File

@ -0,0 +1,5 @@
//
// Created by postaron on 10/01/2022.
//
#include "characteristic/chance.hpp"

View File

@ -0,0 +1 @@
#include "characteristic/endurance.hpp"

View File

@ -7,11 +7,13 @@
#include "window.hpp"
gui::Gui::Gui(gui::GuiData &data) : data(data), font("font/DejaVuSans.ttf") {
SPDLOG_DEBUG("Creating GUI");
ImGui::CreateContext();
ImGui::StyleColorsDark();
ImGui::GetIO().Fonts->AddFontFromFileTTF(font.c_str(), 18.0f);
ImGui_ImplGlfw_InitForOpenGL(data.get_window().get_window().get(), true);
initialized = ImGui_ImplOpenGL3_Init();
SPDLOG_DEBUG("Initialized: {}", initialized);
}
gui::Gui::~Gui() noexcept {

View File

@ -7,12 +7,10 @@
int main() {
std::ios::sync_with_stdio(false);
spdlog::set_default_logger(spdlog::stdout_color_st("console"));
SPDLOG_DEBUG("Creating Window");
gui::Window window;
gui::GuiData gui_data(window);
try {
gui::Window window;
gui::GuiData gui_data(window);
gui::Gui gui(gui_data);
while (!window.should_close()) {

View File

@ -11,6 +11,7 @@ static void framebufferCallback([[maybe_unused]] GLFWwindow *glfWwindow, int wid
}
gui::Window::Window() {
SPDLOG_DEBUG("Creating Window");
glfwSetErrorCallback(glfwErrorCallback);
if (glfwInit() == GLFW_FALSE) {
SPDLOG_CRITICAL("GLFW init failed.");