1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00

Implementa ScreenDeviceName

This commit is contained in:
Danilo 2024-07-31 17:07:06 -03:00
parent d70cac0d77
commit dd43a0c1ed
3 changed files with 5 additions and 68 deletions

View File

@ -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<intptr_t>(window->impl->WindowHandle());
return true;
}
bool initDevice(GraphicsDeviceInformation& info, Game& game, sptr<GraphicsDevice>& device)
{
device = snew<GraphicsDevice>(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)

View File

@ -248,7 +248,7 @@ namespace xna {
}
String GameWindow::ScreenDeviceName() const {
//TODO
return std::string();
const auto screen = ScreenFromHandle(handle);
return screen->DeviceName();
}
}

View File

@ -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<sptr<GraphicsDeviceInformation>>& foundDevices) {
RankDevicesPlatform(foundDevices);
}