Updated main.c to only focus on namespaces

Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
This commit is contained in:
2021-03-19 05:14:41 +02:00
parent 2f4294a6ff
commit 04b562475b

View File

@@ -1,56 +1,17 @@
#include "evol/core/eventlistener.h"
#include <evol/evol.h>
#include <evol/evolmod.h>
#include <evol/common/ev_log.h>
#include <assert.h>
#define EVENT_MODULE evmod_glfw
#include <evol/meta/event_include.h>
#define NAMESPACE_MODULE evmod_glfw
#include <evol/meta/namespace_import.h>
DECLARE_EVENT_LISTENER(windowResizedListener, (WindowResizedEvent *event) {
ev_log_info("Window resized: (%d, %d)", event->width, event->height);
})
DECLARE_EVENT_LISTENER(keyListener, (KeyEvent *event) {
if(event->type == EVENT_TYPE(KeyPressedEvent)) {
ev_log_info("Key pressed: %d", ((KeyPressedEvent*)event)->keyCode);
} else if(event->type == EVENT_TYPE(KeyReleasedEvent)) {
ev_log_info("Key released: %d", ((KeyReleasedEvent*)event)->keyCode);
} else {
}
})
DECLARE_EVENT_LISTENER(mouseMovedListener, (MouseMovedEvent *event) {
ev_log_info("Mouse Moved: (%f, %f)", event->position.x, event->position.y);
})
#include <evol/core/namespace.h>
int main(int argc, char **argv) {
evolengine_t *engine = evol_create();
evol_parse_args(engine, argc, argv);
evol_init(engine);
evolmodule_t window_module = evol_loadmodule("window");
assert(window_module);
IMPORT_EVENTS_evmod_glfw(window_module);
IMPORT_NAMESPACE(Window, window_module);
ACTIVATE_EVENT_LISTENER(windowResizedListener, WindowResizedEvent);
ACTIVATE_EVENT_LISTENER(keyListener, KeyEvent);
ACTIVATE_EVENT_LISTENER(mouseMovedListener, MouseMovedEvent);
while(true) {
if(Window->update(0.0) == 1) {
break;
}
EventSystem.progress();
}
while(!Window->update(0.0));
evol_unloadmodule(window_module);
evol_deinit(engine);