Created
July 15, 2011 01:06
-
-
Save zfogg/1083832 to your computer and use it in GitHub Desktop.
Framing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<Body> CreateFraming(World world, int width) | |
{ | |
List<Body> bodyList = new List<Body>(); | |
float x = WindowSize.X; | |
float y = WindowSize.Y; | |
for (float i = 0f; i <= x; i += x) | |
{ | |
for (float j = 0f; j <= y; j += y) | |
{ | |
Body newBody = BodyFactory.CreateRectangle(world, | |
i == 0 ? x : width, | |
i == 0 ? width : y, | |
1f); | |
Vector2 position = new Vector2( | |
i == 0 ? x / 2 : (i + (j == 0 ? width / 2 : -i + (-width / 2))), | |
j == 0 ? (i == 0 ? -width / 2 : y / 2) : (i == 0 ? j + width / 2 : j / 2)); | |
newBody.Position = position; | |
bodyList.Add(newBody); | |
} | |
} | |
return bodyList; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment