bool (* method)(eC_Window, eC_Button, int, int, Modifiers) = (bool (*)(eC_Window, eC_Button, int, int, Modifiers))(i ? i->_vTbl : class_Button->_vTbl)[Button_notifyClicked_vTblID]; \
method ? method(m, b, x, y, mods) : true; })
-#define GuiApplication_cycle(x) ({ eC_GuiApplication i = x; \
- bool (* method)(eC_GuiApplication) = (bool (*)(eC_Instance))(i ? i->_vTbl : class_GuiApplication->_vTbl)[GuiApplication_cycle_vTblID]; \
- method ? method(i) : true; })
+#define GuiApplication_cycle(x, idle) ({ eC_GuiApplication i = x; \
+ bool (* method)(eC_GuiApplication, bool) = (bool (*)(eC_Instance, bool))(i ? i->_vTbl : class_GuiApplication->_vTbl)[GuiApplication_cycle_vTblID]; \
+ method ? method(i, idle) : true; })
// Bit Class Member Access
#define COLOR_r_MASK 0x00FF0000
// For C++ classes proxying eC classes:
#define REGISTER_CPP_CLASS(n, a) n::_class.setup(_REGISTER_CLASS(n, "CPP" #n, #n, a));
+#define EVOLVE_APP(ac, a) \
+ Instance_evolve(&(a).impl, ac::_class.impl); \
+ _INSTANCE((a).impl, (a).impl->_class) = &(a); \
+ __thisModule = (a).impl; \
+ (a).vTbl = _class.vTbl;
+
+#define REGISTER_APP_CLASS(ac, b, a) \
+ REGISTER_CLASS(ac, b, a); \
+ EVOLVE_APP(ac, a)
+
#define _CONSTRUCT(c, b) \
INSTANCE_VIRTUAL_METHODS(c) \
static TCPPClass<c> _class; \
#define GuiApplication_class_registration(d) \
Application_class_registration(d); \
REGISTER_METHOD("Cycle", cycle, GuiApplication, d, \
- bool, (eC_GuiApplication a), a, a, return fn(*i), (a), true);
+ bool, (eC_GuiApplication a, bool idle), a, a, return fn(*i, idle), (a, idle), true);
class GuiApplication : public Application
{
public:
- APP_CONSTRUCT(GuiApplication, Application)
- {
- Instance_evolve(&impl, GuiApplication::_class.impl);
- _INSTANCE(impl, impl->_class) = this;
- __thisModule = impl;
- vTbl = _class.vTbl;
- }
-
+ APP_CONSTRUCT(GuiApplication, Application) { EVOLVE_APP(GuiApplication, *this); }
REGISTER() { GuiApplication_class_registration(GuiApplication); }
- VIRTUAL_METHOD(cycle, GuiApplication, GuiApplication, bool, GuiApplication &, , ,
- return GuiApplication_cycle(self->impl));
+ VIRTUAL_METHOD(cycle, GuiApplication, GuiApplication, bool, GuiApplication & _ARG, , bool idle,
+ return GuiApplication_cycle(self->impl, idle));
};
#endif
#include "eC.hpp"
+class MyApp;
+extern MyApp app;
+
class MyApp : public Application
{
public:
APP_CONSTRUCT(MyApp, Application) { }
- static void class_registration(CPPClass & _class);
+ REGISTER()
+ {
+ register_main(_class, [](Application & app)
+ {
+ PrintLn(class_String, "C++: Hello, eC", null);
+ });
+ EVOLVE_APP(MyApp, app);
+ }
};
MyApp app;
-void MyApp::class_registration(CPPClass & _class)
-{
- register_main(_class, [](Application & app)
- {
- PrintLn(class_String, "C++: Hello, eC", null);
- });
- Instance_evolve(&app.impl, MyApp::_class.impl);
- _INSTANCE(app.impl, app.impl->_class) = &app;
- __thisModule = app.impl;
- app.vTbl = _class.vTbl;
-}
-
REGISTER_CLASS_DEF(MyApp, Application, app);
MAIN_DEFINITION;
public:
APP_CONSTRUCT(MyApp, GuiApplication)
{
- cycle = +[](GuiApplication & app)
+ REGISTER_APP_CLASS(MyApp, GuiApplication, *this);
+ /*
+ cycle = +[](GuiApplication & app, bool idle)
{
PrintLn(class_String, " Cycling!", null);
return true;
};
+ */
+ }
+
+ REGISTER()
+ {
+ GuiApplication_class_registration(GuiApplication);
+ register_cycle(_class, [](GuiApplication & app, bool idle)
+ {
+ PrintLn(class_String, " Cycling!", null);
+ return true;
+ });
}
void main()
MyApp app;
Window w;
-
-REGISTER_CLASS_DEF(MyApp, GuiApplication, app);
-
+CLASS_DEF(MyApp);
MAIN_DEFINITION
--- /dev/null
+#define MODULE_NAME "MyApp"
+
+#include "eC.hpp"
+
+class MyApp : public Application
+{
+public:
+ APP_CONSTRUCT(MyApp, Application)
+ {
+ REGISTER_APP_CLASS(MyApp, Application, *this);
+
+ main = [](Application & app)
+ {
+ PrintLn(class_String, "C++: Hello, eC", null);
+ };
+ }
+};
+
+MyApp app;
+CLASS_DEF(MyApp);
+MAIN_DEFINITION;