{"id":24641002,"url":"https://github.com/thego-dev/squirkel","last_synced_at":"2025-03-20T11:48:48.578Z","repository":{"id":273595870,"uuid":"920112083","full_name":"thego-dev/squirkel","owner":"thego-dev","description":"A Löve2d pixel art scaling module with sharp non-integer support","archived":false,"fork":false,"pushed_at":"2025-01-21T20:07:28.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T21:22:20.740Z","etag":null,"topics":["love2d-library","lua","pixel-art"],"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/thego-dev.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":"2025-01-21T15:30:44.000Z","updated_at":"2025-01-21T20:07:31.000Z","dependencies_parsed_at":"2025-01-21T21:22:23.017Z","dependency_job_id":"a036b133-6b50-4768-87fc-c44e368395f1","html_url":"https://github.com/thego-dev/squirkel","commit_stats":null,"previous_names":["thego-dev/squirkel"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thego-dev%2Fsquirkel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thego-dev%2Fsquirkel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thego-dev%2Fsquirkel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thego-dev%2Fsquirkel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thego-dev","download_url":"https://codeload.github.com/thego-dev/squirkel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244609441,"owners_count":20480782,"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":["love2d-library","lua","pixel-art"],"created_at":"2025-01-25T12:11:58.524Z","updated_at":"2025-03-20T11:48:48.561Z","avatar_url":"https://github.com/thego-dev.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Squirkel\n### A Löve2d pixel art scaling module with sharp, non-integer scaling support\nInspired by, and partially based on, [maid64](https://github.com/adekto/maid64)\n\nVersion 1.0: the Essentials\n\n-----\n## Why?\nThe commonly known Love2d pixel art scaling modules are all locked to integer scaling.\nWhich is okay... until you make a project with a really unconventional resolution, as I have.\n- Non-integer nearest-neighbour scaling would cause uneven pixels and \"shimmering\" with moving objects,\n- While bilinear scaling would leave things blurry.\n\nSo, what are you to do? the answer: _both, sequentially._\n- Scale up the image with nearest-neighbour, to the next integer resolution past the screen's size\n- Scale down to the desired size with bilinear filtering\n\nThis results in _nearly sharp pixels_ at _any resolution._\n\nAs for just using a larger native resolution with upscaled sprites: Well, except for [a nice shader on top](https://github.com/RNavega/PixelArt-Antialias-Love/tree/master),\nyou sorta wouldn't need a module by then, or you'd be cool enough to make it yourself. /lh\n\n## Usage:\nloading the module:\n```lua\nsqkl = require(\"squirkel\")\nsqkl.load()\n```\nThe base resolution is taken from `conf.lua` by default,\nbut you can also use `sqkl.load(width, height)` or `sqkl.load(size)` (which results in a square aspect ratio)\n\nThe resulting window size is 75% the screen's size, minus black borders.\n\n---\n```lua\nfunction love.draw()\n\tsqkl.start()\n\t-- [everything drawn will be scaled in this range]\n\tsqkl.stop()\n\t-- raw drawing\n\t-- use `left, right, up, down = sqkl.border()`\n\t-- to get the boundaries of the canvas for non-pixel-art ui, for example\nend\n```\n\n---\n```lua\nfunction love.resize(w, h)\n\tsqkl.resize(w, h)\nend\n```\n\nImages and tilesets\n---\n```lua\nsquirrel = {\n\tx = 56, y = 112,\n\tframe = 0 -- (tilesets are 0-indexed)\n}\n\n-- formats image to have sharp pixels\nsquirrel.atlas = sqkl.newImage(\"squirrel.png\")\n\n-- \n-- ([reference image for scaling and sprite count], [sprite width], [sprite height])\nsquirrel.frames = sqkl.newTileset(squirrel.atlas, 16, 16)\n\nlove.graphics.draw(\n\tsquirrel.atlas, squirrel.frames[frame],\n\tsquirrel.x, squirrel.y\n)\n```\nMouse\n---\n```lua\nlocal mx, my = sqkl.mouse.getPosition()\n-- or sqkl.mouse.getX(), sqkl.mouse.getY()\n\nlove.graphics.circle(\n\t\"fill\", mx, my, 2\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthego-dev%2Fsquirkel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthego-dev%2Fsquirkel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthego-dev%2Fsquirkel/lists"}