{"id":16186891,"url":"https://github.com/robloach/pntr_app","last_synced_at":"2025-03-16T10:32:04.075Z","repository":{"id":182840798,"uuid":"668984630","full_name":"RobLoach/pntr_app","owner":"RobLoach","description":"Application wrapper for pntr.","archived":false,"fork":false,"pushed_at":"2024-05-19T15:58:23.000Z","size":1862,"stargazers_count":5,"open_issues_count":35,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-19T16:58:21.871Z","etag":null,"topics":["pntr"],"latest_commit_sha":null,"homepage":"https://robloach.github.io/pntr_app/","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/RobLoach.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-21T04:31:45.000Z","updated_at":"2024-05-30T23:24:07.495Z","dependencies_parsed_at":"2023-07-21T18:48:00.700Z","dependency_job_id":"99c5e9d8-2577-45a9-83cd-5fabc931c191","html_url":"https://github.com/RobLoach/pntr_app","commit_stats":null,"previous_names":["robloach/pntr_app"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fpntr_app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fpntr_app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fpntr_app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fpntr_app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobLoach","download_url":"https://codeload.github.com/RobLoach/pntr_app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814898,"owners_count":20352037,"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":["pntr"],"created_at":"2024-10-10T07:19:45.943Z","updated_at":"2025-03-16T10:32:04.033Z","avatar_url":"https://github.com/RobLoach.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pntr_app\n\nBuild [pntr](https://github.com/robloach/pntr) applications with the same code for a number of different targets, including SDL, raylib, libretro, the web, and more.\n\n## Features\n\n- Compile for a number of platforms...\n    - [raylib](https://www.raylib.com/)\n    - [SDL 3](https://www.libsdl.org/)\n    - Web with [Emscripten](https://emscripten.org/)\n    - [libretro](https://www.libretro.com/) and RetroArch\n    - Command Line Interfaces with [termbox2](https://github.com/termbox/termbox2)\n- Software rendering with [pntr](https://github.com/robloach/pntr)\n- Audio (*.wav* or *.ogg*)\n- Input with Mouse, Keyboard, or Gamepads\n\n## Example\n\n``` c\n#define PNTR_APP_IMPLEMENTATION\n#include \"pntr_app.h\"\n\nbool Init(pntr_app* app) {\n    // Initialize the application, return false on failure.\n    return true;\n}\n\nbool Update(pntr_app* app, pntr_image* screen) {\n    // Clear the screen.\n    pntr_clear_background(screen, PNTR_WHITE);\n\n    // Draw a circle.\n    pntr_draw_circle_fill(screen, screen-\u003ewidth / 2, screen-\u003eheight / 2, 100, PNTR_BLUE);\n\n    // Continue running the application.\n    return true;\n}\n\nvoid Close(pntr_app* app) {\n    // Uninitialize the application.\n}\n\npntr_app Main(int argc, char* argv[]) {\n    return (pntr_app) {\n        .width = 800,\n        .height = 450,\n        .title = \"pntr_app\",\n        .init = Init,\n        .update = Update,\n        .close = Close,\n        .fps = 60\n    };\n}\n```\n\n## Configuration\n\nWhen compiling, define one of the following to determine which platform you are targeting...\n```\nPNTR_APP_SDL\nPNTR_APP_RAYLIB\nPNTR_APP_LIBRETRO\nPNTR_APP_CLI\nPNTR_APP_WEB\n```\n\n## API\n\nFor rendering, see the [pntr API](https://github.com/RobLoach/pntr).\n\n``` c\n// Application\npntr_app Main(int argc, char* argv[]);\nint pntr_app_width(pntr_app* app);\nint pntr_app_height(pntr_app* app);\nvoid pntr_app_set_title(pntr_app* app, const char* title);\nconst char* pntr_app_title(pntr_app* app);\nvoid* pntr_app_userdata(pntr_app* app);\nvoid pntr_app_set_userdata(pntr_app* app, void* userData);\nbool pntr_app_set_size(pntr_app* app, int width, int height);\nvoid pntr_app_set_icon(pntr_app* app, pntr_image* icon);\nfloat pntr_app_delta_time(pntr_app* app);\n\n// Input\nbool pntr_app_key_pressed(pntr_app* app, pntr_app_key key);\nbool pntr_app_key_down(pntr_app* app, pntr_app_key key);\nbool pntr_app_key_released(pntr_app* app, pntr_app_key key);\nbool pntr_app_key_up(pntr_app* app, pntr_app_key key);\nbool pntr_app_gamepad_button_pressed(pntr_app* app, int gamepad, pntr_app_gamepad_button key);\nbool pntr_app_gamepad_button_down(pntr_app* app, int gamepad, pntr_app_gamepad_button key);\nbool pntr_app_gamepad_button_released(pntr_app* app, int gamepad, pntr_app_gamepad_button key);\nfloat pntr_app_mouse_x(pntr_app* app);\nfloat pntr_app_mouse_y(pntr_app* app);\nfloat pntr_app_mouse_delta_x(pntr_app* app);\nfloat pntr_app_mouse_delta_y(pntr_app* app);\nbool pntr_app_mouse_button_pressed(pntr_app* app, pntr_app_mouse_button button);\nbool pntr_app_mouse_button_down(pntr_app* app, pntr_app_mouse_button button);\nbool pntr_app_mouse_button_released(pntr_app* app, pntr_app_mouse_button button);\nbool pntr_app_mouse_button_up(pntr_app* app, pntr_app_mouse_button button);\n\n// Utility\nint pntr_app_random(pntr_app* app, int min, int max);\nfloat pntr_app_random_float(pntr_app* app, float min, float max);\nuint64_t pntr_app_random_seed(pntr_app* app);\nvoid pntr_app_random_set_seed(pntr_app* app, uint64_t seed);\nvoid pntr_app_log(pntr_app_log_type type, const char* message);\nvoid* pntr_app_load_arg_file(pntr_app* app, unsigned int* size);\n\n// Sounds\npntr_sound* pntr_load_sound(const char* fileName);\npntr_sound* pntr_load_sound_from_memory(pntr_app_sound_type type, unsigned char* data, unsigned int dataSize);\nvoid pntr_unload_sound(pntr_sound* sound);\nvoid pntr_play_sound(pntr_sound* sound, bool loop);\nvoid pntr_stop_sound(pntr_sound* sound);\nvoid pntr_set_volume(pntr_sound* sound, float volume);\nbool pntr_sound_playing(pntr_sound* sound);\n```\n\n## Build\n\nThere are a few platforms supported by pntr_app, which have their own build methods...\n\n### Desktop\n\nTo build the raylib and SDL applications, use [CMake](https://cmake.org/). Depends on either [raylib](https://www.raylib.com/), or [SDL](https://www.libsdl.org/) along with [SDL_mixer](https://github.com/libsdl-org/SDL_mixer)...\n\n``` bash\ncmake -B build\ncmake --build build\n```\n\nYou can disable building some examples by using...\n\n``` bash\ncmake -B build -DPNTR_APP_BUILD_EXAMPLE_SDL=false -DPNTR_APP_BUILD_EXAMPLE_RAYLIB=false\ncmake --build build\n```\n\n### libretro\n\nTo build the libretro core, use `make`. Depends on [libretro-common](https://github.com/libretro/libretro-common).\n\n``` bash\ngit submodule update --init\ncd example\nmake\n```\n\n#### libretro WASM\n\n``` bash\ncd example\nemmake make platform=emscripten\n```\n\n### Web\n\nBuild for the web with [Emscripten](https://emscripten.org/) and raylib. Depends on [emsdk](https://emscripten.org/docs/tools_reference/emsdk.html).\n\n``` bash\nemcmake cmake -B build -DPNTR_APP_BUILD_EXAMPLE_RAYLIB=false -DPNTR_APP_BUILD_EXAMPLE_WEB=true\nemmake make -C build\nemrun build/example/index.html\n```\n\n## License\n\nUnless stated otherwise, all works are:\n\n- Copyright (c) 2023 [Rob Loach](https://robloach.net)\n\n... and licensed under:\n\n- [zlib License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobloach%2Fpntr_app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobloach%2Fpntr_app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobloach%2Fpntr_app/lists"}