I have written some interface for my module. Let's say it's a interface of 3d engine. I have a few functions that returns/need to get some parameters like vector in 3d space. The structures from DirectX (like D3DXVECTOR) and windows.h (RECT, POINT) suit me well, but the engine should be independent of system and API (I will want to create engine based on DirectX and also the other based on OGL - on the same interface).
And I don't know what's the best way to achieve it.
For now I have done sth like that:
#ifdef WINDOWS#include <windows.h>#include <d3dx9.h>typedef D3DXVECTOR3 VECTOR3D;#elsestruct RECT{ long left; long top; long right; long bottom;};struct POINT{ long x; long y;};struct VECTOR3D{ float x; float y; float z;};#endif // WINDOWS
But I really don't like that way.
Moreover it's not 'nice' when OGL programmers will have to use the structures from DirectX to represent OGL structures (one more conversion...).
On the other hand, creating my own structure for vector 3d, rect etc. will make me to make conversions to that type both in DirectX and OGL versions of engine :/