GDI is widely used in windows applications. But GDI was too old and was introduced with the initial versions of the Windows and over the time the capabilities of graphics hardware has grown and so does the demand for creating Visually Rich UI. Direct2D is not only available under Windows 7 but Microsoft has made it available in Window Vista with the latest service pack upgrade. It enables the user to create visually rich applications by paying less effort, when comparing to conventional APIs.
|Published (Last):||13 October 2011|
|PDF File Size:||17.87 Mb|
|ePub File Size:||15.46 Mb|
|Price:||Free* [*Free Regsitration Required]|
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. 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. The first thing we want to try is to draw rectangles - both boring and easy. We can draw a rectangle by calling the FillRectangle method:.
Direct2D distinguishes between filling and drawing objects. Drawing an object results in only the contours of the geometrical figure being rendered to the screen. To draw a rectangle, we use the DrawRectangle method:.
To draw an ellipse, we have to define its center coordinate, as well as the x and y-radia before calling the FillEllipse or DrawEllipse methods:. Note that the third parameter of the DrawEllipse function and of all other draw functions specifies the thickness of the border. To have some fun, let us try to recreate a no parking sign:. 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.
Remembering trigonometry, it is clear that we can find the x and y-coordinates of a point on a circle by putting the angle into a circular function:. Just note that since Windows puts the centre of the screen at the upper left edge of the screen, we have to add the x and y-offsets to the computation. 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. By Gilles Bellot - May 21, 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.
Rectangles The first thing we want to try is to draw rectangles - both boring and easy. Behold: two rectangles - one filled and one drawn! No Parking!
This was all rather easy. In the next tutorial we will have some fun with brushes. Share this article on:. Next post Fun with Brushes May 21, More in Direct2D. Resolution Independent Rendering March 13, Chasing the Mouse June 11, Animated Sprites and Sprite Sheets May 30,
Direct2D - A Revision
Sep 26, at am UTC. Well, I am going to want to learn Direct3D soon, and it will be easier if I already know quite a bit of advanced COM programming, plus the Directx ways anyway. I have seen one Youtube series that looked promising, but it ended subtly after a 3rd video no, it wasn't mid series, that 3rd vid is about 2 years old. This is one of them. A book, at the least?
Your First Direct2D Program
A new major release of Simple2D is now available the download link can be found at the bottom of the page. Read more…. Version 1. Improvements have been made to scene objects, user interface objects and object groups, experimental support for skinning has been added, as well as support for XInput-compatible gamepads. The main changes are targeting of Direct2D 1. Run-time support for Windows Vista and compile-time support for Visual Studio is dropped although it still compiles with warnings. Until now we have just used a fairly arbitrary demo level that was hard-wired into our game code.