Hi Guys,
After several weeks of research and design tweaking, I'm faced with several problems which I hope you guys can shed light on. First the inheritance question;
I have "CWinApp" that deals with only windows functionality , and CMyEngine which deals with graphics functionality, (Credits, particles, GUI, etc.) I inherit "CWinApp" from CMyEngine" as "Has-A" (as apposed to "IS-A")
I have "LRESULT CALLBACK CWinApp::MsgProc( HWND hWnd, ...)" to handle keyboard messages (which is static) and in "CEngine" I have the same function. What I do is pass any and all messages from my CWinApp to the "MsgProc" in "CEngine" (none static). Once keyboard and mouse messages get to the "CEngine", I can split up the messages and route them to different functions. (Keyboard messages will get routed to Keyboard functions, mouse messages will get routed to mouse functions).
Display All
Heres the problem, in the "CWinApp::MsgProc(...) ", I have to do this:
Keeping in mind that I am inhereting CWinApp from CMyEngine, I have to "break some rules" by essentially doing this . By making CEngine assessable to all objects (global scope ?), I can get it to work, however this seems to be messy and sloppy. Is there a better way? Any thoughts or comments as to what I am doing?
Follow-up:
Since I am using the "Has-A" concept, how about "IS-A"? Any arguments, comments??
S.
After several weeks of research and design tweaking, I'm faced with several problems which I hope you guys can shed light on. First the inheritance question;
I have "CWinApp" that deals with only windows functionality , and CMyEngine which deals with graphics functionality, (Credits, particles, GUI, etc.) I inherit "CWinApp" from CMyEngine" as "Has-A" (as apposed to "IS-A")
I have "LRESULT CALLBACK CWinApp::MsgProc( HWND hWnd, ...)" to handle keyboard messages (which is static) and in "CEngine" I have the same function. What I do is pass any and all messages from my CWinApp to the "MsgProc" in "CEngine" (none static). Once keyboard and mouse messages get to the "CEngine", I can split up the messages and route them to different functions. (Keyboard messages will get routed to Keyboard functions, mouse messages will get routed to mouse functions).
Source Code
Heres the problem, in the "CWinApp::MsgProc(...) ", I have to do this:
Keeping in mind that I am inhereting CWinApp from CMyEngine, I have to "break some rules" by essentially doing this . By making CEngine assessable to all objects (global scope ?), I can get it to work, however this seems to be messy and sloppy. Is there a better way? Any thoughts or comments as to what I am doing?
Follow-up:
Since I am using the "Has-A" concept, how about "IS-A"? Any arguments, comments??
S.