GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - openfl/box2d: Haxe port of Box2D, a popular rigid-body 2D physics engine

BranchesTags
Open more actions menu

Latest commit

 

History

82 Commits
82 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
box2D
box2D
 
 
samples/TestBed
samples/TestBed
 
 
scripts
scripts
 
 
.gitignore
.gitignore
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 
haxelib.json
haxelib.json
 
 
hxformat.json
hxformat.json
 
 
include.xml
include.xml
 
 

Repository files navigation

MIT License Haxelib Version

Box2D

The Box2D rigid-body 2D physics engine, ported to Haxe from the Box2DFlash port by Boris the Brave.

The syntax has been updated to follow the standard Haxe convention, for example:

ActionScript

var world:b2World = new b2World (new b2Vec2 (0, 10.0), true);
var worldScale:int = 30;
    
var body:b2BodyDef = new b2BodyDef ();
body.position.Set (250 / worldScale, 200 / worldScale);
body.type = b2Body.b2_dynamicBody;
  	
var circle:b2CircleShape = new b2CircleShape (10 / worldScale);
var fixture:b2FixtureDef = new b2FixtureDef ();
fixture.shape = circle;
  	
player = world.CreateBody (body);
player.CreateFixture (fixture);

The above ActionScript code would be written like this in Haxe:

Haxe

var world = new B2World (new B2Vec2 (0, 10.0), true);
var worldScale = 30;
    
var body = new B2BodyDef ();
body.position.set (250 / worldScale, 200 / worldScale);
body.type = DYNAMIC_BODY;
    
var circle = new B2CircleShape (10 / worldScale);
var fixture = new B2FixtureDef ();
fixture.shape = circle;
    
player = world.createBody (body);
player.createFixture (fixture);

Installation

You can easily install Box2D using haxelib:

haxelib install box2d

To add it to a Lime or OpenFL project, add this to your project file:

<haxelib name="box2d" />

Development Builds

Clone the Box2D repository:

git clone https://github.com/openfl/box2d

Tell haxelib where your development copy of Box2D is installed:

haxelib dev box2d box2d

To return to release builds:

haxelib dev box2d

About

Haxe port of Box2D, a popular rigid-body 2D physics engine

Topics

box2dhaxeopenflphysicsphysics-engine

Resources

Readme
License
Activity
Custom properties

Stars

105 stars

Watchers

8 watching

Forks

32 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.