Hello All:)
I have a simple question…
In my game I use Slick for graphic and Phys2d for physic simulation…
In my code part responsible for physic (Phys2d) i have code like this to create my polygon body:
static Vector2f[] nonConvexPoly = {new Vector2f(-60,-70), new Vector2f(20,-100), new Vector2f(10,0), new Vector2f(20,10), new Vector2f(-20,10), new Vector2f(-10,0)};
polygon = new Polygon(nonConvexPoly); //Phys2d polygon
nonConvexBody = new Body("poly", polygon, 30.0f);
nonConvexBody.setPosition(350, 100.0f);
world.add(nonConvexBody)
In my code part responsible for graphic (Slick) I have code like this :
slick_polygon= new Polygon(); // Slick polygon
for (int i=0;i<nonConvexPoly.length;i++)
{
slick_polygon.addPoint(nonConvexPoly[i].getX(), nonConvexPoly[i].getY());
}
next I render(Slick) this polygon with my texture:
g.texture(slick_polygon, SlickMyGame.my_texture,1.0f,1.0f, true);
In effect, I have “nonConvexPoly” shaped Slick texture and independent Phys2d Body :
How I can “glue” my Slick texture to Phys2d “nonConvexBody” ? and render this together ?