{"id":13529237,"url":"https://github.com/earlygrey/shapedrawer","last_synced_at":"2025-04-01T15:30:41.879Z","repository":{"id":36656147,"uuid":"201244864","full_name":"earlygrey/shapedrawer","owner":"earlygrey","description":"A library for libGDX that draws simple shapes using a batch.","archived":false,"fork":false,"pushed_at":"2024-10-20T14:33:12.000Z","size":301,"stargazers_count":185,"open_issues_count":9,"forks_count":32,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-02T15:36:33.417Z","etag":null,"topics":["cross-platform","drawing","game","java","libgdx","shape","shape-drawer","shapes"],"latest_commit_sha":null,"homepage":"","language":"Java","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/earlygrey.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","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":"2019-08-08T11:33:24.000Z","updated_at":"2024-10-20T14:33:16.000Z","dependencies_parsed_at":"2024-01-03T03:54:36.703Z","dependency_job_id":"53693d59-7ed0-4b10-a45b-666e2e1732a7","html_url":"https://github.com/earlygrey/shapedrawer","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earlygrey%2Fshapedrawer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earlygrey%2Fshapedrawer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earlygrey%2Fshapedrawer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earlygrey%2Fshapedrawer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/earlygrey","download_url":"https://codeload.github.com/earlygrey/shapedrawer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246662241,"owners_count":20813714,"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":["cross-platform","drawing","game","java","libgdx","shape","shape-drawer","shapes"],"created_at":"2024-08-01T07:00:34.626Z","updated_at":"2025-04-01T15:30:41.469Z","avatar_url":"https://github.com/earlygrey.png","language":"Java","readme":"# Shape Drawer\n\n[![](https://jitpack.io/v/earlygrey/shapedrawer.svg)](https://jitpack.io/#space.earlygrey/shapedrawer)\n\n---\n\nA library for [libGDX](https://github.com/libgdx/libgdx), an open-source game development application framework written in java.\n\nDraws simple shapes like libGDX's [ShapeRenderer](https://javadoc.io/static/com.badlogicgames.gdx/gdx/1.11.0/com/badlogic/gdx/graphics/glutils/ShapeRenderer.html) does, but uses a Batch to perform the drawing. This means it can be used in between `Batch#begin()` and `Batch#end()` without needing to flush the Batch.\n\nComes with overloaded methods to draw lines, paths, ellipses, regular polygons and rectangles.\n\nJust needs to be provided with a Batch and a TextureRegion. However, note that if you want to draw filled shapes, it is more efficient to use a batch that implements [PolygonBatch](https://javadoc.io/static/com.badlogicgames.gdx/gdx/1.11.0/com/badlogic/gdx/graphics/g2d/PolygonBatch.html) (eg a [PolygonSpriteBatch](https://javadoc.io/static/com.badlogicgames.gdx/gdx/1.11.0/com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html)) instead of a Batch that does not (eg a [SpriteBatch](https://javadoc.io/static/com.badlogicgames.gdx/gdx/1.11.0/com/badlogic/gdx/graphics/g2d/SpriteBatch.html)).\n\n![Gif didn't load - see wiki for images!](https://raw.githubusercontent.com/wiki/earlygrey/shapedrawer/images/readme_demo.gif)\n\n---\n\n## Including in Project\n\nTo use this in your gradle project, add the version number and jitpack repository information to your root build.gradle file:\n \n```groovy\nallprojects {\n    ext {\n    \t...\n        shapedrawerVersion = '2.5.0'\n    }\n    repositories {\n\t...\n\tmaven { url 'https://jitpack.io' }\n    }\n}\n```\nAnd  in your core project add the dependency:\n```groovy\ndependencies {\n    implementation \"space.earlygrey:shapedrawer:$shapedrawerVersion\"\n}\n```\n\nFor HTML5/GWT support, add the dependency to the html project:\n\n```groovy\nproject(\":html\") {\n    apply plugin: \"gwt\"\n    apply plugin: \"war\"\n\n\n    dependencies {\n        ...\n        implementation \"space.earlygrey:shapedrawer:$shapedrawerVersion:sources\"\n    }\n}\n```\n\nAnd add the following line to the GdxDefinition.gwt.xml file in the HTML project:\n```xml\n\u003cinherits name=\"space.earlygrey.shapedrawer\"/\u003e\n```\n\nSee the [jitpack website](https://jitpack.io/#space.earlygrey/shapedrawer) for more info.\n\nAlternatively, if you're using [gdx-liftoff](https://github.com/tommyettinger/gdx-liftoff) to create your project you can find shape drawer under the \"third-party\" tab.\n\n\n## Usage\n\nTo create a ShapeDrawer instance you just need a Batch and a TextureRegion. Typically this is a single white pixel so that you can easily colour it, and is best packed into an atlas with your other textures.\n\nTo instantiate a ShapeDrawer, use:\n\n```java\nShapeDrawer drawer = new ShapeDrawer(batch, region);\n```\n\nAnd to use it, simply call its drawing methods in between `Batch#begin()` and `Batch#end()`. Something like this:\n\n```java\nbatch.begin();\ndrawer.line(0, 0, 100, 100);\nbatch.end();\n```\n\nThat's it!\n\n---\n\nCheck the [wiki](https://github.com/earlygrey/shapedrawer/wiki) for more info, including:\n* [Using Shape Drawer](https://github.com/earlygrey/shapedrawer/wiki/Using-Shape-Drawer)\n* [Shapes](https://github.com/earlygrey/shapedrawer/wiki/Shapes)\n* [Join Types](https://github.com/earlygrey/shapedrawer/wiki/Join-Types)\n* [Pixel Snapping](https://github.com/earlygrey/shapedrawer/wiki/Pixel-Snapping)\n\n\n---\n\nTest application uses the [Commodore 64 UI Skin](https://ray3k.wordpress.com/artwork/commodore-64-ui-skin-for-libgdx/) created by Raymond \"Raeleus\" Buckley under the [CC BY license](https://creativecommons.org/licenses/by/4.0/). [Check out the others!](https://ray3k.wordpress.com/artwork/)\n","funding_links":[],"categories":["Resources"],"sub_categories":["Visual Effects"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearlygrey%2Fshapedrawer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fearlygrey%2Fshapedrawer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearlygrey%2Fshapedrawer/lists"}