Reputation: 4532
Interested in learning Direct2d to create a Windows 8 app, but after 2 hours of research I'm thoroughly confused. Samples like this (Creating a Simple Direct2D Application) seem to assume you know what an HWND
and HRESULT
is, and how the Windows API works in general.
My question is this: do you need an understanding of the Win API, COM, OLE, and all this other Windows stuff in order to get a good grasp on Direct2d/3d?
All the other barebones tutorials assume that you know all this stuff and I don't really know where to start. The startup D2D project in VS 2012 gives you a bunch of files but there's no main
or WinMain
... How does this program even start?
Upvotes: 3
Views: 5326
Reputation: 61
I program in C, using Visual Studio C++ (for Windows). The Microsoft website you got that sample has a 3,888 page PDF that you can download. It's a compendium of articles written over the years on Direct2D. I use examples from it to write a map portion of my X-Plane program, XPlaneNetworkData2.exe.
Upvotes: 0
Reputation: 741
Further material is available on Pluralsight where Kenny Kerr has a series of tutorials on Direct2D fundamentals. It's the best coverage of Direct2D I've seen so far.
HWND and HRESULT are common types when dealing with Win32 programming. Kerr does cover some basics on getting a Win32 desktop application and window up and running for the Direct2D demos but you'd be best served by Charles Petzold's Programming Windows book (5th Edition) for comprehensive coverage on all things Win32.
Kerr also has a two-part tutorial on 'The Essentials of COM' which is worth checking out. I was always confused by COM technology but his course dispels a lot of the mystery and complexity.
Be aware that Pluralsight is a fee-based website but well worth the subscription. You can check out the free trial option to see if the course material on there is suitable for you.
Upvotes: 1
Reputation: 69672
The API is COM-based, so you will have to get familiar with COM basics to move on. You actually don't need to know a lot from the start, perhaps just COM interfaces concept with reference counting, instantiation and implementing an interface. It might be simpler than it seems. UI windows in Windnows have handles, so HWND
is definitely something to understand.
The sample you are referring to actually has WinMain. Have a look at full tutorial code, and you will find it there:
#include "DemoApp.h"
// Provides the application entry point.
int WINAPI WinMain(
HINSTANCE /* hInstance */,
Upvotes: 2