{"id":15722533,"url":"https://github.com/jerakin/defold-runtime-atlas","last_synced_at":"2025-05-07T22:29:24.660Z","repository":{"id":129089886,"uuid":"605325118","full_name":"Jerakin/defold-runtime-atlas","owner":"Jerakin","description":"Simple runtime atlas packer","archived":false,"fork":false,"pushed_at":"2024-09-11T21:12:25.000Z","size":43,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-06T04:48:23.503Z","etag":null,"topics":["defold","defold-library","defold-module"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jerakin.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-02-22T23:19:33.000Z","updated_at":"2025-04-26T14:45:12.000Z","dependencies_parsed_at":"2024-08-26T11:10:35.831Z","dependency_job_id":"c764567d-da98-4f2a-a37d-4273672e3cee","html_url":"https://github.com/Jerakin/defold-runtime-atlas","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/Jerakin%2Fdefold-runtime-atlas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jerakin%2Fdefold-runtime-atlas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jerakin%2Fdefold-runtime-atlas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jerakin%2Fdefold-runtime-atlas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jerakin","download_url":"https://codeload.github.com/Jerakin/defold-runtime-atlas/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252964458,"owners_count":21832697,"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":["defold","defold-library","defold-module"],"created_at":"2024-10-03T22:08:19.759Z","updated_at":"2025-05-07T22:29:24.637Z","avatar_url":"https://github.com/Jerakin.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Runtime Atlas\n\nThis serves as both an exampel and a library to help you create atlases at runtime.\n\n## Installation\nYou can use the runtime atlas in your own project by adding this project as a [Defold library dependency](http://www.defold.com/manuals/libraries/). Open your game.project file and in the dependencies field under project add:\n\nhttps://github.com/Jerakin/defold-runtime-atlas/archive/refs/heads/main.zip\n\nOr point to the ZIP file of a [specific release](https://github.com/Jerakin/defold-runtime-atlas/releases).\n\n## Quick Start\nYou only need to supply a list of images as well as width and height to `rtatlas.pack()` use it.\n\n```lua\nlocal rtatlas = require \"runtime-atlas.runtime-atlas\"\n\n\nlocal atlas_entries = {\n    \"example/assets/images/image0.png\", \"example/assets/images/image1.png\"\n}\n\nlocal atlas_id = rtatlas.pack(\"example\", atlas_entries, 256, 256)\n\ngo.set(\"#sprite\", \"image\", atlas_id)\nsprite.play_flipbook(\"#sprite\", \"image0.png\")\n```\n\nThe images added will be added with the full file name as the id. This always includes the `.png`.\n\n## API\n\n### rtatlas.pack(atlas_name_or_path, list_of_textures, width, height)\nPacks the provided list_of_textures into an atlas\n\n**PARAMETERS**\n* ```atlas_name_or_path``` (string) - If an path is provided it will load the texture at that path and update image data on it. If a name is provided a new atlas will be created.\n* ```list_of_textures``` (table) - A table of your images, these images needs to be available as resources.\n* ```width``` (number) - The height of your atlas\n* ```height``` (number) - The height of your atlas\n* ```options``` (table) - Optional table. \n    * ```premultiply_alpha``` ( boolean) True if alpha should be premultiplied into the color components. Defaults to false.\n\n\n### rtatlas.algorithm\nProperty which is the function that will be used to pack an atlas with. A simplistic rowpacking algorithm is provided as the default\n\n## Packing Algorithm\nIf you want to write your own algoritm the signature should be\n### algorithm.pack(list_of_textures, width, height)\n\n**PARAMETERS**\n* ```list_of_textures``` (table) - table of images to pack, each image is represented by a table `{name, w, h}` you are expected to return an extended version of this table where entries for positions `{x, y}` have been added.\n* ```width``` (number) - The height of your atlas\n* ```height``` (number) - The height of your atlas\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerakin%2Fdefold-runtime-atlas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjerakin%2Fdefold-runtime-atlas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerakin%2Fdefold-runtime-atlas/lists"}