Added custom color examples and fixed arg parsing bug

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2025-08-11 12:35:44 +0200
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2025-08-11 12:35:44 +0200
Commit 8af1af7350281f5d263b9fbc9779ff7d4cddcf2d (patch)
-rw-r--r-- README.md 30
-rw-r--r-- main.c 4
2 files changed, 32 insertions, 2 deletions
diff --git a/README.md b/README.md
...
138
| `color.BLANK`      | 0       | 0         | 0        | 0         |
138
| `color.BLANK`      | 0       | 0         | 0        | 0         |
139
| `color.MAGENTA`    | 255     | 0         | 255      | 255       |
139
| `color.MAGENTA`    | 255     | 0         | 255      | 255       |
140
  
140
  
  
141
#### Using custom colors
  
142
  
  
143
Color is essentially a structure with RGBA data. So constructing new colors is
  
144
very easy.
  
145
  
  
146
Alpha channel can be omitted and will by default be 255.
  
147
  
  
148
```lua
  
149
-- my_game.lua
  
150
  
  
151
open_window(800, 800, "My Game")
  
152
set_fps(60)
  
153
  
  
154
my_color1 = { r = 200, g = 200, b = 200, a = 255 }
  
155
my_color2 = { r = 200, g = 200, b = 200 }
  
156
  
  
157
while window_running() do
  
158
    start_drawing()
  
159
    clear_window(color.BLACK)
  
160
  
  
161
    draw_rect(100, 100, 100, 100, my_color1)
  
162
    draw_rect(300, 100, 100, 100, my_color2)
  
163
  
  
164
    draw_info()
  
165
    stop_drawing()
  
166
end
  
167
  
  
168
close_window()
  
169
```
  
170
  
141
## Libraries & Assets
171
## Libraries & Assets
142
  
172
  
143
- https://github.com/rxi/microtar
173
- https://github.com/rxi/microtar
...
diff --git a/main.c b/main.c
...
528
static void help(const char *argv0) {
528
static void help(const char *argv0) {
529
	printf("Usage: %s [options]\n"
529
	printf("Usage: %s [options]\n"
530
			"\nAvailable options:\n"
530
			"\nAvailable options:\n"
531
			"  -r,--run=file.lua       run input file\n"
531
			"  -f,--file=file.lua       run input file\n"
532
			"  -b,--bundle             bundles this folder\n"
532
			"  -b,--bundle             bundles this folder\n"
533
			"  -d,--debug              prints debug information\n"
533
			"  -d,--debug              prints debug information\n"
534
			"  -h,--help               this help\n"
534
			"  -h,--help               this help\n"
...
550
  
550
  
551
	const char short_options[] = "f:dbhv";
551
	const char short_options[] = "f:dbhv";
552
	const struct option long_options[] = {
552
	const struct option long_options[] = {
553
		{ "file", 1, NULL, 'r' },
553
		{ "file", 1, NULL, 'f' },
554
		{ "debug", 0, NULL, 'd' },
554
		{ "debug", 0, NULL, 'd' },
555
		{ "bundle", 0, NULL, 'b' },
555
		{ "bundle", 0, NULL, 'b' },
556
		{ "help", 0, NULL, 'h' },
556
		{ "help", 0, NULL, 'h' },
...