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
- Host: GitHub
- URL: https://github.com/skelebyte/minwinlib
- Owner: Skelebyte
- License: mit
- Created: 2024-10-25T15:17:31.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-20T14:41:02.000Z (over 1 year ago)
- Last Synced: 2025-07-02T06:06:12.370Z (about 1 year ago)
- Topics: c, mit-license, win32, window, windows, x11
- Language: C
- Homepage:
- Size: 57.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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;
}
```