diff --git a/framework/platform-dx/game.cpp b/framework/platform-dx/game.cpp index e673ef6..a52595a 100644 --- a/framework/platform-dx/game.cpp +++ b/framework/platform-dx/game.cpp @@ -8,21 +8,21 @@ namespace xna { contentManager = snew(services, ""); contentManager->mainGameService = iservice; - _gameWindow = snew(); - _gameWindow->impl->Color(146, 150, 154); - _gameWindow->Title("XN65"); - _gameWindow->impl->Size( + gameWindow = snew(); + gameWindow->impl->Color(146, 150, 154); + gameWindow->Title("XN65"); + gameWindow->impl->Size( GraphicsDeviceManager::DefaultBackBufferWidth, GraphicsDeviceManager::DefaultBackBufferHeight, false); - _gameComponents = snew(); + gameComponents = snew(); IsFixedTimeStep(isFixedTimeStep); TargetElapsedTime(targetElapsedTime); } void Game::Exit() { - _gameWindow->impl->Close(); + gameWindow->impl->Close(); } int Game::StartGameLoop() { @@ -54,13 +54,13 @@ namespace xna { const auto total = impl->_stepTimer.GetTotalSeconds(); const auto elapsedTimeSpan = TimeSpan::FromSeconds(elapsed); const auto totalTimeSpan = TimeSpan::FromSeconds(total); - _currentGameTime.ElapsedGameTime = elapsedTimeSpan; - _currentGameTime.TotalGameTime = totalTimeSpan; - Update(_currentGameTime); + currentGameTime.ElapsedGameTime = elapsedTimeSpan; + currentGameTime.TotalGameTime = totalTimeSpan; + Update(currentGameTime); }); BeginDraw(); - Draw(_currentGameTime); + Draw(currentGameTime); EndDraw(); } @@ -69,7 +69,7 @@ namespace xna { return EXIT_FAILURE; try { - if (!_gameWindow->impl->Create()) { + if (!gameWindow->impl->Create()) { Exception::Throw(Exception::FAILED_TO_CREATE); return false; } @@ -93,7 +93,7 @@ namespace xna { void Game::Initialize() { Keyboard::Initialize(); - Mouse::Initialize(_gameWindow->Handle()); + Mouse::Initialize(gameWindow->Handle()); GamePad::Initialize(); AudioEngine::Initialize(); @@ -101,16 +101,16 @@ namespace xna { } void Game::Draw(GameTime const& gameTime) { - if (_enabledGameComponents && !_drawableGameComponents.empty()) { - const auto count = _drawableGameComponents.size(); + if (enabledGameComponents && !drawableGameComponents.empty()) { + const auto count = drawableGameComponents.size(); - if (count != _drawableGameComponentsCount && _gameComponents->AutoSort) { - GameComponentCollection::DrawSort(_drawableGameComponents); - _drawableGameComponentsCount = count; + if (count != drawableGameComponentsCount && gameComponents->AutoSort) { + GameComponentCollection::DrawSort(drawableGameComponents); + drawableGameComponentsCount = count; } for (size_t i = 0; i < count; ++i) { - auto& component = _drawableGameComponents[i]; + auto& component = drawableGameComponents[i]; if (!component) continue; @@ -120,24 +120,24 @@ namespace xna { drawable->Draw(gameTime); } - _drawableGameComponents.clear(); + drawableGameComponents.clear(); } graphicsDevice->Present(); } void Game::Update(GameTime const& gameTime) { - _audioEngine->Update(); + audioEngine->Update(); - if (_enabledGameComponents && _gameComponents->Count() > 0) { - const auto count = _gameComponents->Count(); + if (enabledGameComponents && gameComponents->Count() > 0) { + const auto count = gameComponents->Count(); for (size_t i = 0; i < count; ++i) { - auto component = _gameComponents->At(i); + auto component = gameComponents->At(i); if (!component) continue; if (component->Type() == GameComponentType::Drawable) { - _drawableGameComponents.push_back(component); + drawableGameComponents.push_back(component); } auto updatable = reinterpret_pointer_cast(component); @@ -148,25 +148,25 @@ namespace xna { } } - sptr Game::Window() { return _gameWindow; } + sptr Game::Window() { return gameWindow; } sptr Game::Device() const { return graphicsDevice; } - sptr Game::Components() const { return _gameComponents; } + sptr Game::Components() const { return gameComponents; } sptr Game::Services() { return services; } sptr Game::Content() const { return contentManager; } - void Game::EnableGameComponents(bool value) { _enabledGameComponents = value; } + void Game::EnableGameComponents(bool value) { enabledGameComponents = value; } void Game::AttachGraphicsDevice(sptr const& device) { graphicsDevice = device; } void Game::ResizeWindow(int width, int heigth) { - const auto windowBounds = _gameWindow->ClientBounds(); + const auto windowBounds = gameWindow->ClientBounds(); if (windowBounds.Width != width || windowBounds.Height != heigth) { - _gameWindow->impl->Size( + gameWindow->impl->Size( width, heigth); - _gameWindow->impl->Update(); + gameWindow->impl->Update(); } } diff --git a/inc/xna/game/game.hpp b/inc/xna/game/game.hpp index 2ac9070..5cccc65 100644 --- a/inc/xna/game/game.hpp +++ b/inc/xna/game/game.hpp @@ -76,14 +76,14 @@ namespace xna { private: friend class GraphicsDeviceManager; - sptr _gameComponents = nullptr; - sptr _gameWindow{ nullptr }; - sptr _audioEngine = nullptr; + sptr gameComponents = nullptr; + sptr gameWindow{ nullptr }; + sptr audioEngine = nullptr; sptr contentManager; - std::vector> _drawableGameComponents; - size_t _drawableGameComponentsCount{ 0 }; - bool _enabledGameComponents{ false }; - GameTime _currentGameTime{}; + std::vector> drawableGameComponents; + size_t drawableGameComponentsCount{ 0 }; + bool enabledGameComponents{ false }; + GameTime currentGameTime{}; bool isFixedTimeStep{ true }; TimeSpan targetElapsedTime{ TimeSpan::FromTicks(166667L) }; bool isRunning{ false }; diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 45257e9..24ef843 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -4,4 +4,4 @@ # Add source to this project's executable. add_subdirectory ("01_blank") -add_subdirectory ("02_PlatfformerStarterKit") +#add_subdirectory ("02_PlatfformerStarterKit")