Hey guys,
I'm currently trying to write a simple 2D platformer with C++ & DirectX and it is going pretty well, but until now most of the code is in the WinMain of my program, thus it's getting realy hard to maintain. So I want to write my self a little framework to make the code more readable and maintainable, but I don't realy know how to structure the whole thing. My first Idea was to copy the design of XNA, because I like how easy it's to use. The problem is that I ended up having mostly small wrapper-classes that would require to have a getter-function so I could actually initialize the other classes.
As an example:
class GameWindow {
public:
GameWindow(int width, int height, const std::wstring& title);
HWND GetHandle() const; // I need this to initialize the swapchain
};
class Renderer {
public:
Renderer(HWND window, int backBufferWidth, int backBufferHeight);
// Need these to create buffers, shaders etc. and draw stuff ...
ID3D11Device* GetDevice() const;
ID3D11DeviceContext* GetContext() const;
};
I think these classes are near to useless, as they only initialize stuff and return them via getter-functions so I can actually use them.
So my question is: Do you guys have some useful tips on writing a framework? Or is my approach completely wrong?
I hope somebody knows how to help me