Mercurial > malikania
diff client/main.cpp @ 52:4bc4732fa1dd
Client: add basic button, closes #601
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 15 Dec 2016 13:46:46 +0100 |
parents | a47a4477f347 |
children | 9ccc36ba4725 |
line wrap: on
line diff
--- a/client/main.cpp Thu Dec 15 13:43:09 2016 +0100 +++ b/client/main.cpp Thu Dec 15 13:46:46 2016 +0100 @@ -16,7 +16,38 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <chrono> +#include <thread> + +#include "malikania/button.hpp" +#include "malikania/color.hpp" +#include "malikania/frame.hpp" +#include "malikania/point.hpp" +#include "malikania/unique_layout.hpp" +#include "malikania/window.hpp" + int main() { + mlk::window win; + + auto f = std::make_shared<mlk::frame>(); + auto b = std::make_shared<mlk::button>("click me!"); + auto l = std::make_shared<mlk::unique_layout>(b); + + b->on_clicked.connect([] { + puts("clicked!!!!"); + }); + f->move({50, 50}); + f->set_layout(l); + win.add_frame(f); + + while (win.is_open()) { + win.poll(); + win.set_drawing_color({255, 255, 255, 255}); + win.clear(); + win.draw_frames(); + win.present(); + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + } }