Hi,
I'm starting out with C++ and DirectX and I decided to follow along with the micrsoft github tutorial on DirectX12 found here The basic game loop * Microsoft/DirectXTK Wiki * GitHub.
I installed the following workloads:
- Game development with C++
- Desktop development with C++
- Universal Windows Platform development
- C++ Universal Windows Platform tools
The example in the link above says I should see this code:
Code:
// Initialize the Direct3D resources required to run.
void Game::Initialize(HWND window, int width, int height)
{
m_window = window;
m_outputWidth = std::max( width, 1 );
m_outputHeight = std::max( height, 1 );
CreateDevice();
CreateResources();
// TODO: Change the timer settings if you want something other than the default
// variable timestep mode.
// e.g. for 60 FPS fixed timestep update logic, call:
/*
m_timer.SetFixedTimeStep(true);
m_timer.SetTargetElapsedSeconds(1.0 / 60);
*/
}
However, when I created a project I found some of the code above is in a different function:
Code:
// Loads and initializes application assets when the application is loaded.
App1Main::App1Main()
{
// TODO: Change the timer settings if you want something other than the default variable timestep mode.
// e.g. for 60 FPS fixed timestep update logic, call:
/*
m_timer.SetFixedTimeStep(true);
m_timer.SetTargetElapsedSeconds(1.0 / 60);
*/
}
And the Initialize function has this code instead:
Code:
// The first method called when the IFrameworkView is being created.
void App::Initialize(CoreApplicationView^ applicationView)
{
// Register event handlers for app lifecycle. This example includes Activated, so that we
// can make the CoreWindow active and start rendering on the window.
applicationView->Activated +=
ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &App::OnActivated);
CoreApplication::Suspending +=
ref new EventHandler<SuspendingEventArgs^>(this, &App::OnSuspending);
CoreApplication::Resuming +=
ref new EventHandler<Platform::Object^>(this, &App::OnResuming);
}
Teaching myself and I'm stuck because the code on my machine is different from the tutorial. Boilerplate should be the same. I made no alterations. Code runs and makes a spinning cube.
What am I missing here? Is the tutorial out of date or did I do something wrong?
I'm using VS2019 if that matters.
Thanks