I been trying to learn DirectX and Direct2D with C++. I'm proficient in C++, but I'm not sure how to do several things in working with these APIs.
First, I'm not sure how to program in a structured manner or style in context with DX and D2D. Is there reference material anyone would suggest?
For instance, in Direct2D in order to create a 'render target' you must initialize a 'factory'. This factory should retain its life through out the entire program. For a better understanding of this you can go here:
http://msdn.microsoft.com/en-us/library/dd535473(v=VS.85).aspx#step_2:_create_an_id2d1fact ory
I guess in asking for structured help, I'm also asking about encapsulation. I coded a class that would create a factory from the ID2D1Factory interface. I'm worried that what I'm doing is incorrect. Incorrect in that this code won't flow "properly" with anything else I program, or allow me to use D2D to its full extent.
basically my intentions are:
I don't want to make any objects of the interfaces (of DX or D2D) global, so I encapsulate it in a class. In doing that, isn't the object of that class still considered a global? Or how would I need to program so I can still use interface object effectively and keep the program efficient?
or do I have the wrong mindset in all of this? Thanks for any responses.