Compare commits
3 Commits
c85b335478
...
c9809a934f
| Author | SHA1 | Date | |
|---|---|---|---|
| c9809a934f | |||
| e08f8be87d | |||
| db921e3390 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -7,3 +7,6 @@ build/
|
|||||||
|
|
||||||
# Vscode
|
# Vscode
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
|
# ImGui
|
||||||
|
**/imgui.ini
|
||||||
21
README.md
Normal file
21
README.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Perfect Ear
|
||||||
|
|
||||||
|
Train your ears to recognize piano notes !
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
![[screenshots/success.png]]
|
||||||
|
|
||||||
|
![[screenshots/failure.png]]
|
||||||
|
|
||||||
|
## Build ⚙️
|
||||||
|
|
||||||
|
```bash
|
||||||
|
xmake # xmake will download all the required dependencies
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run 🏃
|
||||||
|
|
||||||
|
```bash
|
||||||
|
xmake run
|
||||||
|
```
|
||||||
BIN
screenshots/failure.png
Normal file
BIN
screenshots/failure.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
screenshots/success.png
Normal file
BIN
screenshots/success.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@@ -5,9 +5,9 @@
|
|||||||
#include <random>
|
#include <random>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#define DISABLED_COND(code, cond) \
|
#define DISABLED_COND(cond, code...) \
|
||||||
{ \
|
{ \
|
||||||
bool Disabled = cond; \
|
bool Disabled = (cond); \
|
||||||
if (Disabled) \
|
if (Disabled) \
|
||||||
ImGui::BeginDisabled(); \
|
ImGui::BeginDisabled(); \
|
||||||
code if (Disabled) ImGui::EndDisabled(); \
|
code if (Disabled) ImGui::EndDisabled(); \
|
||||||
@@ -65,11 +65,10 @@ static void RenderGameWindow() {
|
|||||||
ImGui::Text("Quelle est la note ?");
|
ImGui::Text("Quelle est la note ?");
|
||||||
|
|
||||||
DISABLED_COND(
|
DISABLED_COND(
|
||||||
if (ImGui::Button("Réécouter")) {
|
!Hint, if (ImGui::Button("Réécouter")) {
|
||||||
audio::PlayNote(Answer);
|
audio::PlayNote(Answer);
|
||||||
Hint = false;
|
Hint = false;
|
||||||
},
|
})
|
||||||
!Hint)
|
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Voir la réponse")) {
|
if (ImGui::Button("Voir la réponse")) {
|
||||||
@@ -84,10 +83,8 @@ static void RenderGameWindow() {
|
|||||||
Right = false;
|
Right = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Cooldown > 0.0)
|
DISABLED_COND(
|
||||||
ImGui::BeginDisabled();
|
Cooldown > 0.0f, for (int i = 0; i < NoteCount; i++) {
|
||||||
|
|
||||||
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};
|
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);
|
ImGui::PushStyleColor(ImGuiCol_Button, color);
|
||||||
bool green = (ShowAnswer && i == Answer);
|
bool green = (ShowAnswer && i == Answer);
|
||||||
@@ -107,10 +104,7 @@ static void RenderGameWindow() {
|
|||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
}
|
})
|
||||||
|
|
||||||
if (Cooldown > 0.0)
|
|
||||||
ImGui::EndDisabled();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RenderMainWindow() {
|
static void RenderMainWindow() {
|
||||||
@@ -118,7 +112,9 @@ static void RenderMainWindow() {
|
|||||||
InGame = true;
|
InGame = true;
|
||||||
Right = true;
|
Right = true;
|
||||||
}
|
}
|
||||||
if (ImGui::Button("Quitter")) {}
|
if (ImGui::Button("Quitter")) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Render() {
|
void Render() {
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
add_rules("mode.debug", "mode.release")
|
add_rules("mode.debug", "mode.release")
|
||||||
|
|
||||||
add_requires("libsdl")
|
add_requires("libsdl2 2.30.10")
|
||||||
add_requires("libsdl_mixer", {system = true})
|
add_requires("libsdl2_mixer 2.8.1")
|
||||||
add_requires("imgui", {configs = {sdl2 = true, opengl3 = true}})
|
add_requires("imgui v1.91.8", {configs = {sdl2 = true, opengl3 = true}})
|
||||||
|
|
||||||
target("PerfectHear")
|
target("PerfectHear")
|
||||||
set_kind("binary")
|
set_kind("binary")
|
||||||
add_files("src/*.cpp")
|
add_files("src/*.cpp")
|
||||||
add_includedirs("include")
|
add_includedirs("include")
|
||||||
|
|
||||||
add_packages("libsdl", "libsdl_mixer", "imgui")
|
add_packages("libsdl2", "libsdl2_mixer", "imgui")
|
||||||
|
|
||||||
if is_os("windows") then
|
if is_os("windows") then
|
||||||
add_ldflags("-static")
|
add_ldflags("-static")
|
||||||
|
|||||||
Reference in New Issue
Block a user