An open API service indexing awesome lists of open source software.

https://github.com/skelebyte/minwinlib

A simple window creation library written in C for Windows and Linux
https://github.com/skelebyte/minwinlib

c mit-license win32 window windows x11

Last synced: 3 months ago
JSON representation

A simple window creation library written in C for Windows and Linux

Awesome Lists containing this project

README

          

# MWL
MinWinLib (MWL) is a simple, single-file library to create a window, supporting Windows (Win32) and Linux (X11).

## Creating a window with MWL
Creating a window is simple, just include `MinWinLib.c` and call `MWL_createWindow`.
```c
#include
#include "path/to/MinWinLib.c"

int main() {
MWL_Window window;
MWL_createWindow(&window, "Hi, mum!", 1000, 600, MWL_DEFAULT_FLAGS);
return 0;
}
```
To make sure the window doesn't close the moment you run the code you need to call `MWL_process` function and pass in a reference to a `MWL_Window`.
This must be done inside a while loop that checks to check events from the window.
```c
int main() {
printf("Creating window!\n");

MWL_Window window;
MWL_createWindow(&window, "Hi, mum!", 1000, 600, MWL_DEFAULT_FLAGS);

// The loop will run only if the window is open. This is where your program's main code goes.
while(MWL_process(&window) != MWL_QUIT) {
// Code goes here...
}

printf("Loop ended\n");
return 0;

}
```