mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
Corrige PresentationParameters
This commit is contained in:
parent
c35067ff72
commit
f2e613b051
@ -32,7 +32,7 @@ add_executable (xna WIN32
|
||||
"platform/gamepad-dx.cpp"
|
||||
"platform/soundeffect-dx.cpp"
|
||||
"platform/displaymode-dx.cpp"
|
||||
"platform/presentparameters-dx.cpp"
|
||||
|
||||
"game/component.cpp"
|
||||
"content/manager.cpp"
|
||||
"content/reader.cpp"
|
||||
|
@ -18,7 +18,10 @@ namespace xna {
|
||||
GraphicsDevice::GraphicsDevice(GraphicsDeviceInformation const& info) {
|
||||
_adapter = info.Adapter();
|
||||
_presentationParameters = info.PresentationParameters();
|
||||
_adapter->CurrentDisplayMode(_presentationParameters.backBufferFormat, _presentationParameters.backBufferWidth, _presentationParameters.backBufferHeight);
|
||||
_adapter->CurrentDisplayMode(
|
||||
_presentationParameters.BackBufferFormat,
|
||||
_presentationParameters.BackBufferWidth,
|
||||
_presentationParameters.BackBufferHeight);
|
||||
}
|
||||
|
||||
bool GraphicsDevice::Initialize(GameWindow& gameWindow) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "platform-dx/game-dx.hpp"
|
||||
#include "platform-dx/window-dx.hpp"
|
||||
#include "platform-dx/gdeviceinfo-dx.hpp"
|
||||
#include "platform-dx/presentparameters-dx.hpp"
|
||||
#include "graphics/presentparams.hpp"
|
||||
|
||||
namespace xna {
|
||||
GraphicsDeviceManager::GraphicsDeviceManager(Game*& game) : _game(game) {
|
||||
@ -12,10 +12,10 @@ namespace xna {
|
||||
_information.GraphicsProfile(xna::GraphicsProfile::HiDef);
|
||||
|
||||
PresentationParameters parameters;
|
||||
parameters.backBufferWidth = _backBufferWidth;
|
||||
parameters.backBufferHeight = _backBufferHeight;
|
||||
parameters.backBufferFormat = SurfaceFormat::Color;
|
||||
parameters.fullscreen = false;
|
||||
parameters.BackBufferWidth = _backBufferWidth;
|
||||
parameters.BackBufferHeight = _backBufferHeight;
|
||||
parameters.BackBufferFormat = SurfaceFormat::Color;
|
||||
parameters.Fullscreen = false;
|
||||
_information.PresentationParameters(parameters);
|
||||
|
||||
if(_game) _information.Window(_game->Window());
|
||||
@ -63,8 +63,8 @@ namespace xna {
|
||||
|
||||
bool GraphicsDeviceManager::CreateDevice() {
|
||||
if (_isDeviceDirty) {
|
||||
_information._parameters.backBufferWidth = _backBufferWidth;
|
||||
_information._parameters.backBufferHeight = _backBufferHeight;
|
||||
_information._parameters.BackBufferWidth = _backBufferWidth;
|
||||
_information._parameters.BackBufferHeight = _backBufferHeight;
|
||||
}
|
||||
|
||||
auto result = initWindow();
|
||||
@ -93,7 +93,7 @@ namespace xna {
|
||||
return false;
|
||||
}
|
||||
|
||||
_information._parameters.windowHandle = window->WindowHandle();
|
||||
_information._parameters.DeviceWindowHandle = reinterpret_cast<intptr_t>(window->WindowHandle());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
#include "platform-dx/presentparameters-dx.hpp"
|
||||
#include "platform-dx/gdevicemanager-dx.hpp"
|
||||
|
||||
namespace xna {
|
||||
PresentationParameters::PresentationParameters() :
|
||||
backBufferWidth(GraphicsDeviceManager::DefaultBackBufferWidth),
|
||||
backBufferHeight(GraphicsDeviceManager::DefaultBackBufferHeight) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,23 +47,24 @@ namespace xna {
|
||||
|
||||
const auto parameters = m_device->_presentationParameters;
|
||||
|
||||
dxDescription.Width = static_cast<UINT>(parameters.backBufferWidth);
|
||||
dxDescription.Height = static_cast<UINT>(parameters.backBufferHeight);
|
||||
dxDescription.Format = DxHelpers::ConvertSurfaceToDXGIFORMAT(parameters.backBufferFormat);
|
||||
dxDescription.Width = static_cast<UINT>(parameters.BackBufferWidth);
|
||||
dxDescription.Height = static_cast<UINT>(parameters.BackBufferHeight);
|
||||
dxDescription.Format = DxHelpers::ConvertSurfaceToDXGIFORMAT(parameters.BackBufferFormat);
|
||||
dxDescription.SampleDesc.Count = 1;
|
||||
dxDescription.SampleDesc.Quality = 0;
|
||||
dxDescription.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
dxDescription.BufferCount = 2;
|
||||
dxDescription.SwapEffect = static_cast<DXGI_SWAP_EFFECT>(parameters.swapEffect);
|
||||
dxDescription.SwapEffect = static_cast<DXGI_SWAP_EFFECT>(parameters.PresentationSwapEffect);
|
||||
dxDescription.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
|
||||
dxDescription.AlphaMode = DXGI_ALPHA_MODE::DXGI_ALPHA_MODE_UNSPECIFIED;
|
||||
dxFullScreenDescription.RefreshRate.Numerator = 60;
|
||||
dxFullScreenDescription.RefreshRate.Denominator = 1;
|
||||
dxFullScreenDescription.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
|
||||
dxFullScreenDescription.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
|
||||
dxFullScreenDescription.Windowed = !parameters.fullscreen;
|
||||
dxFullScreenDescription.Windowed = !parameters.Fullscreen;
|
||||
|
||||
return internalInit(*m_device, parameters.windowHandle, dxSwapChain, dxDescription, dxFullScreenDescription);
|
||||
HWND hwnd = reinterpret_cast<HWND>(parameters.DeviceWindowHandle);
|
||||
return internalInit(*m_device, hwnd, dxSwapChain, dxDescription, dxFullScreenDescription);
|
||||
}
|
||||
|
||||
bool SwapChain::Initialize(GameWindow const& gameWindow, DXGI_SWAP_CHAIN_DESC1 const& desc, DXGI_SWAP_CHAIN_FULLSCREEN_DESC const& fullScreenDesc, xna_error_ptr_arg)
|
||||
|
@ -64,7 +64,7 @@ namespace xna {
|
||||
class GraphicsAdapter;
|
||||
class GraphicsDevice;
|
||||
class GraphicsDeviceInformation;
|
||||
class PresentationParameters;
|
||||
struct PresentationParameters;
|
||||
class RenderTarget2D;
|
||||
class SwapChain;
|
||||
class Texture;
|
||||
|
@ -4,13 +4,15 @@
|
||||
#include "../default.hpp"
|
||||
|
||||
namespace xna {
|
||||
class IPresentationParameters {
|
||||
virtual Uint BackBufferWidth() const = 0;
|
||||
virtual Uint BackBufferHeight() const = 0;
|
||||
virtual SurfaceFormat BackBufferFormat() const = 0;
|
||||
virtual SwapEffect PresentationSwapEffect() const = 0;
|
||||
virtual intptr_t DeviceWindowHandle() const = 0;
|
||||
virtual bool IsFullScreen() const = 0;
|
||||
struct PresentationParameters {
|
||||
constexpr PresentationParameters() = default;
|
||||
|
||||
Uint BackBufferWidth{ 0 };
|
||||
Uint BackBufferHeight{ 0 };
|
||||
SurfaceFormat BackBufferFormat{ SurfaceFormat::Color };
|
||||
SwapEffect PresentationSwapEffect{ SwapEffect::FlipDiscard };
|
||||
intptr_t DeviceWindowHandle{ 0 };
|
||||
bool Fullscreen{ false };
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "gdeviceinfo-dx.hpp"
|
||||
#include "swapchain-dx.hpp"
|
||||
#include "window-dx.hpp"
|
||||
#include "presentparameters-dx.hpp"
|
||||
#include "graphics/presentparams.hpp"
|
||||
|
||||
namespace xna {
|
||||
class GraphicsDevice : public IGraphicsDevice, public std::enable_shared_from_this<GraphicsDevice> {
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "../game/gdeviceinfo.hpp"
|
||||
#include "window-dx.hpp"
|
||||
#include "presentparameters-dx.hpp"
|
||||
#include "graphics/presentparams.hpp"
|
||||
|
||||
namespace xna {
|
||||
class GraphicsDeviceInformation : public IGraphicsDeviceInformation {
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "input/gamepad.hpp"
|
||||
#include "input/keyboard.hpp"
|
||||
#include "input/mouse.hpp"
|
||||
#include "platform-dx/presentparameters-dx.hpp"
|
||||
#include "graphics/presentparams.hpp"
|
||||
#include "platform-dx/rendertarget-dx.hpp"
|
||||
#include "platform-dx/swapchain-dx.hpp"
|
||||
|
||||
|
@ -1,50 +0,0 @@
|
||||
#ifndef XNA_PLATFORM_PRESENTPARAMETERS_DX_HPP
|
||||
#define XNA_PLATFORM_PRESENTPARAMETERS_DX_HPP
|
||||
|
||||
#include "../graphics/presentparams.hpp"
|
||||
#include "dxheaders.hpp"
|
||||
|
||||
namespace xna {
|
||||
class PresentationParameters : public IPresentationParameters {
|
||||
public:
|
||||
PresentationParameters();
|
||||
|
||||
virtual constexpr Uint BackBufferWidth() const override {
|
||||
return backBufferWidth;
|
||||
}
|
||||
|
||||
virtual constexpr Uint BackBufferHeight() const override {
|
||||
return backBufferHeight;
|
||||
}
|
||||
|
||||
virtual constexpr SurfaceFormat BackBufferFormat() const override {
|
||||
return backBufferFormat;
|
||||
}
|
||||
|
||||
virtual constexpr SwapEffect PresentationSwapEffect() const override {
|
||||
return swapEffect;
|
||||
}
|
||||
|
||||
virtual intptr_t DeviceWindowHandle() const override {
|
||||
return reinterpret_cast<intptr_t>(windowHandle);
|
||||
}
|
||||
|
||||
virtual constexpr bool IsFullScreen() const override {
|
||||
return fullscreen;
|
||||
}
|
||||
|
||||
HWND DeviceWindowHWND() const {
|
||||
return windowHandle;
|
||||
}
|
||||
|
||||
public:
|
||||
Uint backBufferWidth {0 };
|
||||
Uint backBufferHeight{ 0 };
|
||||
SurfaceFormat backBufferFormat{ SurfaceFormat::Color };
|
||||
SwapEffect swapEffect{ SwapEffect::FlipDiscard };
|
||||
HWND windowHandle = nullptr;
|
||||
bool fullscreen{ false };
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -7,7 +7,6 @@
|
||||
#include "gdeviceinfo-dx.hpp"
|
||||
#include "gdevicemanager-dx.hpp"
|
||||
#include "init-dx.hpp"
|
||||
#include "presentparameters-dx.hpp"
|
||||
#include "rasterizerstate-dx.hpp"
|
||||
#include "rendertarget-dx.hpp"
|
||||
#include "samplerstate-dx.hpp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user