diff --git a/sim/fakes/ctx.py b/sim/fakes/ctx.py index 34c740f2ea83db4223e7a4d9a7a4c50a9c40e1f8..608cef0dd03331caf136a8d7b0c63f7796fd0035 100644 --- a/sim/fakes/ctx.py +++ b/sim/fakes/ctx.py @@ -97,6 +97,16 @@ class Wasm: self.free(p) return res + def ctx_x(self, ctx): + return self._i.exports.ctx_x(ctx) + + def ctx_y(self, ctx): + return self._i.exports.ctx_y(ctx) + + def ctx_logo(self, ctx, *args): + args = [float(a) for a in args] + return self._i.exports.ctx_logo(ctx, *args) + def ctx_destroy(self, ctx): return self._i.exports.ctx_destroy(ctx) @@ -229,16 +239,17 @@ class Context: @property def x(self): - return 0 + return _wasm.ctx_x(self._ctx) @property def y(self): - return 0 + return _wasm.ctx_y(self._ctx) def _emit(self, text): _wasm.ctx_parse(self._ctx, text) - def logo(self, x, y, r): + def logo(self, x, y, dim): + _wasm.ctx_logo(self._ctx, x, y, dim) return self def move_to(self, x, y): diff --git a/sim/wasm/build.sh b/sim/wasm/build.sh index b4cac9a183db9b84fe8e39158d4d45eb816d9480..43af74969ddd3b6d8afc67a4cdf25b8031b1dbe0 100755 --- a/sim/wasm/build.sh +++ b/sim/wasm/build.sh @@ -18,7 +18,7 @@ emcc ctx.c \ -I ../../components/ctx/ \ -I ../../components/ctx/fonts/ \ -D SIMULATOR \ - -s EXPORTED_FUNCTIONS=_ctx_new_for_framebuffer,_ctx_new_drawlist,_ctx_parse,_ctx_apply_transform,_ctx_text_width,_ctx_render_ctx,_ctx_define_texture,_ctx_draw_texture,_ctx_destroy,_stbi_load_from_memory,_malloc,_free \ + -s EXPORTED_FUNCTIONS=_ctx_new_for_framebuffer,_ctx_new_drawlist,_ctx_parse,_ctx_apply_transform,_ctx_text_width,_ctx_x,_ctx_y,_ctx_render_ctx,_ctx_logo,_ctx_define_texture,_ctx_draw_texture,_ctx_destroy,_stbi_load_from_memory,_malloc,_free \ --no-entry -flto -O3 \ -o ctx.wasm diff --git a/sim/wasm/ctx.wasm b/sim/wasm/ctx.wasm index 68a2afc1994c401992ff5359484f2fc88b0e66ee..a295a5a8d6612e044da65e2653c1afa92ea677a2 100755 Binary files a/sim/wasm/ctx.wasm and b/sim/wasm/ctx.wasm differ