Decided to pick up my C++ project again. I haven't written any code for a while.
I decided that the first thing I'd do is plug my console library into GWEN. Was surprisingly easy, and more astoundingly my old code works
Can someone explain GWEN_CONTROL_INLINE to me? I can't figure out how it works, only how it's used.
I tried to minimize the usage of macros in GWEN, but there are a few that should probably be better documented.
// To be placed in the controls .h definition.
#define GWEN_CONTROL( ThisName, BaseName )\
public:\
typedef BaseName BaseClass;\
typedef ThisName ThisClass;\
GWEN_DYNAMIC( ThisName, BaseName )\
ThisName( Gwen::Controls::Base* pParent, const Gwen::String& pName = "" )
#define GWEN_CONTROL_INLINE( ThisName, BaseName )\
GWEN_CONTROL( ThisName, BaseName ) : BaseClass( pParent, pName )
#define GWEN_CONTROL_CONSTRUCTOR( ThisName )\
ThisName::ThisName( Gwen::Controls::Base* pParent, const Gwen::String& pName ) : BaseClass( pParent, pName )
So as you can see GWEN_CONTROL_INLINE calls GWEN_CONTROL.. which...
typedef's BaseClass to whatever your baseclass is (so in code you can do things like BaseClass::Function()).
typedef's ThisClass to whatever your class is (so you can do ThisClass::BlahBlah - for example when passing hooking up events).
GWEN_DYNAMIC just sets some stuff up to allow for safe typecasting when dynamic_cast isn't available (using gwen_cast)
And then it creates the constructor line.
Normally you'd use GWEN_CONTROL_INLINE if you were defining the classes constructor in your the class definition. Otherwide you'd use GWEN_CONTROL in your header, and GWEN_CONTROL_CONSTRUCTOR in your body.