Skip to content
Snippets Groups Projects
Verified Commit 4bebf7c1 authored by dos's avatar dos
Browse files

sim: fakes: ctx: Implement ctx_x, ctx_y and ctx_logo bindings

parent 588fd6b8
No related branches found
No related tags found
No related merge requests found
...@@ -97,6 +97,16 @@ class Wasm: ...@@ -97,6 +97,16 @@ class Wasm:
self.free(p) self.free(p)
return res 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): def ctx_destroy(self, ctx):
return self._i.exports.ctx_destroy(ctx) return self._i.exports.ctx_destroy(ctx)
...@@ -229,16 +239,17 @@ class Context: ...@@ -229,16 +239,17 @@ class Context:
@property @property
def x(self): def x(self):
return 0 return _wasm.ctx_x(self._ctx)
@property @property
def y(self): def y(self):
return 0 return _wasm.ctx_y(self._ctx)
def _emit(self, text): def _emit(self, text):
_wasm.ctx_parse(self._ctx, 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 return self
def move_to(self, x, y): def move_to(self, x, y):
......
...@@ -18,7 +18,7 @@ emcc ctx.c \ ...@@ -18,7 +18,7 @@ emcc ctx.c \
-I ../../components/ctx/ \ -I ../../components/ctx/ \
-I ../../components/ctx/fonts/ \ -I ../../components/ctx/fonts/ \
-D SIMULATOR \ -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 \ --no-entry -flto -O3 \
-o ctx.wasm -o ctx.wasm
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment