|
3 | 3 | #include "helper/sleep.hpp" |
4 | 4 | #include "platform/capabilities.hpp" |
5 | 5 | #include "scenes/scene.hpp" |
6 | | -#include "types.h" |
7 | 6 |
|
| 7 | +#include <chrono> |
8 | 8 | #include <ranges> |
9 | 9 |
|
10 | 10 | #if defined(__SWITCH__) |
@@ -50,25 +50,6 @@ void Application::run() { |
50 | 50 | const double count_per_s = static_cast<double>(SDL_GetPerformanceFrequency()); |
51 | 51 | u64 frame_counter = 0; |
52 | 52 | #endif |
53 | | - |
54 | | - |
55 | | -#if defined(_HAVE_DISCORD_SDK) |
56 | | - auto discord_instance = DiscordInstance::initialize(); |
57 | | - if (not discord_instance.has_value()) { |
58 | | - spdlog::warn("Error initializing the discord instance, it might not be running: {}", discord_instance.error()); |
59 | | - } else { |
60 | | - m_discord_instance = std::move(discord_instance.value()); |
61 | | - m_discord_instance->after_setup(); |
62 | | - |
63 | | - m_discord_instance->set_activity( |
64 | | - DiscordActivityWrapper("Selecting playmode", discord::ActivityType::Playing) |
65 | | - .add_large_image("Playing OOPetris", constants::discord::ArtAsset::logo) |
66 | | - ); |
67 | | - } |
68 | | - |
69 | | -#endif |
70 | | - |
71 | | - |
72 | 53 | using namespace std::chrono_literals; |
73 | 54 |
|
74 | 55 | const auto sleep_time = m_target_framerate.has_value() ? std::chrono::duration_cast<std::chrono::nanoseconds>(1s) |
@@ -240,6 +221,18 @@ void Application::render() const { |
240 | 221 | } |
241 | 222 |
|
242 | 223 | void Application::initialize() { |
| 224 | + |
| 225 | +#if defined(_HAVE_DISCORD_SDK) |
| 226 | + auto discord_instance = DiscordInstance::initialize(); |
| 227 | + if (not discord_instance.has_value()) { |
| 228 | + spdlog::warn("Error initializing the discord instance, it might not be running: {}", discord_instance.error()); |
| 229 | + } else { |
| 230 | + m_discord_instance = std::move(discord_instance.value()); |
| 231 | + m_discord_instance->after_setup(); |
| 232 | + } |
| 233 | + |
| 234 | +#endif |
| 235 | + |
243 | 236 | try_load_settings(); |
244 | 237 | load_resources(); |
245 | 238 | push_scene(scenes::create_scene(*this, SceneId::MainMenu, ui::FullScreenLayout{ m_window })); |
|
0 commit comments