{"id":21436988,"url":"https://github.com/axfab/kora-lgfx","last_synced_at":"2025-03-16T23:24:13.613Z","repository":{"id":74655643,"uuid":"192950366","full_name":"AxFab/kora-lgfx","owner":"AxFab","description":"Simple library for UI applications","archived":false,"fork":false,"pushed_at":"2022-08-07T16:24:53.000Z","size":304,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-01-23T09:35:34.267Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AxFab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-20T16:05:57.000Z","updated_at":"2023-11-02T09:47:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"ea514854-40db-4389-a545-1da63503a510","html_url":"https://github.com/AxFab/kora-lgfx","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/AxFab%2Fkora-lgfx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fkora-lgfx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fkora-lgfx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fkora-lgfx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AxFab","download_url":"https://codeload.github.com/AxFab/kora-lgfx/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243945888,"owners_count":20372951,"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-23T00:17:14.084Z","updated_at":"2025-03-16T23:24:13.608Z","avatar_url":"https://github.com/AxFab.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Library Graphics `lgfx.so`\n\n The `lgfx` library aims to support the most basic way to create a surface and\n receive basic UI events. The goal is to offer the most basic yet reliable way\n to access graphics on multiple platform.\n\n The library can be build for several distributions. As it serves as the\n primary access method for Kora OS, it also work on Win32 and X11 API.\n\n The library runs fine by itself but can really benefits from a couple of\n optional third-parties:\n\n  - `freetype2`\n  - `libpng`\n\n## Application Sample\n\n Let's see the most simple way of using lgfx library to create a graphic\n application.\n\n```c\n#include \u003cgfx.h\u003e\n\nvoid app_paint(gfx_t *win)\n{\n    gfx_map(win);\n    // ...\n    gfx_flip(win);\n}\n\nvoid app_keypress(unsigned key, int mode, int *ptr_redraw)\n{\n    // ...\n}\n\nint main(int argc, char **argv)\n{\n    int need_redraw = 0;\n    gfx_t* win = gfx_create_window(_16x10(480), 480);\n    gfx_msg_t msg;\n    gfx_timer(0, 20);\n    while (gfx_poll(\u0026msg) == 0 \u0026\u0026 msg.message != GFX_EV_QUIT) {\n        gfx_handle(\u0026msg);\n        switch (msg.message) {\n        case GFX_EV_TIMER: // Do painting\n            if (need_redraw != 0) {\n                app_paint(win);\n                need_redraw = 1;\n            }\n            break;\n        case GFX_EV_KEYPRESS: // Handle keyboard events\n            app_keypress(msg.param1, msg.param2, \u0026need_redraw);\n            break;\n        case GFX_EV_RESIZE: // Invalid painting\n            need_redraw = 1;\n            break;\n        }\n    }\n\n    gfx_destroy(win);\n    return 0;\n}\n```\n\n\n## Surface\n\n - `gfx_create_surface`\n - `gfx_create_window`\n - `gfx_load_image`\n - `gfx_destroy`\n - `gfx_save_image`\n - `gfx_open_surface` (only on Kora!)\n\n## Mapping operations\n\n - `gfx_map`\n - `gfx_unmap`\n - `gfx_width`\n - `gfx_height`\n - `gfx_resize`\n - `gfx_flip`\n\n## Events\n\n - `gfx_poll`\n - `gfx_handle`\n - `gfx_push`\n - `gfx_timer`\n\n## Drawing operations\n\n - `gfx_fill`\n - `gfx_blit`\n - `gfx_blit_scale`\n\n## Font operations\n\n - `gfx_font`\n - `gfx_clear_font`\n - `gfx_mesure_text`\n - `gfx_write`\n\n\n## Display and Desktop\n\n - `gfx_context`\n - `gfx_keyboard`\n\n \u003e _To define_\n\n\n## Note\n\n \u003e The library is not unlike `SDL2`. To reach the same capability as the SDL, you will need to combine c11 thread support, `lgfx`, `lsnd`, OpenGl support, Joystick support and Haptic devices and power managment.\n\n - Handle change of keyboard\n - Configure to use GFX_EV_KEYPRESS from the system if available\n - Create a small tool to create a keyboard mapping !!\n - Add support for ico/jpeg/gif..\n - Add support to set window caption !\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxfab%2Fkora-lgfx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxfab%2Fkora-lgfx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxfab%2Fkora-lgfx/lists"}