view client/main.cpp @ 87:955a9409ab5f

Misc: upgrade json to 2.1.0, closes #627
author David Demelier <markand@malikania.fr>
date Sat, 04 Feb 2017 14:40:20 +0100
parents ee850a6ab89e
children 4031eda60e11
line wrap: on
line source

/*
 * main.cpp -- main client file
 *
 * Copyright (c) 2013-2017 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 <malikania/duktape.hpp>

#include <chrono>
#include <thread>

#include <malikania/client/button.hpp>
#include <malikania/client/color.hpp>
#include <malikania/client/frame.hpp>
#include <malikania/client/label.hpp>
#include <malikania/client/point.hpp>
#include <malikania/client/unique_layout.hpp>
#include <malikania/client/window.hpp>

int main()
{
    mlk::client::window win;

    auto f = std::make_shared<mlk::client::frame>();
    auto w = std::make_shared<mlk::client::label>("Malikania");
    auto l = std::make_shared<mlk::client::unique_layout>(w);

    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));
    }
}