From d91847310a1372933b48c1bdfc07703678a3337c Mon Sep 17 00:00:00 2001 From: doinkythederp Date: Tue, 26 Nov 2024 23:27:09 -0800 Subject: [PATCH] feat: link `vexDisplayFontNamedSet` --- packages/runtime/src/sdk.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/runtime/src/sdk.rs b/packages/runtime/src/sdk.rs index bb8fe5a..c307e93 100644 --- a/packages/runtime/src/sdk.rs +++ b/packages/runtime/src/sdk.rs @@ -86,11 +86,8 @@ pub fn link(store: &mut Store, instance: &mut Instance) -> anyhow::R fn vexDisplayCircleClear(xc: i32, yc: i32, radius: i32); fn vexDisplayCircleFill(xc: i32, yc: i32, radius: i32); fn vexDisplayTextSize(n: u32, d: u32); - // fn vexDisplayFontNamedSet(pFontName: *const c_char); fn vexDisplayForegroundColorGet() -> u32; fn vexDisplayBackgroundColorGet() -> u32; - // fn vexDisplayStringWidthGet(pString: *const c_char) -> i32; - // fn vexDisplayStringHeightGet(pString: *const c_char) -> i32; fn vexDisplayClipRegionSet(x1: i32, y1: i32, x2: i32, y2: i32); fn vexDisplayRender(bVsyncWait: bool, bRunScheduler: bool); fn vexDisplayDoubleBufferDisable(); @@ -208,5 +205,16 @@ pub fn link(store: &mut Store, instance: &mut Instance) -> anyhow::R }, )?; + instance.link_closure( + &mut *store, + "vex", + "vexDisplayFontNamedSet", + |mut ctx, string: i32| { + let string = get_cstring(&mut ctx, string); + unsafe { vex_sdk::vexDisplayFontNamedSet(string.as_ptr()) }; + Ok(()) + }, + )?; + Ok(()) }