PivotGUI visuals + .lua update
All checks were successful
Linux arm64 / Build (push) Successful in 41m17s
All checks were successful
Linux arm64 / Build (push) Successful in 41m17s
This commit is contained in:
@@ -5,73 +5,84 @@
|
|||||||
void PivotGui::Init() {}
|
void PivotGui::Init() {}
|
||||||
|
|
||||||
void PivotGui::Render() {
|
void PivotGui::Render() {
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
// 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);
|
||||||
|
ImVec2 bottomWindowSize(io.DisplaySize.x, io.DisplaySize.y * 0.2f);
|
||||||
|
|
||||||
// Our state
|
// Begin fenetre top left
|
||||||
static bool show_demo_window = true;
|
ImGui::SetNextWindowSize(topLeftWindowSize);
|
||||||
static bool show_another_window = false;
|
ImGui::SetNextWindowPos(ImVec2(0, 0)); // Position at the top-left corner
|
||||||
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about
|
ImGui::Begin("Left Top Window", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
|
||||||
// Dear ImGui!).
|
|
||||||
if (show_demo_window)
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window
|
// Get window position
|
||||||
static float f = 0.0f;
|
ImVec2 windowPos = ImGui::GetWindowPos();
|
||||||
static int counter = 0;
|
|
||||||
|
|
||||||
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
ImGui::Text("Matrice initiale:");
|
||||||
|
|
||||||
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
// taille matrice
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
static int matrixSizeX = 4;
|
||||||
ImGui::End();
|
static int matrixSizeY = 4;
|
||||||
|
|
||||||
// 3. Interface of Pivot
|
|
||||||
ImVec4 bg_color = {0.18, 0.8, 1, 0.8};
|
|
||||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar;
|
|
||||||
ImVec2 window_pos = {0, 0};
|
|
||||||
ImVec2 window_size = ImGui::GetIO().DisplaySize;
|
|
||||||
ImVec2 vertical_spacing = {0, 40};
|
|
||||||
|
|
||||||
ImGui::SetNextWindowPos(window_pos);
|
ImGui::InputInt("##RowsMatriceInitiale", &matrixSizeY);
|
||||||
ImGui::SetNextWindowSize(window_size);
|
ImGui::SameLine();
|
||||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, bg_color);
|
ImGui::Text("Lignes");
|
||||||
ImGui::Begin("Pivot", nullptr, window_flags);
|
|
||||||
|
|
||||||
ImGui::Text("Matrice :");
|
|
||||||
|
|
||||||
ImGui::Dummy(vertical_spacing);
|
ImGui::InputInt("##ColumnsMatriceInitiale", &matrixSizeX);
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Text("Colonnes");
|
||||||
|
|
||||||
static char selected[4][4] = {{1, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
|
// Draw matrix
|
||||||
|
ImGui::BeginChild("MatriceInitiale", ImVec2(topLeftWindowSize.x, io.DisplaySize.y * 0.7f), false);
|
||||||
|
|
||||||
// Add in a bit of silly fun...
|
for (int y = 0; y < matrixSizeY; y++) {
|
||||||
const float time = (float)ImGui::GetTime();
|
for (int x = 0; x < matrixSizeX; x++) {
|
||||||
|
if (x > 0)
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::PushID(y * matrixSizeX + x);
|
||||||
|
ImGui::Selectable("?", false, 0, ImVec2(50, 50));
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int y = 0; y < 4; y++)
|
ImGui::Text("Matrice finale:");
|
||||||
for (int x = 0; x < 4; x++) {
|
|
||||||
if (x > 0)
|
ImGui::EndChild(); // End Matrice initiale
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::PushID(y * 4 + x);
|
ImGui::End(); // End fenetre top left
|
||||||
if (ImGui::Selectable("?", selected[y][x] != 0, 0, ImVec2(50, 50))) {
|
|
||||||
// Toggle clicked cell + toggle neighbors
|
// Begin fenetre top right
|
||||||
selected[y][x] ^= 1;
|
ImGui::SetNextWindowSize(topRightWindowSize);
|
||||||
if (x > 0) {
|
ImGui::SetNextWindowPos(ImVec2(windowPos.x + topLeftWindowSize.x, 0)); // Position at the top-right corner
|
||||||
selected[y][x - 1] ^= 1;
|
ImGui::Begin("Right Top Window", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
|
||||||
}
|
|
||||||
if (x < 3) {
|
// rajouter le code pour la partie top right
|
||||||
selected[y][x + 1] ^= 1;
|
|
||||||
}
|
ImGui::End(); // End fenetre top right
|
||||||
if (y > 0) {
|
|
||||||
selected[y - 1][x] ^= 1;
|
// Begin fenetre bas
|
||||||
}
|
ImGui::SetNextWindowSize(bottomWindowSize);
|
||||||
if (y < 3) {
|
ImGui::SetNextWindowPos(ImVec2(0, io.DisplaySize.y * 0.8f)); // Position at the bottom-left corner
|
||||||
selected[y + 1][x] ^= 1;
|
ImGui::Begin("Bottom Part", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
|
||||||
}
|
|
||||||
}
|
// rajouter des boutons clickables
|
||||||
ImGui::PopID();
|
if (ImGui::Button("Calcul noyeau")) {
|
||||||
}
|
// Code de calcul
|
||||||
ImGui::PopStyleColor();
|
}
|
||||||
ImGui::End();
|
ImGui::SameLine(); // Align buttons horizontally
|
||||||
|
if (ImGui::Button("Calcul rang")) {
|
||||||
|
// Code de calcul
|
||||||
|
}
|
||||||
|
ImGui::SameLine(); // Align buttons horizontally
|
||||||
|
if (ImGui::Button("Calcul inverse")) {
|
||||||
|
// Code de calcul
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::End(); // End fenetre bas
|
||||||
}
|
}
|
||||||
|
|
||||||
void PivotGui::Destroy() {}
|
void PivotGui::Destroy() {}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
add_rules("mode.debug", "mode.release")
|
add_rules("mode.debug", "mode.release")
|
||||||
|
|
||||||
add_requires("libsdl >= 2")
|
add_requires("libsdl 2.28.3", {configs = {sdlmain = false}})
|
||||||
add_requires("imgui", {configs = {sdl2_no_renderer = true, opengl3 = true}})
|
add_requires("imgui", {configs = {sdl2_no_renderer = true, opengl3 = true}})
|
||||||
|
|
||||||
set_languages("c++17")
|
set_languages("c++17")
|
||||||
|
|||||||
Reference in New Issue
Block a user