diff --git a/framework/platform-dx/gdevicemanager.cpp b/framework/platform-dx/gdevicemanager.cpp index 464cbbd..b124720 100644 --- a/framework/platform-dx/gdevicemanager.cpp +++ b/framework/platform-dx/gdevicemanager.cpp @@ -6,16 +6,16 @@ namespace xna { GraphicsDeviceManager::GraphicsDeviceManager(sptr const& game) : game(game) { sptr adp = GraphicsAdapter::DefaultAdapter(); - _information.Adapter = adp; - _information.Profile = xna::GraphicsProfile::HiDef; + information.Adapter = adp; + information.Profile = xna::GraphicsProfile::HiDef; auto parameters = snew(); parameters->BackBufferWidth = backBufferWidth; parameters->BackBufferHeight = backBufferHeight; parameters->BackBufferFormat = SurfaceFormat::Color; parameters->IsFullscreen = false; - _information.PresentParameters = parameters; - _information.Window = game->Window(); + information.PresentParameters = parameters; + information.Window = game->Window(); } void GraphicsDeviceManager::ApplyChanges() { diff --git a/inc/xna/game/gdevicemanager.hpp b/inc/xna/game/gdevicemanager.hpp index a9d192d..0c09a22 100644 --- a/inc/xna/game/gdevicemanager.hpp +++ b/inc/xna/game/gdevicemanager.hpp @@ -9,16 +9,16 @@ namespace xna { struct IGraphicsDeviceService { virtual sptr GetGraphicsDevice() = 0; - EventHandler DeviceDisposing; - EventHandler DeviceReset; - EventHandler DeviceResetting; - EventHandler DeviceCreated; + //EventHandler DeviceDisposing; + //EventHandler DeviceReset; + //EventHandler DeviceResetting; + //EventHandler DeviceCreated; }; class IGraphicsDeviceManager { virtual void CreateDevice() = 0; - virtual bool BeginDraw() = 0; - virtual void EndDraw() = 0; + //virtual bool BeginDraw() = 0; + //virtual void EndDraw() = 0; }; class GraphicsDeviceManager : public IGraphicsDeviceService, public IGraphicsDeviceManager { @@ -104,10 +104,12 @@ namespace xna { isDeviceDirty = true; } + //Gets or sets a value that indicates whether to enable a multisampled back buffer. constexpr bool PreferMultiSampling() const { return allowMultiSampling; } + //Gets or sets a value that indicates whether to enable a multisampled back buffer. constexpr void PreferMultiSampling(bool value) { allowMultiSampling = value; isDeviceDirty = true; @@ -138,36 +140,22 @@ namespace xna { public: //Applies any changes to device-related properties, changing the graphics device as necessary. void ApplyChanges(); - bool Initialize(); + //Toggles between full screen and windowed mode. bool ToggleFullScreen(); - - inline void CreateDevice() { ChangeDevice(true); } protected: - inline virtual void RankDevices(std::vector>& foundDevices) { - RankDevicesPlatform(foundDevices); - } - - inline virtual sptr FindBestDevice(bool anySuitableDevice) { - return FindBestPlatformDevice(anySuitableDevice); - } - + inline virtual void RankDevices(std::vector>& foundDevices) { RankDevicesPlatform(foundDevices); } + inline virtual sptr FindBestDevice(bool anySuitableDevice) { return FindBestPlatformDevice(anySuitableDevice); } virtual bool CanResetDevice(GraphicsDeviceInformation& newDeviceInfo); private: + inline void CreateDevice() { ChangeDevice(true); } void ChangeDevice(bool forceCreate); void AddDevices(bool anySuitableDevice, std::vector>& foundDevices); - void AddDevices(GraphicsAdapter const& adapter, DisplayMode const& mode, sptr& baseDeviceInfo, std::vector>& foundDevices) const; - - bool BeginDraw() override { return false; } - void EndDraw() override{ } - + void AddDevices(GraphicsAdapter const& adapter, DisplayMode const& mode, sptr& baseDeviceInfo, std::vector>& foundDevices) const; sptr FindBestPlatformDevice(bool anySuitableDevice); - void RankDevicesPlatform(std::vector>& foundDevices); - - void CreateDevice(GraphicsDeviceInformation& newInfo); - + void CreateDevice(GraphicsDeviceInformation& newInfo); void MassagePresentParameters(PresentationParameters& pp); void ValidateGraphicsDeviceInformation(GraphicsDeviceInformation& devInfo); @@ -175,8 +163,7 @@ namespace xna { sptr game = nullptr; bool isDeviceDirty{ false }; sptr device = nullptr; - GraphicsDeviceInformation _information{}; - + GraphicsDeviceInformation information{}; bool isFullScreen{ false }; Int backBufferWidth{ DefaultBackBufferWidth }; Int backBufferHeight{ DefaultBackBufferHeight }; @@ -192,7 +179,6 @@ namespace xna { bool inDeviceTransition{ false }; bool isReallyFullScreen{ false }; DisplayOrientation currentWindowOrientation{ DisplayOrientation::Default }; - std::vector> foundDevices; }; }