This is kind of a COM question to do with DirectX.
So, both ID3DXSprite and ID3DXFont and a bunch of the other ID3DX* objects require you to call OnLostDevice() when the d3d device is lost AND OnResetDevice() when the device is reset.
What I want to do is maintain an array of all ID3DX* objects and simply call OnResetDevice() and OnLostDevice() on each whenever the device is lost or reset.
However I can’t seem to find a BASE CLASS for the ID3DX* classes… they all seem to COM-ually inherit from IUnknown.
Is there a way to do this or do I have to maintain separate arrays of ID3DXFont* pointers, ID3DXSprite* pointers, etc?
There isn’t a common base class, sorry.
You could use multiple inheritance and templates to sort of achive what you want. Something like this (untested but hopefully you’ll get the idea)…
This sort of meets your requirements, but to be honest I don’t really think it’s very useful. You’d either need some way to know what to cast each item back to, or keep the pointers in a type specific list anyway and then you might as well just write separate code to reset each type anyway.