Skip to content

Commit

Permalink
Added userData getter for simplification
Browse files Browse the repository at this point in the history
Working on libgdx#40
  • Loading branch information
rinold committed Feb 6, 2015
1 parent a152fce commit da35f6d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/box2dLight/LightData.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package box2dLight;

import com.badlogic.gdx.physics.box2d.Fixture;

public class LightData {

public Object userData = null;
Expand Down Expand Up @@ -32,4 +34,13 @@ public float getLimit(float distance, float lightHeight, float lightRange) {
return l;
}

public static Object getUserData(Fixture fixture) {
Object data = fixture.getUserData();
if (data instanceof LightData) {
return ((LightData)data).userData;
} else {
return data;
}
}

}

0 comments on commit da35f6d

Please sign in to comment.