Ok so i'm coming from a .net background (multiple years of professional development).
I'm checking out microsoft DX11 samples and i just don't get it, am i missing something obvious & there's actually beauty there i'm not seeing? Or is this actually just flat ugly hard code for no reason? Is it legacy or are you actually supposed to write & consume APIs this way?
(just to be clear, this is half rant, half question, i'd be more than happy to learn my rant is unfounded & have this transition from a rant to an answered question, also i'm not saying i'm having a hard time, just to be clear i understand the sample perfectly fine, i just find it painstakingly hard for no reason).
Shed some light on all this for me
1) Why the hell is this so damn long & hard? I expected getting a DX11 window up & running (and rendering) with nothing inside to be a 10liner or so, maybe 20 tops, but not 250 like in the sample!
2) Why the typedefs? Seems to be adding confusion for no reason especially on simple types, am i missing something or is this just useless? typedef float FLOAT
3) Why no constructors? Objects are just declared and initialized element by element, meaning you remove 1 line you don't get a default, you don't even get an exception, you get a nice access violation!
4) Why all the if(failed(bla)) ? Why isn't code throwing?
5) Probably the same as 3 but, why no sensible default values for everything? Declaring any directX object seems to be a full time job & a 10 liner!
6) Why is everything taking a pointer? I get the point for large (or medium) objects but why for example does something like the feature level, which isn't a large object nor an array, and that you're likely to be using once (or hell, maybe twice!) in your whole application get passed by pointer? I'm new at C++ but unless i get it wrong it means you must create a (local or global) variable, assign a value to it, and pass a pointer to it, if it was by reference you could just pass in D3D_FEATURE_LEVEL_11_0 for example
7) Typedef question again, it's confusing enough for float => FLOAT, but hell LPVOID*, i can't believe people starting with C++ make it through this!
8) __uuidof, so you even need custom keywords to get a simple directX sample app going on???
I'm not trying to bash C++ here, the only things i can't bare in it are header files and compilation speed, but i just don't get that API design, is it flaws in the API or in the sample? Or am i just getting it wrong? Because if this is the right way to do it this sounds just horrible to me, 250 lines to do nothing, 3X that much for a rotating cube (out of which only 60 lines are rendering, and about 300 setting up the device . . . ). I just don't get it! Hell SharpDX didn't feel that way at all.
I'm waiting, please enlighten me!