mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Play tavern music file on login screen
This commit is contained in:
parent
8c3aa6542e
commit
205db7d3b6
7 changed files with 71 additions and 0 deletions
|
|
@ -1,6 +1,10 @@
|
|||
#include "ui/auth_screen.hpp"
|
||||
#include "auth/crypto.hpp"
|
||||
#include "core/application.hpp"
|
||||
#include "core/logger.hpp"
|
||||
#include "rendering/renderer.hpp"
|
||||
#include "pipeline/asset_manager.hpp"
|
||||
#include "audio/music_manager.hpp"
|
||||
#include <imgui.h>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
|
@ -71,6 +75,23 @@ void AuthScreen::render(auth::AuthHandler& authHandler) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!musicInitAttempted) {
|
||||
musicInitAttempted = true;
|
||||
auto& app = core::Application::getInstance();
|
||||
auto* renderer = app.getRenderer();
|
||||
auto* assets = app.getAssetManager();
|
||||
if (renderer) {
|
||||
auto* music = renderer->getMusicManager();
|
||||
if (music && assets && assets->isInitialized() && !music->isInitialized()) {
|
||||
music->initialize(assets);
|
||||
}
|
||||
if (music && !musicPlaying) {
|
||||
music->playFilePath("assets/20-taverns.mp3", true);
|
||||
musicPlaying = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(500, 400), ImGuiCond_FirstUseEver);
|
||||
ImGui::Begin("WoW 3.3.5a Authentication", nullptr, ImGuiWindowFlags_NoCollapse);
|
||||
|
||||
|
|
@ -197,6 +218,17 @@ void AuthScreen::render(auth::AuthHandler& authHandler) {
|
|||
ImGui::End();
|
||||
}
|
||||
|
||||
void AuthScreen::stopLoginMusic() {
|
||||
if (!musicPlaying) return;
|
||||
auto& app = core::Application::getInstance();
|
||||
auto* renderer = app.getRenderer();
|
||||
if (!renderer) return;
|
||||
auto* music = renderer->getMusicManager();
|
||||
if (!music) return;
|
||||
music->stopMusic(500.0f);
|
||||
musicPlaying = false;
|
||||
}
|
||||
|
||||
void AuthScreen::attemptAuth(auth::AuthHandler& authHandler) {
|
||||
// Validate inputs
|
||||
if (strlen(username) == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue