What would be the simplest example of CMakeLists.txt
, main.cpp
and PureMVC sources
to display "Hello Startup" from execute() Startup SimpleCommand?
PureMVC sources are here
Ideally solution could be a link to github project.
What would be the simplest example of CMakeLists.txt
, main.cpp
and PureMVC sources
to display "Hello Startup" from execute() Startup SimpleCommand?
PureMVC sources are here
Ideally solution could be a link to github project.
You should compile corresponding dll and lib (Debug or Release [static|shared]), include PureMVC files. Maybe you can derive a facade from PureMVC::Patterns::Facade, override essential virtual functions. Because it's different between C++ and Java-like programming languages, overrided initializeController() won't be called in base class's constructor! Here is a derive example:
class ApplicationFacade
: public virtual IFacade
, public Facade
{
friend class Facade;
public:
static const string STARTUP;
static const string EXIT;
protected:
ApplicationFacade(void)
: Facade(this, "ApplicationFacade")
{
initializeController();
}
public:
static ApplicationFacade& getInstance(void)
{
if (Facade::hasCore("ApplicationFacade"))
return *(dynamic_cast<ApplicationFacade*>(&Facade::getInstance("ApplicationFacade")));
return *(new ApplicationFacade());
}
protected:
virtual void initializeNotifier(string const& key)
{
Facade::initializeNotifier(key);
}
virtual void initializeFacade()
{
Facade::initializeFacade();
}
virtual void initializeController(void)
{
Facade::initializeController();
StartupCommand* startupCommand = new StartupCommand();
registerCommand(STARTUP, startupCommand);
ExitCommand* exitCommand = new ExitCommand();
registerCommand(EXIT, exitCommand);
}
~ApplicationFacade()
{
}
};
const string ApplicationFacade::STARTUP = "startup";
const string ApplicationFacade::EXIT = "exit";
StartupCommand and ExitCommand are derived from PureMVC::Patterns::SimpleCommand Then in main.cpp you can start the program by:
ApplicationFacade& facade = ApplicationFacade::getInstance();
facade.sendNotification(ApplicationFacade::STARTUP);
And exit:
facade.sendNotification(ApplicationFacade::EXIT);