I`m trying to build a barebones MFC app. I`m used to C# Forms, but I`m having a tough time in MFC though.
I`m creating a new MFC app in the New Project dialog and in the Wizard I pick Dialog based app as app type. However after creation I can`t open the resource (in the resource view) to fill it with controls.
it`s a totally fresh project, no edits after pressing the `Finish` button in the create app wizard/dialog. I`m expecting to be able to add new controls from ToolBox but obviously something is missing...
I do not think MFC apps make use of the Toolbox. If you double-click the resource file (projectname.rc) in Solution Explorer, it should open the Resource Editor where you can add the various controls to your dialog.
The recommended MFC way is to create a control member variable (of the type CStatic or any derived from CStatic class) for this picture control. Then you will be able use all the methods of this class.
I am a hobbyist developer and I am recycling myself with the intention of learning C++ and D3D11. To give you an idea, I have been using for more than a decade a D3D9 engine with a programming language very similar to C. After doing several D3D11 tutorials, I think I understand fairly well where the shots are going.
The thing is that these tutorials lack an architecture designed to be scaled and they all end up in a function that does everything at once. Reading around, I have found a small explanation of how to combine in a simple way all the buffers that have to be associated to the pipeline to end up drawing on the screen, but I can't make it work.
The system is based on a class called 'Bindable' that contains a virtual function to associate the buffers to the pipeline and that is configured to be 'friendly' to the class that initializes the graphics (Graphics) to be able to access its private members.
I expand this class for each type of buffer with its specific constructor and dinder. For example, the mesh index buffer, which contains a pointer to the buffer and the number of indexes, looks like this:
As a test method, I create instances of the 'Bindable' heir classes and save their index in order to associate their buffers in subsequent frames. All in the same function, by the moment.
if (m_ibufIndex < 0)
m_ibufIndex = AddBind(std::make_unique<IndexBuffer>(*this, _indices));
This way, I intend to be able to associate all the buffers for each actor in the scene by means of a list of indexes and thus also be able to reuse the same buffers in different actors, although I haven't written this part yet, as I have found that the buffers are not associated to the pipeline correctly. When I call 'ID3D11DeviceContext::DrawIndexed' I get a warning that says the following:
ID3D11DeviceContext::DrawIndexed: An Index Buffer is expected, but none is bound. This is OK, as reading from a missing Index Buffer is defined to return 0. However the developer probably did not intend to make use of this behavior.
The thing is that the code compiles without problems and I have been able to verify, with the invaluable help of ImGui, that the instances of 'Bindable' are certainly created and that the buffers exist. For this purpose, I have added a member to the 'IndexBuffer' class that returns the description of the buffer and that I check right after the 'Bindable' creation/association block and it certainly exists.
I have tried to reinterpret the pointers hosted in 'm_binds' to their corresponding class, although I am pretty sure that it is not necessary.