Files
marl/README.md
2026-05-30 15:05:58 +10:00

1.5 KiB

Max's Awesome Rendering Library

#include <marl.h>
#include <stdio.h>

int main() {
    Marl_Window* window = Marl.createWindow("dingus", 800, 600);
    if (window == NULL) {
        printf("Window didn't create lmao\n");
        return 1;
    }

    Marl_Font* font = Marl.Font.load("/usr/share/fonts/TTF/JetBrainsMono-Regular.ttf", 24.0f);

    int counter = 0;

    while (1) {
        Marl_Event e = Marl.poll(window);
        if (e.type == Marl_Quit) {
            break;
        }
        if (e.type == Marl_MouseDown) {
            counter++;
        }
        char buf[256];
        if (counter == 0) {
            snprintf(buf, sizeof(buf), "Click the window!");
        } else {
            snprintf(buf, sizeof(buf), "You clicked %d times!", counter);
        }
        Marl.clearScreen(window, 0xFF000000);
        Marl.drawRect(window, 100, 100, 200, 150, 0xFF0000FF);
        Marl.drawText(window, font, buf, 100, 80, 0xFFFFFFFF);
        Marl.render(window);
    }

    Marl.Font.destroy(&font);
    Marl.destroyWindow(&window);

}

Building

# make <backend>

# Example
make x11

Currently supported backends:

  • x11

Installing

Build your preferred backend, then:

sudo make install

Usage

gcc myprogram.c -lmarl -o myprogram

Creating your own backend

Create a new folder in src with the name of your backend, and copy the template/marl.c file into the folder.

License

Marl is licensed to you under the MIT license.

Credits

  • stb_truetype.h: Font rendering on x11
  • XCB: x11 backend