{"id":18823181,"url":"https://github.com/mobius3/kiwi","last_synced_at":"2025-04-14T01:24:55.753Z","repository":{"id":16536076,"uuid":"19289429","full_name":"mobius3/kiwi","owner":"mobius3","description":"KiWi: Killer Widgets","archived":false,"fork":false,"pushed_at":"2020-08-01T07:38:12.000Z","size":2482,"stargazers_count":188,"open_issues_count":10,"forks_count":20,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-27T15:22:19.693Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mobius3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-29T19:46:34.000Z","updated_at":"2025-03-27T11:08:19.000Z","dependencies_parsed_at":"2022-09-14T02:20:39.017Z","dependency_job_id":null,"html_url":"https://github.com/mobius3/kiwi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobius3%2Fkiwi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobius3%2Fkiwi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobius3%2Fkiwi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobius3%2Fkiwi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mobius3","download_url":"https://codeload.github.com/mobius3/kiwi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248805795,"owners_count":21164389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T00:53:01.941Z","updated_at":"2025-04-14T01:24:55.732Z","avatar_url":"https://github.com/mobius3.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"KiWi - The Killer Widgets library\n=================================\n![Linux](https://github.com/mobius3/kiwi/workflows/Linux/badge.svg)\n\n*Killer Widgets* (KiWi) is a widget-based GUI library for game developers to use in their 2D games, written in C99. Its widgets are constructed by using a tileset, allowing you to easly customize the looks of your GUI by simply changing its tiles.\n\nKiWi works around SDL2 libraries but has space for custom rendering backends.\n\nHere are some screenshots (click on them to see code):\n\n[![Label screenshot](https://raw.githubusercontent.com/mobius3/KiWi/master/examples/label/label-screenshot.png \"Label screenshot\")](https://github.com/mobius3/KiWi/blob/master/examples/label/label.c)\n[![A Family of Frames](https://raw.githubusercontent.com/mobius3/KiWi/master/examples/frame-family/frame-family-screenshot.png \"A Family of Frames\")](https://github.com/mobius3/KiWi/blob/master/examples/frame-family/frame-family.c)\n\n[![Two Editboxes and a button](https://raw.githubusercontent.com/mobius3/KiWi/master/examples/editbox/editbox-screenshot.png \"Two Editboxes and a button\")](https://github.com/mobius3/KiWi/blob/master/examples/editbox/editbox.c)\n[![Styleswitcher](https://raw.githubusercontent.com/mobius3/KiWi/master/examples/styleswitcher/styleswitcher-screenshot.gif \"Styleswitcher\")](https://github.com/mobius3/KiWi/blob/master/examples/styleswitcher/styleswitcher.c)\n\n[![A scrollbox full of dragable buttons](https://raw.githubusercontent.com/mobius3/KiWi/master/examples/scrollbox/scrollbox-screenshot.gif \"A scrollbox full of dragable buttons\")](https://github.com/mobius3/KiWi/blob/master/examples/scrollbox/scrollbox.c)\n\n**Road to 1.0.0**\n\nKiWi is not finished yet, it's API still needs to be stabilized and might change\nin the future. We're heading towards a 1.0.0 release. Checkout the [roadmap].\n\n## Bindings\n* [Vasilij Schneidermann](https://github.com/wasamasa) [created](http://emacsninja.com/posts/kiwi.html) a [CHICKEN Scheme](https://www.call-cc.org/) [binding](https://github.com/wasamasa/kiwi) for KiWi. There's also a wiki [here](http://wiki.call-cc.org/eggref/4/kiwi).\n* [dKiWi](https://github.com/aferust/dkiwi) - D binding.\n\n## Basic usage\n\nHere is a very basic code that draws a label on screen (taken from the \n[label] example):\n\n```cpp\n/**\n * This is the `label` example. It displays a label with an icon inside a frame.\n * The icon is merely a region inside the GUI tileset.\n */\n#include \"KW_gui.h\"\n#include \"KW_frame.h\"\n#include \"KW_label.h\"\n#include \"KW_renderdriver_sdl2.h\"\n\nint main(int argc, char ** argv) {\n  /* We are going to use the SDL2 Render Driver.\n   * Initialize SDL, creating a SDL window and renderer */\n  SDL_Init(SDL_INIT_EVERYTHING);\n  SDL_Renderer * renderer;\n  SDL_Window * window;\n  SDL_CreateWindowAndRenderer(320, 240, 0, \u0026window, \u0026renderer);\n  SDL_SetRenderDrawColor(renderer, 100, 100, 100, 1); /* pretty background */\n\n  /* Now we are going to use the SDL2 Render Driver. Users can implement their own\n   * render driver, as long as it complies to the KW_RenderDriver structure */\n  KW_RenderDriver * driver = KW_CreateSDL2RenderDriver(renderer, window);\n\n  /* Loads the \"tileset.png\" file as a surface */\n  KW_Surface * set = KW_LoadSurface(driver, \"tileset.png\");\n\n  /* At this point we can create the GUI. You can have multiple GUI instances\n   * in the same window (or even different windows, its up to the Render Driver) */\n  KW_GUI * gui = KW_Init(driver, set);\n\n  /* Loads a font and sets it. KiWi does not manage foreign memory (it does not own\n   * your pointers), so you must keep them to release later. */\n  KW_Font * font = KW_LoadFont(driver, \"Fontin-Regular.ttf\", 12);\n  KW_SetFont(gui, font);\n\n  /* Define a geometry and create a frame */\n  KW_Rect geometry = { x: 0, y: 0, w: 320, h: 240 };\n  KW_Widget * frame = KW_CreateFrame(gui, NULL, \u0026geometry);\n\n  /* Now create a label that has the frame as the parent, reutilizing\n   * the same geometry. Children widgets offset they x and y coordinates by their parent. */\n  KW_Widget * label = KW_CreateLabel(gui, frame, \"Label with an icon :)\", \u0026geometry);\n\n  /* Sets the rect in the tileset to extract the icon from, and sets it in the label */\n  KW_Rect iconrect = { x: 0, y: 48, w : 24, h : 24 };\n  KW_SetLabelIcon(label, \u0026iconrect);\n\n  /* Call KW_ProcessEvents(gui) and KW_Paint(gui) in your game loop. */\n  while (!SDL_QuitRequested()) {\n    SDL_RenderClear(renderer);\n    KW_ProcessEvents(gui);\n    KW_Paint(gui);\n    SDL_Delay(1);\n    SDL_RenderPresent(renderer);\n  }\n\n  /* All widgets are free'd after a KW_Quit */\n  KW_Quit(gui);\n\n  /* Releases things */\n  KW_ReleaseSurface(driver, set);\n  KW_ReleaseFont(driver, font);\n  KW_ReleaseRenderDriver(driver);\n  SDL_Quit();\n\n  return 0;\n}\n```\n\n[label]:https://github.com/mobius3/KiWi/blob/master/examples/label/label.c\n[KW_CreateWidget]: https://github.com/mobius3/KiWi/blob/master/src/KW_widget.h#L106\n[SDL2]: http://libsdl.org\n[SDL2_ttf]: https://www.libsdl.org/projects/SDL_ttf/\n[SDL2_image]: https://www.libsdl.org/projects/SDL_image/\n[roadmap]: https://github.com/mobius3/KiWi/blob/master/ROADMAP.md\n\n[CHICKENBINDING]: https://github.com/wasamasa/kiwi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobius3%2Fkiwi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmobius3%2Fkiwi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobius3%2Fkiwi/lists"}