Initial commit
This commit is contained in:
38
test/main.c
Normal file
38
test/main.c
Normal file
@@ -0,0 +1,38 @@
|
||||
#include <marl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
Marl_Window* window = Marl.createWindow("Click Me!", 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);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user