libSDL2pp / libSDL2pp

C++ bindings/wrapper for SDL2
https://sdl2pp.amdmi3.ru
Other
561 stars 89 forks source link

virtualize Renderer class #7

Open AMDmi3 opened 10 years ago

AMDmi3 commented 10 years ago

Currently Renderer class only provides virtual destructor. It would be much more flexible, however, if more of its functions were virtual.

For example, I need a renderer for low-resolution game which automatically scales its 320x200 resolutions onto a bigger render area. This can be done inside SDL with SetViewport and SetScale, however this method has drawbacks:

Alternative methods include:

Both methods may be done transparently with custom Renderer derivative which overrides some operations, however for that to work really transparently, base Renderer functions should be virtual. virtual call has an overhead, but it is incomparably small to operations that Renderer class performs (heavyweight opengl operations which go through multiple layers of library calls). Performance testing would be nice though.

AMDmi3 commented 10 years ago

So, the plans are to implement both scaled renderers and make functions overridden in them virtual in Renderer class.