locked
Make your first game with c++ d2d

    Question

  • Hi all,

    Brand new c++ and DX developer here.. I'm trying to get my teeth into my first hello world project.

    I would like to follow this: http://msdn.microsoft.com/en-US/library/windows/desktop/hh780340#example_code

    But have fallen at the first hurdle.

    I want to draw a rectangle on the screen...
    Where does the code mentioned in the article go?

    I have created a function in the App.xaml.h in the public section like so:

    and have also created the function in the cpp:

    and I also included the d2d1.h and d2d1_1.h into the project at the topof the .cpp file.

    can I have a helping hand. I just need to see one example of the where the rectangle code goes, and i'll be away. i'm use to see an empty project in visual studio 2010.

    Monday, October 29, 2012 1:55 AM

Answers

  • The article you are looking at is for writing a desktop app, not a Windows Store app. The template you are using is for a Xaml Windows Store app. You would be better off starting with the Direct2D (Xaml) app. With that, you would add your rectangle rendering code in the SimpleTextRenderer::Render method. You would likely want to rename "SimpleTextRenderer" to something more appropriate for your app.

    --Rob

    • Marked as answer by jimmyt1988 Monday, October 29, 2012 8:47 PM
    Monday, October 29, 2012 2:28 AM
    Moderator

All replies

  • The article you are looking at is for writing a desktop app, not a Windows Store app. The template you are using is for a Xaml Windows Store app. You would be better off starting with the Direct2D (Xaml) app. With that, you would add your rectangle rendering code in the SimpleTextRenderer::Render method. You would likely want to rename "SimpleTextRenderer" to something more appropriate for your app.

    --Rob

    • Marked as answer by jimmyt1988 Monday, October 29, 2012 8:47 PM
    Monday, October 29, 2012 2:28 AM
    Moderator
  • When i get home from work, I am going to code my ass off.. Can't wait!. Thanks for step 1!
    Monday, October 29, 2012 10:16 AM
  • Got any ideas where the D2D API is on the interwebs? can't find a reference place...

    Searching for D2D API, D2D references etc.

    Monday, October 29, 2012 8:47 PM