Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skelebyte/minwinlib
Simple C/C++ Window Creation Library for Windows
https://github.com/skelebyte/minwinlib
c cpp mit-license win32 window windows x11
Last synced: about 1 month ago
JSON representation
Simple C/C++ Window Creation Library for Windows
- Host: GitHub
- URL: https://github.com/skelebyte/minwinlib
- Owner: Skelebyte
- License: mit
- Created: 2024-10-25T15:17:31.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-28T03:35:12.000Z (3 months ago)
- Last Synced: 2024-10-28T11:23:48.669Z (3 months ago)
- Topics: c, cpp, mit-license, win32, window, windows, x11
- Language: C
- Homepage:
- Size: 20.5 KB
- Stars: 1
- 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 and manage windows, currently only supporting the Win32 API.
> [!IMPORTANT]
> Linux support is coming! (with X11)## Creating a window with MWL
Creating a window is simple, just include `MinWinLib.h` and call `MWL_createWindow`.
```c
#include
#include "path/to/MinWinLib.h"int main() {
MWL_Window window = MWL_createWindow("Hi, mum!", 1000, 600, true);
return 0;
}
```
To make sure the window doesn't crash 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 see if the window is closed, or the program will crash.
```c
int main() {
printf("Creating window!\n");MWL_Window window = MWL_createWindow("Hi, mum!", 1000, 600, true);
// The loop will run only if the window is open. This is where your program's main code goes.
while(window.closed == false) {
MWL_process(&window);Sleep(10);
}printf("Loop ended\n");
return 0;}
```