13 Replies - 2164 Views - Last Post: 15 April 2019 - 07:01 AM Rate Topic: -----

#1 cruller   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-April 19

Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 12 April 2019 - 08:48 AM

Hi,


I'm starting out with C++ and DirectX and I decided to follow along with the micrsoft github tutorial on DirectX12 found here link.


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:


// 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:


// 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:


// 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

Is This A Good Question/Topic? 0
  • +

Replies To: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15359
  • View blog
  • Posts: 61,583
  • Joined: 12-June 08

Re: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 12 April 2019 - 08:52 AM

The link says 'dx11', but you are talking dx12.. most likely that is the disconnect.
Was This Post Helpful? 0
  • +
  • -

#3 cruller   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-April 19

Re: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 12 April 2019 - 08:59 AM

View Postmodi123_1, on 12 April 2019 - 08:52 AM, said:

The link says 'dx11', but you are talking dx12.. most likely that is the disconnect.



The code for the link I proved is the same for the directx12 link.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15359
  • View blog
  • Posts: 61,583
  • Joined: 12-June 08

Re: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 12 April 2019 - 09:04 AM

If you close that project out, and make a second, brand spanking new, project - does it do the same thing?
Was This Post Helpful? 0
  • +
  • -

#5 cruller   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-April 19

Re: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 12 April 2019 - 09:08 AM

View Postmodi123_1, on 12 April 2019 - 09:04 AM, said:

If you close that project out, and make a second, brand spanking new, project - does it do the same thing?



Yea. I also tried it on a PC and Laptop. Both Windows 10.
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15359
  • View blog
  • Posts: 61,583
  • Joined: 12-June 08

Re: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 12 April 2019 - 09:13 AM

Odd.

Not sure what you are doing, but looks like you are picking the wrong project type based on the comments in the code on post 1 alone. *shrug*
Was This Post Helpful? 0
  • +
  • -

#7 cruller   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-April 19

Re: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 12 April 2019 - 09:32 AM

View Postmodi123_1, on 12 April 2019 - 09:13 AM, said:

Odd.

Not sure what you are doing, but looks like you are picking the wrong project type based on the comments in the code on post 1 alone. *shrug*



I have attached a file of a screenshot of the template I choose when starting a project in VS2019:

Attached Image
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15359
  • View blog
  • Posts: 61,583
  • Joined: 12-June 08

Re: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 12 April 2019 - 09:42 AM

Then that is your failure point. You are picking a UWP app and not a DX12 game.
Was This Post Helpful? 0
  • +
  • -

#9 cruller   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-April 19

Re: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 12 April 2019 - 09:55 AM

View Postmodi123_1, on 12 April 2019 - 09:42 AM, said:

Then that is your failure point. You are picking a UWP app and not a DX12 game.


There is no option for DX12 Game, only this UWP app. I removed the UWP workload and all directx options I showed on the screenshot disappear completely.

Does VS2019 not have support for DX12 Game? I can't get an earlier version of VS.
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15359
  • View blog
  • Posts: 61,583
  • Joined: 12-June 08

Re: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 12 April 2019 - 09:56 AM

I'm not sure.. I mean it did just come out a few days ago.

You can't install a the community edition of 2017?
Was This Post Helpful? 0
  • +
  • -

#11 cruller   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-April 19

Re: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 12 April 2019 - 10:12 AM

View Postmodi123_1, on 12 April 2019 - 09:56 AM, said:

I'm not sure.. I mean it did just come out a few days ago.

You can't install a the community edition of 2017?


On the VS official site you can only download 2019. I did find this directx game template for newer versions of VS (2013 and up, excluding 2019).

Not sure of this is a trustworthy source but it was a link provided by the MS github wiki from my first post.

I just ran this on a machine with 2019 and 2017 on it. The Directx12 Game option that you pointed out appears and the code matches that of my link in the first post. However this does not work for 2019. The menu for 2019 remains the same.

Since I can't get 2017 I can't teach myself C++ directx on my own computer until there is some fix for VS2019.
Was This Post Helpful? 0
  • +
  • -

#12 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15359
  • View blog
  • Posts: 61,583
  • Joined: 12-June 08

Re: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 12 April 2019 - 12:14 PM

You can log into my.visualstudio.com , search for 'Visual Studio Community 2017', and download it still.
Was This Post Helpful? 0
  • +
  • -

#13 cruller   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-April 19

Re: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 15 April 2019 - 03:28 AM

View Postmodi123_1, on 12 April 2019 - 12:14 PM, said:

You can log into my.visualstudio.com , search for 'Visual Studio Community 2017', and download it still.


Thank you for the help. I managed to download VS2017. More importantly I found a template that is to be used on the tutorial. When I installed the template I could open it in VS2017 and continue the tutorial. Unfortunately for VS2019 the template would install but it wouldn't let me start a project with it. I believe its a compatibility error and will have to wait for the creator to update it. But I am continuing on VS2017. Thank you for all the help.
Was This Post Helpful? 0
  • +
  • -

#14 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15359
  • View blog
  • Posts: 61,583
  • Joined: 12-June 08

Re: Beginning C++ with DirectX Tutorial Boilerplate Code Difference

Posted 15 April 2019 - 07:01 AM

Good to hear.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1