I want to create a class which would help me with debugging by providing std::cout or QDebug like functionality using a 3D renderer.
I have the following renderer method which I'm using now
IRenderer::renderText(int posX, int posY, const float* color, const char* text, ...);
// E.g.
int i;
float f;
float color[] = {1, 1, 1, 1};
renderer->renderText(50, 50, color, "Float %f followed by int %i", f, i);
This actually works fine, but I wonder if it's possible to create a class which would allow me to do it like this:
debug() << "My variables: " << i << ", " << "f";
I assume there would be a template function which would build the string to pass to renderText()
based on input type, but I'm not quite sure how to implement it.