diff client/main.cpp @ 139:b80d37e71b87

Client: rework dispatching between client and window, closes #711 The window backend is able to produce user events but they need to be dispatched into the client, the state and the window. This change makes client owner of window and dispatches events from client to the window and the future state mechanism. Remove the client network code temporarily to rework in the dispatcher later.
author David Demelier <markand@malikania.fr>
date Wed, 27 Sep 2017 20:34:59 +0200
parents 37df5aa9ba82
children 473e1eb96363
line wrap: on
line diff
--- a/client/main.cpp	Fri Oct 06 16:30:24 2017 +0200
+++ b/client/main.cpp	Wed Sep 27 20:34:59 2017 +0200
@@ -18,33 +18,17 @@
 
 #include <iostream>
 
-#include <malikania/client/button.hpp>
-#include <malikania/client/color.hpp>
-#include <malikania/client/frame.hpp>
-#include <malikania/client/unique_layout.hpp>
+#include <malikania/client/client.hpp>
+#include <malikania/client/connection.hpp>
 #include <malikania/client/window.hpp>
 
 int main()
 {
-    mlk::client::window w;
-
-    auto b = std::make_unique<mlk::client::button>("Click me!");
-
-    b->on_clicked.connect([] () {
-        std::cout << "clicked successfully!" << std::endl;
-    });
-
-    auto l = std::make_unique<mlk::client::unique_layout>(std::move(b));
-    auto f = std::make_unique<mlk::client::frame>(std::move(l));
+    boost::asio::io_service service;
 
-    w.add_frame(std::move(f));
-    w.start_edit();
+    mlk::client::connection conn(service);
+    mlk::client::window w;
+    mlk::client::client clt(service, conn, w);
 
-    while (w.is_open()) {
-        w.poll();
-        w.set_drawing_color(0xffffffff);
-        w.clear();
-        w.draw_frames();
-        w.present();
-    }
+    clt.run();
 }