This commit is contained in:
@@ -1,16 +1,29 @@
|
||||
#include "PivotGui.h"
|
||||
|
||||
#include "Matrix.h"
|
||||
#include "Solver.h"
|
||||
#include <imgui.h>
|
||||
|
||||
std::vector<std::vector<int>> PivotGui::matrixValues;
|
||||
int PivotGui::matrixSizeX = 4;
|
||||
int PivotGui::matrixSizeY = 4;
|
||||
static Matrix LoadMatrixFromStdVect(const std::vector<std::vector<int>>& data) {
|
||||
Matrix result {data.size(), data.empty() ? 0 : data[0].size()};
|
||||
for (std::size_t i = 0; i < result.GetRawCount(); i++) {
|
||||
for (std::size_t j = 0; j < result.GetColumnCount(); j++) {
|
||||
result.at(i, j) = static_cast<Matrix::Element>(data[i][j]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void PivotGui::Init() {}
|
||||
|
||||
void PivotGui::Render() {
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
static std::vector<std::vector<int>> matrixValues;
|
||||
static int matrixSizeX = 4;
|
||||
static int matrixSizeY = 4;
|
||||
static Solver solver;
|
||||
|
||||
// divisions des fenetres
|
||||
ImVec2 topLeftWindowSize(io.DisplaySize.x * 0.5f, io.DisplaySize.y * 0.8f);
|
||||
ImVec2 topRightWindowSize(io.DisplaySize.x * 0.5f, io.DisplaySize.y * 0.8f);
|
||||
@@ -19,7 +32,8 @@ void PivotGui::Render() {
|
||||
// Begin fenetre top left
|
||||
ImGui::SetNextWindowSize(topLeftWindowSize);
|
||||
ImGui::SetNextWindowPos(ImVec2(0, 0)); // Position at the top-left corner
|
||||
ImGui::Begin("Left Top Window", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
|
||||
ImGui::Begin("Left Top Window", nullptr,
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
|
||||
|
||||
// Get window position
|
||||
ImVec2 windowPos = ImGui::GetWindowPos();
|
||||
@@ -65,7 +79,8 @@ void PivotGui::Render() {
|
||||
// Begin fenetre top right
|
||||
ImGui::SetNextWindowSize(topRightWindowSize);
|
||||
ImGui::SetNextWindowPos(ImVec2(windowPos.x + topLeftWindowSize.x, 0)); // Position at the top-right corner
|
||||
ImGui::Begin("Right Top Window", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
|
||||
ImGui::Begin("Right Top Window", nullptr,
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
|
||||
|
||||
// rajouter le code pour la partie top right
|
||||
|
||||
@@ -74,19 +89,23 @@ void PivotGui::Render() {
|
||||
// Begin fenetre bas
|
||||
ImGui::SetNextWindowSize(bottomWindowSize);
|
||||
ImGui::SetNextWindowPos(ImVec2(0, io.DisplaySize.y * 0.8f)); // Position at the bottom-left corner
|
||||
ImGui::Begin("Bottom Part", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
|
||||
ImGui::Begin("Bottom Part", nullptr,
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
|
||||
|
||||
// rajouter des boutons clickables
|
||||
if (ImGui::Button("Calcul noyeau")) {
|
||||
if (ImGui::Button("Calcul noyau")) {
|
||||
// Code de calcul
|
||||
Vect kernel = solver.Kernel(LoadMatrixFromStdVect(matrixValues));
|
||||
}
|
||||
ImGui::SameLine(); // Align buttons horizontally
|
||||
if (ImGui::Button("Calcul rang")) {
|
||||
// Code de calcul
|
||||
std::size_t rank = solver.Rank(LoadMatrixFromStdVect(matrixValues));
|
||||
}
|
||||
ImGui::SameLine(); // Align buttons horizontally
|
||||
if (ImGui::Button("Calcul image")) {
|
||||
// Code de calcul
|
||||
Vect image = solver.Image(LoadMatrixFromStdVect(matrixValues));
|
||||
}
|
||||
|
||||
ImGui::End(); // End fenetre bas
|
||||
|
||||
@@ -6,7 +6,5 @@ namespace PivotGui {
|
||||
void Init();
|
||||
void Render();
|
||||
void Destroy();
|
||||
extern std::vector<std::vector<int>> matrixValues;
|
||||
extern int matrixSizeX;
|
||||
extern int matrixSizeY;
|
||||
|
||||
} // namespace PivotGui
|
||||
|
||||
Reference in New Issue
Block a user