view client/main.cpp @ 56:b94bc48d16b8

Server: add mswsock for Windows
author David Demelier <markand@malikania.fr>
date Fri, 16 Dec 2016 14:53:37 +0100
parents 4bc4732fa1dd
children 9ccc36ba4725
line wrap: on
line source

/*
 * main.cpp -- main client file
 *
 * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * 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));
    }
}