News for hackers. Stuff that matters.
Re:The Story Behind Fenster by Lerc on Monday September 09, 2024 @02:29AM (#41485957)
This has popped up because

Microui+fenster=Small GUI https://news.ycombinator.com/item?id=41477446

Was posted in the last day.

In that thread I suggested that API compatibility would be the way to go for more esoteric platforms, Since there's already comments here about BSD and Android targets.

All you need is

    struct fenster {
      const char *title; /* window title */
      const int width; /* window width */
      const int height; /* window height */
      uint32_t *buf; /* window pixels, 24-bit RGB, row by row, pixel by pixel */
      int keys[256]; /* keys are mostly ASCII, but arrows are 17..20 */
      int mod;       /* mod is 4 bits mask, ctrl=1, shift=2, alt=4, meta=8 */
      int x;         /* mouse X coordinate */
      int y;         /* mouse Y coordinate */
      int mouse;     /* 0 = no buttons pressed, 1 = left button pressed */
    };

    int fenster_open(struct fenster *f)
    int fenster_loop(struct fenster *f)
    void fenster_close(struct fenster *f) 
    void fenster_sleep(int ms)
    int64_t fenster_time() 
    fenster_pixel(f, x, y) 
    uint32_t px = fenster_pixel(f, x, y); 
A bit more for audio, but that's really it's own little API

As a mimimal API for doing interactive apps, it's hard to beat. I can see hobbyists who make their own operating systems taking advantage of this to get things working quickly.

There are no comments on this comment yet.