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

Corrige problemas

This commit is contained in:
Danilo 2024-04-26 10:37:49 -03:00
parent 3fcb8c26bf
commit 0525626982
6 changed files with 31 additions and 13 deletions

View File

@ -3,7 +3,7 @@
# #
# Add source to this project's executable. # Add source to this project's executable.
add_executable (xna WIN32 "xna.cpp" "xna.h" "platform/window-dx.cpp" "platform/device-dx.cpp" "platform/adapter-dx.cpp" "platform/swapchain-dx.cpp" "platform/rendertarget-dx.cpp" "platform/texture-dx.cpp" "platform/blendstate-dx.cpp" "platform/game-dx.cpp" "platform/clock-dx.cpp" "csharp/stream.cpp" "platform/gdevicemanager-dx.cpp" "platform/vertexinput-dx.cpp" "platform/shader-dx.cpp" "platform/rasterizerstate-dx.cpp" "platform/vertexbuffer-dx.cpp" "platform/indexbuffer-dx.cpp" "common/matrix.cpp" "platform/constbuffer-dx.cpp" "platform/databuffer-dx.cpp" "platform/samplerstate-dx.cpp" "platform/spritebatch-dx.cpp" "platform/spritefont-dx.cpp" "platform/depthstencilstate-dx.cpp" "platform/keyboard-dx.cpp" "platform/mouse-dx.cpp" "platform/gamepad-dx.cpp" "common/vectors.cpp" "platform/soundeffect-dx.cpp" "platform/displaymode-dx.cpp") add_executable (xna WIN32 "xna.cpp" "xna.h" "platform/window-dx.cpp" "platform/device-dx.cpp" "platform/adapter-dx.cpp" "platform/swapchain-dx.cpp" "platform/rendertarget-dx.cpp" "platform/texture-dx.cpp" "platform/blendstate-dx.cpp" "platform/game-dx.cpp" "platform/clock-dx.cpp" "csharp/stream.cpp" "platform/gdevicemanager-dx.cpp" "platform/vertexinput-dx.cpp" "platform/shader-dx.cpp" "platform/rasterizerstate-dx.cpp" "platform/vertexbuffer-dx.cpp" "platform/indexbuffer-dx.cpp" "common/matrix.cpp" "platform/constbuffer-dx.cpp" "platform/databuffer-dx.cpp" "platform/samplerstate-dx.cpp" "platform/spritebatch-dx.cpp" "platform/spritefont-dx.cpp" "platform/depthstencilstate-dx.cpp" "platform/keyboard-dx.cpp" "platform/mouse-dx.cpp" "platform/gamepad-dx.cpp" "common/vectors.cpp" "platform/soundeffect-dx.cpp" "platform/displaymode-dx.cpp" "platform/presentparameters-dx.cpp")
if (CMAKE_VERSION VERSION_GREATER 3.12) if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET xna PROPERTY CXX_STANDARD 20) set_property(TARGET xna PROPERTY CXX_STANDARD 20)

View File

@ -19,19 +19,19 @@ namespace xna {
_adapter = value; _adapter = value;
} }
constexpr virtual xna::PresentationParameters PresentationParameters() const override{ virtual xna::PresentationParameters PresentationParameters() const override{
return _parameters; return _parameters;
}; };
constexpr virtual void PresentationParameters(xna::PresentationParameters const& value) override{ virtual void PresentationParameters(xna::PresentationParameters const& value) override{
_parameters = value; _parameters = value;
}; };
constexpr virtual xna::GraphicsProfile GraphicsProfile() const override { virtual xna::GraphicsProfile GraphicsProfile() const override {
return _profile; return _profile;
}; };
constexpr virtual void GraphicsProfile(xna::GraphicsProfile value) override { virtual void GraphicsProfile(xna::GraphicsProfile value) override {
_profile = value; _profile = value;
}; };

View File

@ -41,13 +41,15 @@ namespace xna {
BOOL state = false; BOOL state = false;
auto hr = swap->dxSwapChain->GetFullscreenState(&state, nullptr); auto hr = swap->dxSwapChain->GetFullscreenState(&state, nullptr);
if (FAILED(hr)) return; if (FAILED(hr)) return false;
hr = swap->dxSwapChain->SetFullscreenState(!state, nullptr); hr = swap->dxSwapChain->SetFullscreenState(!state, nullptr);
if (FAILED(hr)) return; if (FAILED(hr)) return false;
_isFullScreen = !state; _isFullScreen = !state;
return true;
} }
void GraphicsDeviceManager::PreferredBackBufferWidth(Int value) { void GraphicsDeviceManager::PreferredBackBufferWidth(Int value) {
@ -66,10 +68,11 @@ namespace xna {
_information._parameters.backBufferHeight = _backBufferHeight; _information._parameters.backBufferHeight = _backBufferHeight;
} }
initWindow(); auto result = initWindow();
initDevice();
if (!result) return false;
return true; return initDevice();
} }
void GraphicsDeviceManager::ChangeDevice() { void GraphicsDeviceManager::ChangeDevice() {
@ -108,5 +111,7 @@ namespace xna {
} }
_game->_graphicsDevice = _device; _game->_graphicsDevice = _device;
return true;
} }
} }

View File

@ -2,6 +2,7 @@
#define XNA_PLATFORM_GDEVICEMANAGER_DX_HPP #define XNA_PLATFORM_GDEVICEMANAGER_DX_HPP
#include "../game/gdevicemanager.hpp" #include "../game/gdevicemanager.hpp"
#include "gdeviceinfo-dx.hpp"
namespace xna { namespace xna {
class GraphicsDeviceManager : public IGraphicsDeviceManager { class GraphicsDeviceManager : public IGraphicsDeviceManager {

View File

@ -0,0 +1,11 @@
#include "presentparameters-dx.hpp"
#include "gdevicemanager-dx.hpp"
namespace xna {
PresentationParameters::PresentationParameters() :
backBufferWidth(GraphicsDeviceManager::DefaultBackBufferWidth),
backBufferHeight(GraphicsDeviceManager::DefaultBackBufferHeight) {
}
}

View File

@ -2,12 +2,13 @@
#define XNA_PLATFORM_PRESENTPARAMETERS_DX_HPP #define XNA_PLATFORM_PRESENTPARAMETERS_DX_HPP
#include "../graphics/presentparams.hpp" #include "../graphics/presentparams.hpp"
#include "gdevicemanager-dx.hpp"
#include "dxheaders.hpp" #include "dxheaders.hpp"
namespace xna { namespace xna {
class PresentationParameters : public IPresentationParameters { class PresentationParameters : public IPresentationParameters {
public: public:
PresentationParameters();
virtual constexpr Uint BackBufferWidth() const override { virtual constexpr Uint BackBufferWidth() const override {
return backBufferWidth; return backBufferWidth;
} }
@ -37,8 +38,8 @@ namespace xna {
} }
public: public:
Uint backBufferWidth { GraphicsDeviceManager::DefaultBackBufferWidth }; Uint backBufferWidth {0 };
Uint backBufferHeight{ GraphicsDeviceManager::DefaultBackBufferHeight }; Uint backBufferHeight{ 0 };
SurfaceFormat backBufferFormat{ SurfaceFormat::Color }; SurfaceFormat backBufferFormat{ SurfaceFormat::Color };
SwapEffect swapEffect{ SwapEffect::FlipDiscard }; SwapEffect swapEffect{ SwapEffect::FlipDiscard };
HWND windowHandle = nullptr; HWND windowHandle = nullptr;