How to add a hover sound effect in ImGui

2 weeks ago 11
ARTICLE AD BOX

How do I take this sound effect:

menuSound.loadSound("hover_sound", "Audio/Sound/button_hover_sound1.wav", 0.5);

And have it so that when I hover over a ImGui button, it will play the sound effect once. Example this button:

if (ImGui::Button("Respawn", ImVec2(500, 60))) { menuSound.playSound("select_sound"); camera.cameraPhysics.position = glm::vec3(55.0f, 5.0f, 5.0f); camera.cameraPhysics.velocity = glm::vec3(0.0f); glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); ImGui::End(); gui.endFrame(); return GAME_STATE_PLAYING; }

If anyone could help me out with this, that would be great!

Read Entire Article