mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
Implementa ScreenDeviceName
This commit is contained in:
parent
d70cac0d77
commit
dd43a0c1ed
@ -16,16 +16,7 @@ namespace xna {
|
|||||||
parameters->IsFullscreen = false;
|
parameters->IsFullscreen = false;
|
||||||
_information.PresentParameters = parameters;
|
_information.PresentParameters = parameters;
|
||||||
_information.Window = game->Window();
|
_information.Window = game->Window();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphicsDeviceManager::Initialize() {
|
|
||||||
if (!game)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
CreateDevice();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GraphicsDeviceManager::ApplyChanges() {
|
void GraphicsDeviceManager::ApplyChanges() {
|
||||||
if (device && !isDeviceDirty)
|
if (device && !isDeviceDirty)
|
||||||
@ -53,58 +44,6 @@ namespace xna {
|
|||||||
|
|
||||||
return true;
|
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) {
|
void GraphicsDeviceManager::ChangeDevice(bool forceCreate) {
|
||||||
if (!game)
|
if (!game)
|
||||||
|
@ -248,7 +248,7 @@ namespace xna {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String GameWindow::ScreenDeviceName() const {
|
String GameWindow::ScreenDeviceName() const {
|
||||||
//TODO
|
const auto screen = ScreenFromHandle(handle);
|
||||||
return std::string();
|
return screen->DeviceName();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -141,11 +141,9 @@ namespace xna {
|
|||||||
bool Initialize();
|
bool Initialize();
|
||||||
bool ToggleFullScreen();
|
bool ToggleFullScreen();
|
||||||
|
|
||||||
|
inline void CreateDevice() { ChangeDevice(true); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void CreateDevice();
|
|
||||||
void ChangeDevice();
|
|
||||||
|
|
||||||
inline virtual void RankDevices(std::vector<sptr<GraphicsDeviceInformation>>& foundDevices) {
|
inline virtual void RankDevices(std::vector<sptr<GraphicsDeviceInformation>>& foundDevices) {
|
||||||
RankDevicesPlatform(foundDevices);
|
RankDevicesPlatform(foundDevices);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user