
is a small, cross-platform, software windowing library now in ANSI C
Unix:
./configure [x11|wayland|mac]
make # That's it!Windows:
.\build.bat [msvc|gcc|clang]
If anyone is on Windows, please try to compile past the ANSI conversion. I pretty much converted it without checking so there may still be C99 artefacts left behind.
After building, you have a library which you link your sources with. It is
located in build/.
Here is an annoted (C99) example for a basic window program which counts the number of frames that have elapsed, draw the text and displays if you've pressed a key (specifically 'A').
For the full list of functions and what they do, look at the header.
#include"maus.h"#include"maus_font.h"intmain(void)
{
intx=50, y=50, width=640, height=480;
Maus*ctx=maus_init("example!", x, y, width, height);
maus_create_window(ctx);
MausFont*font=maus_font_load("assets/fonts/font1.bdf");
intrunning= true;
long longframes=0;
inta_pressed= false;
while (running) {
MausEventev;
while (maus_event_poll(ctx, &ev)) {
// to see the full list of event types, look at// the enum `MausEventType` in `maus.h`if (ev.type==MAUS_EV_CLOSE) {
running= false;
continue;
}
if (ev.type==MAUS_EV_KEY&&ev.key.pressed) {
if (ctx->key_syms[MAUS_KEY_A])
a_pressed=1;
}
}
// clear framebuffer with color white// colors are in format ARGBmaus_clear(ctx, (MausColor){255, 255, 255, 255});
if (a_pressed) {
constchar*msg="how dare you press a!!";
maus_draw_text(ctx, font, 10, 50, msg, (MausColor){255, 255, 0, 0});
}
charframes_text[256];
snprintf(frames_text, sizeof(frames_text), "%lld", frames++);
maus_draw_text(ctx, font, 10, 20, frames_text, (MausColor){255, 255, 0, 0});
maus_target_fps(ctx, 512);
maus_present(ctx);
}
// free resourcesmaus_font_free(font);
maus_close(ctx);
}