From dd43a0c1ed06425ba6885f8f4ba203fb490fed3a Mon Sep 17 00:00:00 2001 From: Danilo Date: Wed, 31 Jul 2024 17:07:06 -0300 Subject: [PATCH] Implementa ScreenDeviceName --- framework/platform-dx/gdevicemanager.cpp | 63 +----------------------- framework/platform-dx/window.cpp | 4 +- inc/xna/game/gdevicemanager.hpp | 6 +-- 3 files changed, 5 insertions(+), 68 deletions(-) diff --git a/framework/platform-dx/gdevicemanager.cpp b/framework/platform-dx/gdevicemanager.cpp index a34f63b..464cbbd 100644 --- a/framework/platform-dx/gdevicemanager.cpp +++ b/framework/platform-dx/gdevicemanager.cpp @@ -16,16 +16,7 @@ namespace xna { parameters->IsFullscreen = false; _information.PresentParameters = parameters; _information.Window = game->Window(); - } - - bool GraphicsDeviceManager::Initialize() { - if (!game) - return false; - - CreateDevice(); - - return true; - } + } void GraphicsDeviceManager::ApplyChanges() { if (device && !isDeviceDirty) @@ -53,58 +44,6 @@ namespace xna { return true; } - - bool initWindow(GraphicsDeviceInformation& info, Game& game, int backWidth, int backHeight) - { - auto window = info.Window; - - if (!window) { - window = game.Window(); - info.Window = window; - } - - window->impl->Size(backWidth, backHeight); - - if (!window->impl->Create()) { - MessageBox(nullptr, "Falha na criação da janela", "XN65", MB_OK); - return false; - } - - info.PresentParameters->DeviceWindowHandle = reinterpret_cast(window->impl->WindowHandle()); - - return true; - } - - bool initDevice(GraphicsDeviceInformation& info, Game& game, sptr& device) - { - device = snew(info); - - if (!device->Initialize()) { - MessageBox(info.Window->impl->WindowHandle(), "Falha na inicialização do dispositivo gráfico", "XN65", MB_OK); - device = nullptr; - return false; - } - - game.graphicsDevice = device; - - return true; - } - - void GraphicsDeviceManager::CreateDevice() { - if (isDeviceDirty) { - _information.PresentParameters->BackBufferWidth = backBufferWidth; - _information.PresentParameters->BackBufferHeight = backBufferHeight; - } - - //auto result = initWindow(_information, *game, backBufferWidth, backBufferHeight); - - //if (!result) return false; - - initDevice(_information, *game, device); - } - - void GraphicsDeviceManager::ChangeDevice() { - } void GraphicsDeviceManager::ChangeDevice(bool forceCreate) { if (!game) diff --git a/framework/platform-dx/window.cpp b/framework/platform-dx/window.cpp index f73b11e..3f54760 100644 --- a/framework/platform-dx/window.cpp +++ b/framework/platform-dx/window.cpp @@ -248,7 +248,7 @@ namespace xna { } String GameWindow::ScreenDeviceName() const { - //TODO - return std::string(); + const auto screen = ScreenFromHandle(handle); + return screen->DeviceName(); } } \ No newline at end of file diff --git a/inc/xna/game/gdevicemanager.hpp b/inc/xna/game/gdevicemanager.hpp index 1c678f0..a9d192d 100644 --- a/inc/xna/game/gdevicemanager.hpp +++ b/inc/xna/game/gdevicemanager.hpp @@ -141,11 +141,9 @@ namespace xna { bool Initialize(); bool ToggleFullScreen(); + inline void CreateDevice() { ChangeDevice(true); } - protected: - void CreateDevice(); - void ChangeDevice(); - + protected: inline virtual void RankDevices(std::vector>& foundDevices) { RankDevicesPlatform(foundDevices); }