diff options
| 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) | |
| tree | 6bcd7e9bed0eaec362eebbafd2bd298bee289c87 | |
| parent | fa1aa7793bbe2a3647435798c56f43945278bcd0 (diff) | |
| download | bidi-8af1af7350281f5d263b9fbc9779ff7d4cddcf2d.tar.gz | |
Added custom color examples and fixed arg parsing bug
| -rw-r--r-- | README.md | 30 | ||||
| -rw-r--r-- | main.c | 4 |
2 files changed, 32 insertions, 2 deletions
@@ -138,6 +138,36 @@ close_window() | `color.BLANK` | 0 | 0 | 0 | 0 | | `color.MAGENTA` | 255 | 0 | 255 | 255 | +#### Using custom colors + +Color is essentially a structure with RGBA data. So constructing new colors is +very easy. + +Alpha channel can be omitted and will by default be 255. + +```lua +-- my_game.lua + +open_window(800, 800, "My Game") +set_fps(60) + +my_color1 = { r = 200, g = 200, b = 200, a = 255 } +my_color2 = { r = 200, g = 200, b = 200 } + +while window_running() do + start_drawing() + clear_window(color.BLACK) + + draw_rect(100, 100, 100, 100, my_color1) + draw_rect(300, 100, 100, 100, my_color2) + + draw_info() + stop_drawing() +end + +close_window() +``` + ## Libraries & Assets - https://github.com/rxi/microtar @@ -528,7 +528,7 @@ static int l_stop_sound(lua_State *L) { static void help(const char *argv0) { printf("Usage: %s [options]\n" "\nAvailable options:\n" - " -r,--run=file.lua run input file\n" + " -f,--file=file.lua run input file\n" " -b,--bundle bundles this folder\n" " -d,--debug prints debug information\n" " -h,--help this help\n" @@ -550,7 +550,7 @@ int main(int argc, char *argv[]) { const char short_options[] = "f:dbhv"; const struct option long_options[] = { - { "file", 1, NULL, 'r' }, + { "file", 1, NULL, 'f' }, { "debug", 0, NULL, 'd' }, { "bundle", 0, NULL, 'b' }, { "help", 0, NULL, 'h' }, |
