emu_window_sdl2_null.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include <cstdlib>
  4. #include <memory>
  5. #include <string>
  6. #include <fmt/format.h>
  7. #include "common/logging/log.h"
  8. #include "common/scm_rev.h"
  9. #include "video_core/renderer_null/renderer_null.h"
  10. #include "yuzu_cmd/emu_window/emu_window_sdl2_null.h"
  11. #ifdef YUZU_USE_EXTERNAL_SDL2
  12. // Include this before SDL.h to prevent the external from including a dummy
  13. #define USING_GENERATED_CONFIG_H
  14. #include <SDL_config.h>
  15. #endif
  16. #include <SDL.h>
  17. EmuWindow_SDL2_Null::EmuWindow_SDL2_Null(InputCommon::InputSubsystem* input_subsystem_,
  18. Core::System& system_, bool fullscreen)
  19. : EmuWindow_SDL2{input_subsystem_, system_} {
  20. const std::string window_title = fmt::format("yuzu {} | {}-{} (Vulkan)", Common::g_build_name,
  21. Common::g_scm_branch, Common::g_scm_desc);
  22. render_window =
  23. SDL_CreateWindow(window_title.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
  24. Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height,
  25. SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
  26. SetWindowIcon();
  27. if (fullscreen) {
  28. Fullscreen();
  29. ShowCursor(false);
  30. }
  31. OnResize();
  32. OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);
  33. SDL_PumpEvents();
  34. LOG_INFO(Frontend, "yuzu Version: {} | {}-{} (Null)", Common::g_build_name,
  35. Common::g_scm_branch, Common::g_scm_desc);
  36. }
  37. EmuWindow_SDL2_Null::~EmuWindow_SDL2_Null() = default;
  38. std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_Null::CreateSharedContext() const {
  39. return std::make_unique<DummyContext>();
  40. }