Files
marl/README.md

83 lines
1.5 KiB
Markdown
Raw Normal View History

2026-05-30 15:05:58 +10:00
# Max's Awesome Rendering Library
```c
#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
```shell
# make <backend>
# Example
make x11
```
Currently supported backends:
* `x11`
## Installing
Build your preferred backend, then:
```shell
sudo make install
```
## Usage
```shell
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