{"id":17011465,"url":"https://github.com/gustavostuff/tabox2d","last_synced_at":"2025-03-22T13:22:29.690Z","repository":{"id":101643796,"uuid":"47520117","full_name":"gustavostuff/tabox2d","owner":"gustavostuff","description":"Java Wrapper for Box2D in LibGDX","archived":false,"fork":false,"pushed_at":"2019-10-20T20:43:29.000Z","size":99,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-27T12:49:16.887Z","etag":null,"topics":["box2d","gamedev","java","libgdx"],"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/gustavostuff.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}},"created_at":"2015-12-07T00:33:38.000Z","updated_at":"2019-10-20T20:43:31.000Z","dependencies_parsed_at":"2023-06-06T23:00:39.954Z","dependency_job_id":null,"html_url":"https://github.com/gustavostuff/tabox2d","commit_stats":null,"previous_names":["gustavostuff/tabox2d"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gustavostuff%2Ftabox2d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gustavostuff%2Ftabox2d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gustavostuff%2Ftabox2d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gustavostuff%2Ftabox2d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gustavostuff","download_url":"https://codeload.github.com/gustavostuff/tabox2d/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244960214,"owners_count":20538767,"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":["box2d","gamedev","java","libgdx"],"created_at":"2024-10-14T06:07:11.561Z","updated_at":"2025-03-22T13:22:29.649Z","avatar_url":"https://github.com/gustavostuff.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![log-tabox2d.png](https://i.postimg.cc/PfZxPBXs/log-tabox2d.png)](https://postimg.cc/HjYHNv8B)\n\nInspired by [Lope2D](https://love2d.org/wiki/Lope2D) and [FlxBox2D](https://github.com/flixel-gdx/flixel-gdx-box2d) Tabox2D was born, a simple layer class to ease body-texture management in Box2D (LibGDX).\n\n[![License](http://img.shields.io/:license-MIT-blue.svg)](http://doge.mit-license.org)\n\nHere's an example of an application using Tabox2D:\n\n```java\npublic class Box2DTest extends ApplicationAdapter {\n    Tabox2D t;\n    float w ,h;\n    float rad;\n    @Override\n    public void create () {\n        w = Gdx.graphics.getWidth();\n        h = Gdx.graphics.getHeight();\n        t = Tabox2D.getInstance();\n        t.setFilter(\"linear\", \"linear\");// Soft textures.\n        //t.debug();// This uses Box2DDebugRenderer, shows AABB and mass centres.\n        t.setMeterSize(64);// Default = 100.\n        t.setRawForces(false);// If false (default value) forces are multiplied by the mass.\n\n        // Walls:\n        t.newBox(\"s\", 0, 0, w, 30).texture(\"dot.png\");// Down.\n        t.newBox(\"s\", 0, h - 30, w, 30).texture(\"dot.png\");// Up.\n        t.newBox(\"s\", 0, 30, 30, h - 60).texture(\"dot.png\");// Left.\n        t.newBox(\"s\", w - 30, 30, 30, h - 60).texture(\"dot.png\");// Right.\n\n        rad = w / 16;\n        // Regular bodies:\n        t.newSquare(\"d\", 100, 100, rad).texture(\"square.png\").rotate(45);// 1/8 turn.\n        t.newPentagon(\"d\", 100, 200, rad).texture(\"pentagon_hi_res.png\").density(0.1f);// Light.\n        t.newHexagon(\"d\", 100, 300, rad).texture(\"hexagon.png\").friction(0);// Like ice.\n        t.newHeptagon(\"d\", 100, 400, rad).texture(\"heptagon.png\").restitution(0.9f);// Bouncy.\n        t.newOctagon(\"d\", 200, 200, rad).texture(\"octagon.png\");\n        t.newBall(\"d\", 200, 300, rad).texture(\"ball_low_res.png\");\n        t.newTriangle(\"d\", 200, 400, rad).texture(\"triangle.png\").forceY(-10);// Likes the floor.\n\n        // Irregular:\n        float[] pts1 = {160, 50, 220, 50, 240, 70, 220, 90, 160, 90, 140, 70},\n                pts2 = {340, 60, 360, 60, 400, 90, 370, 120, 330, 130, 320, 70};\n        t.newPoly(\"d\", pts1).texture(\"irr1.png\");\n        t.newPoly(\"d\", pts2).texture(\"irr2.png\");\n\n        // Compound bodies (Tabox2D.Tabody)\n\n        Tabody bucket = t.combine(\"d\",\n                t.newBox(\"d\", 250, 200, 30, 150),\n                t.newBox(\"d\", 280, 200, 90, 30),\n                t.newBox(\"d\", 370, 200, 30, 150)\n        ).texture(\"bucket.png\");\n\n        Tabody siameseBucket = t.combine(\"d\",\n                t.newBox(\"d\", 420, 200, 30, 150),\n                t.newBox(\"d\", 450, 200, 90, 30),\n                t.newBox(\"d\", 540, 200, 30, 150),\n                t.newBall(\"d\", 570, 300, 20)\n        ).texture(\"siameseBucket.png\");\n\n        Tabody cross = t.combine(\"d\",\n                t.newBox(\"d\", 510, 20, 20, 40),\n                t.newBox(\"d\", 530, 0,  40, 80),\n                t.newBox(\"d\", 570, 20, 20, 40)\n        ).texture(\"cross.png\");\n\n        //t.destroy(bucket);// Destroys a Tabody.\n    }\n\n    @Override\n    public void render() {\n        Gdx.gl.glClearColor(0, 0, 0, 1);\n        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);\n        t.update();\n        t.draw();\n\n        // Move bodies:\n        if(Gdx.input.justTouched()) {\n            for(Tabox2D.Tabody b : t.getTabodies()) {\n                b.impulseY(5);\n            }\n        }\n    }\n\n    @Override\n    public void dispose() {\n        t.dispose();\n    }\n}\n```\n\nThe result would be something like:\n\n[![Captura-de-pantalla-2019-10-20-11-43-02.png](https://i.postimg.cc/vmLCFNPF/Captura-de-pantalla-2019-10-20-11-43-02.png)](https://postimg.cc/Lq5xjNKN)\n\n***\n\nTabox2D does this:\n\n* Creates multi-shaped bodies in one line!\n* Makes regular/irregluar polygons in a simple way\n* Attaches textures to bodies in terms of position, scale and rotation\n* Uses the Tabody entity, easier to manage than a normal Body\n* Applies linear impulses through Tabody class\n* Tabox2D.newBox() takes X and Y as the left-bottom corner, then full W and H\n\nit doesn't:\n\n* Cover the joints part\n* Cover other Box2D API (yet)\n\n## Notes\n\n* This has only been tested on Desktop libGDX projets, not Android, iOS, or anything else \n* No Maven/Gradle artifact for this yet (help needed, I'm not a Java Dev)\n\nThis is still a work in progress, thanks for your feedback!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgustavostuff%2Ftabox2d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgustavostuff%2Ftabox2d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgustavostuff%2Ftabox2d/lists"}