Mercurial > malikania
diff examples/js-window/main.cpp @ 208:263122adef77
client: add texture and painter
closes #966 @2h
closes #967 @2h
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 05 Dec 2018 22:24:44 +0100 |
parents | f28cb6d04731 |
children |
line wrap: on
line diff
--- a/examples/js-window/main.cpp Wed Nov 28 21:18:00 2018 +0100 +++ b/examples/js-window/main.cpp Wed Dec 05 22:24:44 2018 +0100 @@ -21,6 +21,7 @@ #include <thread> #include <malikania/client/js/window_js_api.hpp> +#include <malikania/client/js/painter_js_api.hpp> using namespace std::chrono_literals; @@ -33,9 +34,10 @@ { const auto ret = duk_peval_string(ctx, "w = new Malikania.Window();" - "w.setDrawingColor('lightskyblue');" - "w.clear();" - "w.present();" + "p = new Malikania.Painter(w);" + "p.setDrawingColor('lightskyblue');" + "p.clear();" + "p.present();" ); if (ret != 0) @@ -48,11 +50,12 @@ { const auto ret = duk_peval_string(ctx, "w = new Malikania.Window();" - "w.setDrawingColor('lightskyblue');" - "w.clear();" - "w.setDrawingColor('white');" - "w.drawRectangle({ x: 10, y: 10, width: 10, height: 10 });" - "w.present();" + "p = new Malikania.Painter(w);" + "p.setDrawingColor('lightskyblue');" + "p.clear();" + "p.setDrawingColor('white');" + "p.drawRectangle({ x: 10, y: 10, width: 10, height: 10 });" + "p.present();" ); if (ret != 0) @@ -70,6 +73,8 @@ duk_put_global_string(ctx, "Malikania"); load_window_api(ctx); + load_painter_api(ctx); + basic(ctx); rect(ctx); } catch (const std::exception& ex) {