Initial commit
This commit is contained in:
82
README.md
Normal file
82
README.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user