notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

notedeck_api.h (1313B)


      1 #ifndef NOTEDECK_API_H
      2 #define NOTEDECK_API_H
      3 
      4 /*
      5  * Notedeck WASM API — Stable Interface
      6  *
      7  * Stability guarantees:
      8  *   - Function signatures will never change once published
      9  *   - New functions may be added; existing ones will not be removed
     10  *   - All parameters are i32, f32, or (const char *, int) byte buffers
     11  *   - Extended versions use the _ex suffix if needed
     12  *   - Colors are packed as 0xRRGGBBAA in a 32-bit int
     13  *
     14  * WASM module requirements:
     15  *   - Must export: void nd_update(void)
     16  *   - Must export: memory (1+ pages)
     17  *   - Optional exports: nd_app_name_ptr (i32), nd_app_name_len (i32)
     18  */
     19 
     20 /* Text & widgets */
     21 void  nd_label(const char *text, int len);
     22 void  nd_heading(const char *text, int len);
     23 int   nd_button(const char *text, int len);   /* returns 1 if clicked (prev frame) */
     24 
     25 /* Layout */
     26 void  nd_add_space(float pixels);
     27 float nd_available_width(void);
     28 float nd_available_height(void);
     29 
     30 /* Drawing — coordinates relative to app rect origin */
     31 void  nd_draw_rect(float x, float y, float w, float h, int color);
     32 void  nd_draw_circle(float cx, float cy, float r, int color);
     33 void  nd_draw_line(float x1, float y1, float x2, float y2, float width, int color);
     34 void  nd_draw_text(float x, float y, const char *text, int len, float size, int color);
     35 
     36 #endif /* NOTEDECK_API_H */