Upon completion, the DemoApp class produces the output shown in the following illustration. Part 1: Create the DemoApp Header In this step, you set up your application to use Direct2D by adding the necessary headers and macros. In your application header file, include the following frequently used headers. Most of these methods look the same as those found in any other Win32 application. The only exception is the Initialize method, which calls the CreateDeviceIndependentResources method which you define in the next part that creates several Direct2D resources.
|Published (Last):||19 February 2015|
|PDF File Size:||7.59 Mb|
|ePub File Size:||14.54 Mb|
|Price:||Free* [*Free Regsitration Required]|
By Gilles Bellot - May 21, I call our world Flatland, not because we call it so, but to make its nature clearer to you, my happy readers, who are privileged to live in Space. Abbott Obviously the big fuss about making games nowadays is all about creating vast 3D worlds, but if we are honest with ourselves, it is clear that we will not create the next big AAA-title on our own. It is not such a bad idea then to start slowly, and what better place is there to begin our journey than in Flatland?
With the robust framework from the previous DirectX tutorials, using Direct2D is surprisingly easy. Rectangles The first thing we want to try is to draw rectangles - both boring and easy. Direct2D distinguishes between filling and drawing objects.
Drawing an object results in only the contours of the geometrical figure being rendered to the screen. Behold: two rectangles - one filled and one drawn! Note that the third parameter of the DrawEllipse function and of all other draw functions specifies the thickness of the border. No Parking! What we need to do now is to draw two single lines. While drawing lines is easy hint: DrawLine , finding the endpoints of the lines might be a little bit of a challenge. The radius of the ellipse must be multplied by the sine or cosine of the angle, to account for circles or ellipses with radia not equal to 1.
Pi is defined in math. This was all rather easy. In the next tutorial we will have some fun with brushes.
Your First Direct2D Program
Creating a Simple Direct2D Application