Skip to content

Instantly share code, notes, and snippets.

@23limes
23limes / Box2D_IE9_10_shim.js
Created May 24, 2012 02:12
Box2D.js __defineGetter__ shim/fix for IE9, IE10, and Windows 8
/*
Emulate legacy getter/setter API using ES5 APIs.
Since __defineGetter__ and __defineSetter__ are not supported any longer by IE9 or 10 or Windows 8, and Box2D for javascript v2.1a still uses them, this shim is required to run Box2D in those environments.
This is taken directly from Allen Wirfs-Brock's blog at:
http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx
I am using this with the ImpactJS game engine. To use in that situation, just paste the code below into your
lib\plugins\box2d\lib.js file inside the module definition, right after the line: b2 = { SCALE: 0.1 };