I have some code like
// Includes, namespace and prototypes
#include "template.h"
#include "Global.h"
#include "Sprite.h"
#include "Gesture.h"
#include "Touch.h"
using namespace AGK;
Gesture currentGesture;
// Begin app, called once at the start
void app::Begin( void )
{
SetupEnvironment(ENV_ANDROID);
CreateBackground();
}
How would I call currentGesture‘s constructor in this context so I can utilize it? I know it isn’t called by merely defining it above app::Begin.
Actually, it is.
defines a variable called
currentGesturewith external linkage and global scope. The constructor is called before entry inmain, so the variable is alive and well by that point. You can use it in this translation unit ascurrentGestureor::currentGesture.Other translation units will have to declare it first: