Passing a value to routines in the Irrlicht DLL?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Liquidream
Posts: 36
Joined: Fri Feb 20, 2004 9:23 am
Contact:

Passing a value to routines in the Irrlicht DLL?

Post by Liquidream »

Hi all,

I am modifying the CIrrDeviceWin32.cpp in order to change how my actual Irrlicht window is created (frameless, Z-ordering, etc.) which has worked fine so far.

Now I want to be able change things at runtime. Specifically, I want to be able to pass a value from my Main irrlicht program to this routine (located in the DLL?) so that I can change HOW my window behaves at runtime.

For example: in the LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) of CIrrDeviceWin32.cpp, I have added extra cases (WM_ACTIVE, etc) to handle the Z-ordering of the window, whether it can be activated, etc. These are currently always being run/called. What I would like to only use these extra cases based on a variable set by my main application.

Does anyone know how can I pass a variable (or set a value) into these routines in CIrrDeviceWin32.cpp at runtime?

Hope this makes sense!
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

Implement it in the class CIrrDeviceWin32 (e.g. setYourCustomValue() ). In the WndProc you can then access it with:

Code: Select all

dev = getDeviceFromHWnd(hWnd);
if (dev) {
	dev->getYourCustomValue();
}
It is like it is. And because it is like it is, things are like they are.
Liquidream
Posts: 36
Joined: Fri Feb 20, 2004 9:23 am
Contact:

Post by Liquidream »

Wow! Thanks for the quick reply. Will give it a go!

Another question: how can I call setYourCustomValue() (if I add it into class CIrrDeviceWin32) from my main program as I don't think it is accessible from Irr::Device-> or something like this?

Thank you for your help! :)
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

Liquidream wrote:Wow! Thanks for the quick reply. Will give it a go!

Another question: how can I call setYourCustomValue() (if I add it into class CIrrDeviceWin32) from my main program as I don't think it is accessible from Irr::Device-> or something like this?

Thank you for your help! :)
You'll have to add them as virtual member functions to the IrrlichtDevice interface (IrrlichtDevice.h) and possibly as empty function to the class CIrrDeviceStub a well. Then you can access them via Irr::Device-> .
It is like it is. And because it is like it is, things are like they are.
Post Reply