diff --git a/framework/platform-dx/soundeffect.cpp b/framework/platform-dx/soundeffect.cpp index 6ddb870..261aa00 100644 --- a/framework/platform-dx/soundeffect.cpp +++ b/framework/platform-dx/soundeffect.cpp @@ -88,15 +88,15 @@ namespace xna { void SoundEffect::Play() { if (!impl->_dxSoundEffect) return; - - impl->_dxSoundEffect->Play(); + + impl->_dxSoundEffect->Play(); } void SoundEffect::Play(float volume, float pitch, float pan) { if (!impl->_dxSoundEffect) - return; - - impl->_dxSoundEffect->Play(volume, pitch, pan); + return; + + impl->_dxSoundEffect->Play(volume, pitch, pan); } uptr SoundEffect::CreateInstance() { diff --git a/inc/game/gdevicemanager.hpp b/inc/game/gdevicemanager.hpp index 4f0a1ff..4f00060 100644 --- a/inc/game/gdevicemanager.hpp +++ b/inc/game/gdevicemanager.hpp @@ -19,7 +19,7 @@ namespace xna { public: static constexpr int DefaultBackBufferWidth = 800; - static constexpr int DefaultBackBufferHeight = 600; + static constexpr int DefaultBackBufferHeight = 480; protected: bool CreateDevice(); diff --git a/inc/platform-dx/implementations.hpp b/inc/platform-dx/implementations.hpp index a33e718..8b692a3 100644 --- a/inc/platform-dx/implementations.hpp +++ b/inc/platform-dx/implementations.hpp @@ -406,7 +406,7 @@ namespace xna { HINSTANCE _hInstance{ nullptr }; HWND _windowHandle{ nullptr }; int _windowWidth{ 800 }; - int _windowHeight{ 600 }; + int _windowHeight{ 480 }; HICON _windowIcon{ nullptr }; HCURSOR _windowCursor{ nullptr }; COLORREF _windowColor{ RGB(0,0,0) }; diff --git a/samples/02_PlatfformerStarterKit/game.cpp b/samples/02_PlatfformerStarterKit/game.cpp index 1f47d48..e9bfee1 100644 --- a/samples/02_PlatfformerStarterKit/game.cpp +++ b/samples/02_PlatfformerStarterKit/game.cpp @@ -20,9 +20,7 @@ namespace PlatformerStarterKit { void Initialize() override { auto game = reinterpret_cast(this); - graphics = New(game->shared_from_this()); - graphics->PreferredBackBufferWidth(BackBufferWidth); - graphics->PreferredBackBufferHeight(BackBufferHeight); + graphics = New(game->shared_from_this()); graphics->Initialize(); std::any device = graphicsDevice; @@ -130,11 +128,9 @@ namespace PlatformerStarterKit { sptr diedOverlay = nullptr; int levelIndex = -1; sptr level = nullptr; - bool wasContinuePressed; + bool wasContinuePressed = false; TimeSpan WarningTime = TimeSpan::FromSeconds(30); static constexpr int TargetFrameRate = 60; - static constexpr int BackBufferWidth = 1280; - static constexpr int BackBufferHeight = 720; static constexpr Buttons ContinueButton = Buttons::A; }; } diff --git a/samples/02_PlatfformerStarterKit/gem.cpp b/samples/02_PlatfformerStarterKit/gem.cpp index d562288..49ff501 100644 --- a/samples/02_PlatfformerStarterKit/gem.cpp +++ b/samples/02_PlatfformerStarterKit/gem.cpp @@ -28,7 +28,7 @@ namespace PlatformerStarterKit { void Gem::OnCollected(xna::sptr& collectedBy) { - collectedSound->Play(); + collectedSound->Play(); } void Gem::Draw(xna::GameTime const& gameTime, xna::SpriteBatch& spriteBatch) diff --git a/samples/02_PlatfformerStarterKit/level.cpp b/samples/02_PlatfformerStarterKit/level.cpp index 761207f..384232e 100644 --- a/samples/02_PlatfformerStarterKit/level.cpp +++ b/samples/02_PlatfformerStarterKit/level.cpp @@ -186,10 +186,9 @@ namespace PlatformerStarterKit { for (size_t y = 0; y < Height(); ++y) { for (size_t x = 0; x < Width(); ++x) { auto& texture = tiles[x][y].Texture; - if (texture) { - const auto p = xna::Vector2(x, y); + if (texture) { const auto s = xna::Vector2(x, y); - const auto position = p * s; + const auto position = s * Tile::Size(); spriteBatch.Draw(texture, position, xna::Colors::White); } } diff --git a/samples/02_PlatfformerStarterKit/tile.hpp b/samples/02_PlatfformerStarterKit/tile.hpp index 9435b8a..f2374a7 100644 --- a/samples/02_PlatfformerStarterKit/tile.hpp +++ b/samples/02_PlatfformerStarterKit/tile.hpp @@ -12,8 +12,8 @@ namespace PlatformerStarterKit { struct Tile { xna::PTexture2D Texture = nullptr; TileCollision Collision{}; - constexpr static int Width = 64; - constexpr static int Height = 48; + constexpr static int Width = 40; + constexpr static int Height = 32; constexpr static xna::Vector2 Size() { return{ Width, Height };