{"id":18562731,"url":"https://github.com/ruby-processing/jbox2d","last_synced_at":"2025-04-10T03:32:11.288Z","repository":{"id":22709358,"uuid":"26053489","full_name":"ruby-processing/jbox2d","owner":"ruby-processing","description":"Gem wrapper for jbox2d for ruby-processing","archived":false,"fork":false,"pushed_at":"2021-10-04T05:17:51.000Z","size":825,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T15:52:30.634Z","etag":null,"topics":["box2d","gem","physics","processing","ruby"],"latest_commit_sha":null,"homepage":"https://ruby-processing.github.io/jbox2d","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruby-processing.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-01T14:58:47.000Z","updated_at":"2021-10-04T05:17:54.000Z","dependencies_parsed_at":"2022-08-21T00:50:48.369Z","dependency_job_id":null,"html_url":"https://github.com/ruby-processing/jbox2d","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-processing%2Fjbox2d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-processing%2Fjbox2d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-processing%2Fjbox2d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby-processing%2Fjbox2d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruby-processing","download_url":"https://codeload.github.com/ruby-processing/jbox2d/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248151144,"owners_count":21056030,"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","gem","physics","processing","ruby"],"created_at":"2024-11-06T22:10:41.741Z","updated_at":"2025-04-10T03:32:06.275Z","avatar_url":"https://github.com/ruby-processing.png","language":"Java","readme":"### Using JBox2D in ruby-processing\n\nHere we demonstrate how to use JBox2D library as a rubygem. This approach could be an exemplar of how to use other processing/java libraries with both ruby-processing and JRubyArt (now using a maven build).\n![liquidy](http://4.bp.blogspot.com/-dwnDQZVugwo/VFXrDxGOy4I/AAAAAAAAEgo/irsZxW_WLOA/s400/liquidy.png)\n\n![Travis CI](https://travis-ci.org/ruby-processing/jbox2d.svg)\n[![Gem Version](https://badge.fury.io/rb/pbox2d.svg)](http://badge.fury.io/rb/pbox2d)\n\nCI Build can only pass when processing version is available from maven central.\n\n### Web Links\n\n[JBox2D Home][]\n\n[JBox2D on github][]\n\n[Box2D for processing on github][]\n\nDownloads including examples [zip][]\n[Wiki][]\n\n### Licensing\n\nDaniel Murphy is currently claiming ownership of jbox2d (although surely a derived work):-\n\nCopyright (c) 2014 Daniel Murphy\n\nDan Shiffman wrote the original PBox2D for processing (on which this implementation is based)\n\nCopyright (c) 2014 Daniel Shiffman\n\nThis gem was created by Martin Prout\n\nCopyright (c) 2015/19 Martin Prout\n\n### To compile\n\nTo compile the gem follow the instructions for [JRubyArt][], but also available as a ruby gem:-\n```bash\njruby -S gem install box2d\n```\nLike really easy, but if you have to use rvm or rbenv you will also know what to do (but then you might find this all a bit difficult to understand, and wonder where the tests are, believe me you should throw away those crutches).\n\n### To use\n\nYou need to `require 'pbox2d'` in the the usual way (to require a gem). Now you should create a new instance of Box2D. However as in this included [example][] you may also need to `include ContactListener` interface (by [jruby magic][], including the interface as a module implements the java interface) if you wish to create your own jbox2d listener.\n```ruby\n# Since version 0.6.0, use the WorldBuilder factory module (avoids boiler-plate code)\n# Only app is required there, default gravity is [0, -10], defaults to warm start\n@box2d = WorldBuilder.build(app: self, gravity: [0, -20])\n```\nThat's about all you need to know, to use the box2d instance to access the jbox2d physics world. Since version 0.6.0 runtime options `scale`, `gravity`, `warm_start`, and `continous_physics` options can be set using the keyword args see above (if unset sensible defaults are used). The `step_options` are set in the same way, but default options are often suitable. NB: You do not need to call `box2d.step` in the draw loop, to update the physics world, because we do that for you under the hood (using java reflection arghhh.....).\nThe other thing you should know is there is a mismatch between the physics world and the sketch world (processing got it wrong to my view, down is up), further the scaling is different. This is why you need to keep translating from one worlds (coordinates system) to the others coordinates (system), Dan Shiffman explains it in his [Nature of Code book][], Chapter 5 physics libraries, not that I've read it, I prefer to read code or [Sandi Metz][]. The really brave or adventurous should probably get [this book].\n\n[JBox2D Home]:http://www.jbox2d.org/\n[JBox2D on github]:https://github.com/jbox2d/jbox2d\n[Box2D for processing on github]:https://github.com/shiffman/Box2D-for-Processing\n[JRubyArt]:https://github.com/ruby-processing/JRubyArt\n[example]:https://github.com/ruby-processing/jbox2d/blob/master/examples/test_contact/lib/custom_listener.rb\n[jruby magic]:https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby\n[Nature of Code book]:http://natureofcode.com/\n[Sandi Metz]:http://www.poodr.com/\n[this book]:http://www.crcpress.com/product/isbn/9781466565760\n[zip]:https://github.com/ruby-processing/jbox2d/archive/master.zip\n[Wiki]:https://github.com/ruby-processing/jbox2d/wiki\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby-processing%2Fjbox2d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruby-processing%2Fjbox2d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby-processing%2Fjbox2d/lists"}