Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Commit last experimental bits (dated December 6th, 2013).
[graphlib.git] / simpledw / SimpleDW.cpp
diff --git a/simpledw/SimpleDW.cpp b/simpledw/SimpleDW.cpp
new file mode 100644 (file)
index 0000000..f9ccf15
--- /dev/null
@@ -0,0 +1,38 @@
+#include <QApplication>
+#include <DrawingWindow.h>
+
+extern void simpleDW_user_main_wrapper();
+
+namespace {
+    DrawingWindow *global_w;
+    int global_argc;
+    char **global_argv;
+
+    void drawing_function(DrawingWindow& w)
+    {
+        global_w = &w;
+        simpleDW_user_main_wrapper();
+    }
+}
+
+int main(int argc, char *argv[])
+{
+    QApplication application(argc, argv);
+    global_argc = argc;
+    global_argv = argv;
+    DrawingWindow window(drawing_function);
+    window.show();
+    return application.exec();
+}
+
+#include <SimpleDW.h>
+
+void drawText(int x, int y, const char *text, int flags)
+{
+    global_w->drawText(x, y, text, flags);
+}
+
+void drawText(int x, int y, const std::string &text, int flags)
+{
+    global_w->drawText(x, y, text, flags);
+}