microui.c 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2024 rxi
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,114 @@
1
+ # ![microui](https://user-images.githubusercontent.com/3920290/75171571-be83c500-5723-11ea-8a50-504cc2ae1109.png)
2
+ A *tiny*, portable, immediate-mode UI library written in ANSI C
3
+
4
+ ## Features
5
+ * Tiny: around `1100 sloc` of ANSI C
6
+ * Works within a fixed-sized memory region: no additional memory is allocated
7
+ * Built-in controls: window, scrollable panel, button, slider, textbox, label,
8
+ checkbox, wordwrapped text
9
+ * Works with any rendering system that can draw rectangles and text
10
+ * Designed to allow the user to easily add custom controls
11
+ * Simple layout system
12
+
13
+ <br>
14
+
15
+ ## Installation
16
+
17
+ Run:
18
+
19
+ ```sh
20
+ $ npm i microui.c
21
+ ```
22
+
23
+ And then include `microui.h` as follows:
24
+
25
+ ```c
26
+ // main.c
27
+ #define MICROUI_IMPLEMENTATION
28
+ #include "node_modules/microui.c/microui.h"
29
+
30
+ int main() { /* ... */ }
31
+ ```
32
+
33
+ And then compile with `clang` or `gcc` as usual.
34
+
35
+ ```bash
36
+ $ clang main.c # or, use gcc
37
+ $ gcc main.c
38
+ ```
39
+
40
+ You may also use a simpler approach:
41
+
42
+ ```c
43
+ // main.c
44
+ #define MICROUI_IMPLEMENTATION
45
+ #include <microui.h>
46
+
47
+ int main() { /* ... */ }
48
+ ```
49
+
50
+ If you add the path `node_modules/microui.c` to your compiler's include paths.
51
+
52
+ ```bash
53
+ $ clang -I./node_modules/microui.c main.c # or, use gcc
54
+ $ gcc -I./node_modules/microui.c main.c
55
+ ```
56
+
57
+ <br>
58
+
59
+ ## Example
60
+ ![example](https://user-images.githubusercontent.com/3920290/75187058-2b598800-5741-11ea-9358-38caf59f8791.png)
61
+ ```c
62
+ if (mu_begin_window(ctx, "My Window", mu_rect(10, 10, 140, 86))) {
63
+ mu_layout_row(ctx, 2, (int[]) { 60, -1 }, 0);
64
+
65
+ mu_label(ctx, "First:");
66
+ if (mu_button(ctx, "Button1")) {
67
+ printf("Button1 pressed\n");
68
+ }
69
+
70
+ mu_label(ctx, "Second:");
71
+ if (mu_button(ctx, "Button2")) {
72
+ mu_open_popup(ctx, "My Popup");
73
+ }
74
+
75
+ if (mu_begin_popup(ctx, "My Popup")) {
76
+ mu_label(ctx, "Hello world!");
77
+ mu_end_popup(ctx);
78
+ }
79
+
80
+ mu_end_window(ctx);
81
+ }
82
+ ```
83
+
84
+ <br>
85
+
86
+ ## Screenshot
87
+ ![screenshot](https://user-images.githubusercontent.com/3920290/75188642-63ae9580-5744-11ea-9eee-d753ff5c0aa7.png)
88
+
89
+ [**Browser Demo**](https://floooh.github.io/sokol-html5/sgl-microui-sapp.html)
90
+
91
+ ## Usage
92
+ * See [`doc/usage.md`](doc/usage.md) for usage instructions
93
+ * See the [`demo`](demo) directory for a usage example
94
+
95
+ ## Notes
96
+ The library expects the user to provide input and handle the resultant drawing
97
+ commands, it does not do any drawing itself.
98
+
99
+ ## Contributing
100
+ The library is designed to be lightweight, providing a foundation to which you
101
+ can easily add custom controls and UI elements; pull requests adding additional
102
+ features will likely not be merged. Bug reports are welcome.
103
+
104
+ ## License
105
+ This library is free software; you can redistribute it and/or modify it under
106
+ the terms of the MIT license. See [LICENSE](LICENSE) for details.
107
+
108
+ <br>
109
+ <br>
110
+
111
+
112
+ [![SRC](https://img.shields.io/badge/src-repo-green?logo=Org)](https://github.com/rxi/microui)
113
+ [![ORG](https://img.shields.io/badge/org-nodef-green?logo=Org)](https://nodef.github.io)
114
+ ![](https://ga-beacon.deno.dev/G-RC63DPBH3P:SH3Eq-NoQ9mwgYeHWxu7cw/github.com/nodef/utf8.c)