Posted 24 June 2013 - 05:13 AM
void LoadTextures(LPDIRECT3DDEVICE9 myDev)
D3dxfunction(....., myDev or &myDev)
This also means that this function is allowed to do everything with the device where myDev points too.
I was hoping there was a way to distinct what and what not a function is allowed to do with the device, but since the idirect3ddevice9 has no const member functions, I think this is a no go.
Would there be a possibility to distinct using the device just as a parameter/ reference when calling other functions who just need to know the device, versus functions who need to execute functions on the device itself:
1. D3dxcreatetexturefromfile(...., myDev);
2. myDev->avalidfunction (i.e. Reset, release, setpixelshader, setstreamsouce etc.)
That way I might be able to protect misusage of the device, in functions where I just need to pass it as a reference to a d3d(x) function.
OK, so basically there's no reason to do it otherwise then just giving the LPDIRECT3DDEVICE9 as a parameter to the function, which is already a pointer to the idirect3ddevice9,
Crealysm game & engine development: http://www.crealysm.com
Looking for a passionate, disciplined and structured producer? PM me