This commit is contained in:
2025-03-19 18:19:35 +01:00
parent c85b335478
commit db921e3390
2 changed files with 31 additions and 35 deletions

View File

@@ -5,9 +5,9 @@
#include <random>
#include <string>
#define DISABLED_COND(code, cond) \
#define DISABLED_COND(cond, code...) \
{ \
bool Disabled = cond; \
bool Disabled = (cond); \
if (Disabled) \
ImGui::BeginDisabled(); \
code if (Disabled) ImGui::EndDisabled(); \
@@ -65,11 +65,10 @@ static void RenderGameWindow() {
ImGui::Text("Quelle est la note ?");
DISABLED_COND(
if (ImGui::Button("Réécouter")) {
!Hint, if (ImGui::Button("Réécouter")) {
audio::PlayNote(Answer);
Hint = false;
},
!Hint)
})
ImGui::SameLine();
if (ImGui::Button("Voir la réponse")) {
@@ -84,10 +83,8 @@ static void RenderGameWindow() {
Right = false;
}
if (Cooldown > 0.0)
ImGui::BeginDisabled();
for (int i = 0; i < NoteCount; i++) {
DISABLED_COND(
Cooldown > 0.0f, for (int i = 0; i < NoteCount; i++) {
ImVec4 color = (i == Ab || i == Bb || i == Db || i == Eb || i == Gb) ? ImVec4{0, 0, 0, 1} : ImVec4{0.5, .5, .5, 1};
ImGui::PushStyleColor(ImGuiCol_Button, color);
bool green = (ShowAnswer && i == Answer);
@@ -107,10 +104,7 @@ static void RenderGameWindow() {
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::SameLine();
}
if (Cooldown > 0.0)
ImGui::EndDisabled();
})
}
static void RenderMainWindow() {
@@ -118,7 +112,9 @@ static void RenderMainWindow() {
InGame = true;
Right = true;
}
if (ImGui::Button("Quitter")) {}
if (ImGui::Button("Quitter")) {
// TODO
}
}
void Render() {

View File

@@ -1,15 +1,15 @@
add_rules("mode.debug", "mode.release")
add_requires("libsdl")
add_requires("libsdl_mixer", {system = true})
add_requires("imgui", {configs = {sdl2 = true, opengl3 = true}})
add_requires("libsdl2 2.30.10")
add_requires("libsdl2_mixer 2.8.1")
add_requires("imgui v1.91.8", {configs = {sdl2 = true, opengl3 = true}})
target("PerfectHear")
set_kind("binary")
add_files("src/*.cpp")
add_includedirs("include")
add_packages("libsdl", "libsdl_mixer", "imgui")
add_packages("libsdl2", "libsdl2_mixer", "imgui")
if is_os("windows") then
add_ldflags("-static")