A stealth-based 2D platformer where you don't have to kill anyone unless you want to. https://www.semicolin.games
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
918 B

  1. using Microsoft.Xna.Framework;
  2. using Microsoft.Xna.Framework.Graphics;
  3. // All extension methods on built-in types (of C# or MonoGame) go in this file.
  4. // Methods are ordered alphabetically by type name.
  5. namespace SemiColinGames {
  6. static class ExtensionMethods {
  7. // Point
  8. public static void Deconstruct(this Point point, out int x, out int y) =>
  9. (x, y) = (point.X, point.Y);
  10. // SpriteFont
  11. public static Vector2 CenteredOn(this SpriteFont font, string text, Point position) {
  12. Vector2 size = font.MeasureString(text);
  13. return new Vector2(position.X - (int) size.X / 2, position.Y - (int) size.Y / 2);
  14. }
  15. // Vector2
  16. public static Vector2 Rotate(this Vector2 point, float angle) {
  17. float cos = FMath.Cos(angle);
  18. float sin = FMath.Sin(angle);
  19. return new Vector2(
  20. point.X * cos - point.Y * sin,
  21. point.Y * cos + point.X * sin);
  22. }
  23. }
  24. }