cross platform example question

Posted:
Mar 27, 2005 @ 6:04pm
by Structure
Hi theres probably an obvious answer to this so please excuse my ignorance
In the cross platform example given in 3.5c is there a good reason why CCommonApplication cant inherit from CGapiApplication rather then have it passed in as a pointer?

Posted:
Mar 29, 2005 @ 8:13am
by Johan
The reason is that most of the stuff in CGapiApplication is platform-independent and needs to be kept separately (such as image loading).

Posted:
Mar 29, 2005 @ 11:56am
by Structure
Ok, ive not really been exploring the intricacies of the cross platform approach as ive only been developing on the desktop so far,
But if CommonApplication was derived from myapplication, you could still call CMyApplication::InitInstance()first from CCommonApplication::InitInstance()
If you don’t implement CreateSysMemSurfaces in CCommonApplication it will still call the platform dependent function in CMyApplication,
And doing this will save the pointer reference in all of the callbacks as this will be sorted out in the vtable.
Im not saying this is a better way to do it as im sure ive probably missed something important (as always, till it bytes you on the ass!) im just interested in your opinion of the validity of this approach