diff --git a/C#_Mono/PlanetSimulation/.vs/PlanetSimulation/v14/.suo b/C#_Mono/PlanetSimulation/.vs/PlanetSimulation/v14/.suo
new file mode 100644
index 0000000..3fbaf39
Binary files /dev/null and b/C#_Mono/PlanetSimulation/.vs/PlanetSimulation/v14/.suo differ
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation.sln b/C#_Mono/PlanetSimulation/PlanetSimulation.sln
new file mode 100644
index 0000000..026b0e8
--- /dev/null
+++ b/C#_Mono/PlanetSimulation/PlanetSimulation.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlanetSimulation", "PlanetSimulation\PlanetSimulation.csproj", "{2877F3FC-9913-4CA7-91BC-C358597CCCB9}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2877F3FC-9913-4CA7-91BC-C358597CCCB9}.Debug|x86.ActiveCfg = Debug|x86
+ {2877F3FC-9913-4CA7-91BC-C358597CCCB9}.Debug|x86.Build.0 = Debug|x86
+ {2877F3FC-9913-4CA7-91BC-C358597CCCB9}.Release|x86.ActiveCfg = Release|x86
+ {2877F3FC-9913-4CA7-91BC-C358597CCCB9}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = PlanetSimulation\PlanetSimulation.csproj
+ EndGlobalSection
+EndGlobal
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/Camera2D.cs b/C#_Mono/PlanetSimulation/PlanetSimulation/Camera2D.cs
new file mode 100644
index 0000000..2e9cb7d
--- /dev/null
+++ b/C#_Mono/PlanetSimulation/PlanetSimulation/Camera2D.cs
@@ -0,0 +1,56 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace PlanetSimulation
+{
+ public class Camera2d
+ {
+ protected float _zoom; // Camera Zoom
+ public Matrix _transform; // Matrix Transform
+ public Vector2 _pos; // Camera Position
+ protected float _rotation; // Camera Rotation
+
+ public Camera2d()
+ {
+ _zoom = 1.0f;
+ _rotation = 0.0f;
+ _pos = Vector2.Zero;
+ }
+ // Sets and gets zoom
+ public float Zoom
+ {
+ get { return _zoom; }
+ set { _zoom = value; if (_zoom < 0.1f) _zoom = 0.1f; } // Negative zoom will flip image
+ }
+
+ public float Rotation
+ {
+ get {return _rotation; }
+ set { _rotation = value; }
+ }
+ // Auxiliary function to move the camera
+ public void Move(Vector2 amount)
+ {
+ _pos += amount;
+ }
+ // Get set position
+ public Vector2 Pos
+ {
+ get{ return _pos; }
+ set{ _pos = value; }
+ }
+
+ public Matrix get_transformation(GraphicsDevice graphicsDevice)
+ {
+ _transform = // Thanks to o KB o for this solution
+ Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
+ Matrix.CreateRotationZ(Rotation) *
+ Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
+ Matrix.CreateTranslation(new Vector3(graphicsDevice.Viewport.Width * 0.5f, graphicsDevice.Viewport.Height * 0.5f, 0));
+ return _transform;
+ }
+
+ }
+}
+
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/Game1.cs b/C#_Mono/PlanetSimulation/PlanetSimulation/Game1.cs
new file mode 100644
index 0000000..aabf6f3
--- /dev/null
+++ b/C#_Mono/PlanetSimulation/PlanetSimulation/Game1.cs
@@ -0,0 +1,110 @@
+#region Using Statements
+using System;
+
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Storage;
+using Microsoft.Xna.Framework.Input;
+using C3.XNA;
+
+#endregion
+
+namespace PlanetSimulation
+{
+ ///
+ /// This is the main type for your game
+ ///
+ public class Game1 : Game
+ {
+ Camera2d cam;
+
+ PlanetManager pManager;
+
+ GraphicsDeviceManager graphics;
+ SpriteBatch spriteBatch;
+
+ public Game1 ()
+ {
+ graphics = new GraphicsDeviceManager (this);
+ Content.RootDirectory = "Content";
+ graphics.IsFullScreen = true;
+ //graphics.ApplyChanges();
+ }
+
+ ///
+ /// Allows the game to perform any initialization it needs to before starting to run.
+ /// This is where it can query for any required services and load any non-graphic
+ /// related content. Calling base.Initialize will enumerate through any components
+ /// and initialize them as well.
+ ///
+ protected override void Initialize ()
+ {
+ // TODO: Add your initialization logic here
+
+ pManager = new PlanetManager();
+ base.Initialize ();
+ cam = new Camera2d();
+
+ }
+
+ ///
+ /// LoadContent will be called once per game and is the place to load
+ /// all of your content.
+ ///
+ protected override void LoadContent ()
+ {
+ // Create a new SpriteBatch, which can be used to draw textures.
+ spriteBatch = new SpriteBatch (GraphicsDevice);
+
+ //TODO: use this.Content to load your game content here
+ }
+
+ ///
+ /// Allows the game to run logic such as updating the world,
+ /// checking for collisions, gathering input, and playing audio.
+ ///
+ /// Provides a snapshot of timing values.
+ protected override void Update (GameTime gameTime)
+ {
+ // For Mobile devices, this logic will close the Game when the Back button is pressed
+ if (GamePad.GetState (PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) {
+ Exit ();
+ }
+
+ if(Keyboard.GetState().IsKeyDown(Keys.OemMinus))
+ cam.Zoom -= 0.025f;
+ if(Keyboard.GetState().IsKeyDown(Keys.OemPlus))
+ cam.Zoom += 0.025f;
+
+ if(Keyboard.GetState().IsKeyDown(Keys.Down))
+ cam.Pos = Vector2.Add(cam.Pos, new Vector2(0,cam.Zoom * 20));
+ if(Keyboard.GetState().IsKeyDown(Keys.Up))
+ cam.Pos = Vector2.Add(cam.Pos, new Vector2(0,-cam.Zoom * 20));
+ if(Keyboard.GetState().IsKeyDown(Keys.Right))
+ cam.Pos = Vector2.Add(cam.Pos, new Vector2(cam.Zoom * 20 ,0));
+ if(Keyboard.GetState().IsKeyDown(Keys.Left))
+ cam.Pos = Vector2.Add(cam.Pos, new Vector2(-cam.Zoom * 20 ,0));
+
+ pManager.Update(gameTime);
+ // TODO: Add your update logic here
+ base.Update (gameTime);
+ }
+
+ ///
+ /// This is called when the game should draw itself.
+ ///
+ /// Provides a snapshot of timing values.
+ protected override void Draw (GameTime gameTime)
+ {
+ graphics.GraphicsDevice.Clear (Color.Black);
+ //TODO: Add your drawing code here
+ spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null,
+ cam.get_transformation(GraphicsDevice /*Send the variable that has your graphic device here*/));
+
+ pManager.Draw(spriteBatch);
+ spriteBatch.End();
+ base.Draw (gameTime);
+ }
+ }
+}
+
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/Icon.png b/C#_Mono/PlanetSimulation/PlanetSimulation/Icon.png
new file mode 100644
index 0000000..c57cf36
Binary files /dev/null and b/C#_Mono/PlanetSimulation/PlanetSimulation/Icon.png differ
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/Planet.cs b/C#_Mono/PlanetSimulation/PlanetSimulation/Planet.cs
new file mode 100644
index 0000000..7396ce7
--- /dev/null
+++ b/C#_Mono/PlanetSimulation/PlanetSimulation/Planet.cs
@@ -0,0 +1,136 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using C3.XNA;
+using System.Collections.Generic;
+
+namespace PlanetSimulation
+{
+ public class Planet
+ {
+ private long mass; public long Mass {
+ get{ return mass;}
+ set{ mass = value;}
+ }
+ private long radius; public long Radius {
+ get{ return radius;}
+ set{ radius = value;}
+ }
+ private Vector2 center; public Vector2 Center { get{return center;}}
+
+ private List forces; public List Forces {
+ get { return forces; }
+ set{ forces = value;}
+ }
+ private Vector2 acceleration;
+ private Vector2 velocity; public Vector2 Velocity{ get{ return velocity;}}
+
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// Center of the planet
+ ///
+ ///
+ /// Mass of the Planet
+ ///
+ ///
+ /// Radius of the planet
+ ///
+ public Planet (Vector2 center, long mass, long radius)
+ {
+ this.velocity = Vector2.Zero;
+
+ this.mass = mass;
+ this.radius = radius;
+ this.center = center;
+ this.forces = new List();
+ this.acceleration = Vector2.Zero;
+ }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// Center of the planet
+ ///
+ ///
+ /// Mass of the planet
+ ///
+ ///
+ /// Radius of the planet
+ ///
+ ///
+ /// Velocity of the planet
+ ///
+ public Planet (Vector2 center, long mass, long radius, Vector2 velocity)
+ {
+ this.velocity = velocity;
+
+ this.mass = mass;
+ this.radius = radius;
+ this.center = center;
+ this.forces = new List();
+ this.acceleration = Vector2.Zero;
+ }
+
+ public void Update (GameTime gameTime)
+ {
+ calcAcceleration();
+ calcVelocity(gameTime);
+ move(gameTime);
+ }
+ public void Draw(SpriteBatch spriteBatch)
+ {
+ spriteBatch.DrawCircle(center, radius, (int)radius, Color.Red);
+ /*foreach (var f in forces) {
+ spriteBatch.DrawLine(center, Vector2.Add(center, Vector2.Multiply(Vector2.Normalize(f), 100)), Color.Green);
+ //spriteBatch.DrawLine(center, Vector2.Add(center, f), Color.Green);
+ }*/
+ forces.Clear();
+ //Draw Acceleration
+ spriteBatch.DrawLine(center, Vector2.Add(center, Vector2.Multiply(acceleration, 1)), Color.Orange);
+ //Draw Velocity
+ spriteBatch.DrawLine(center, Vector2.Add(center, velocity), Color.White);
+ }
+
+ ///
+ /// Moves the Planet according to it's velocity.
+ ///
+ ///
+ /// GameTime element from MonoGame/XNA
+ ///
+ private void move (GameTime gameTime)
+ {
+ float elapsedSeconds = (float)gameTime.ElapsedGameTime.Milliseconds / 1000;
+ center = Vector2.Add(center, Vector2.Multiply(velocity, elapsedSeconds));
+ }
+ ///
+ /// Updates the Velocity of the Planet by using the acceleration.
+ ///
+ ///
+ /// GameTime element from MonoGame/XNA
+ ///
+ private void calcVelocity (GameTime gameTime)
+ {
+ float elapsedSeconds = (float)gameTime.ElapsedGameTime.Milliseconds / 1000;
+
+ velocity = Vector2.Add(velocity, Vector2.Multiply(acceleration, elapsedSeconds));
+ }
+ ///
+ /// Calculates the acceleration out of all occouring forces which are saved in the List forces which consists of 2D Vectors.
+ ///
+ private void calcAcceleration()
+ {
+ Vector2 f = Vector2.Zero;
+ foreach(Vector2 v in forces)
+ {
+ f = Vector2.Add(f,v);
+ }
+
+ //F = m x a <=> F/m = a
+ acceleration = Vector2.Divide(f,mass);
+ }
+ }
+}
+
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/PlanetManager.cs b/C#_Mono/PlanetSimulation/PlanetSimulation/PlanetManager.cs
new file mode 100644
index 0000000..ed1c74b
--- /dev/null
+++ b/C#_Mono/PlanetSimulation/PlanetSimulation/PlanetManager.cs
@@ -0,0 +1,108 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace PlanetSimulation
+{
+ public class PlanetManager
+ {
+ public const float G = 0.02f;
+ private Rectangle boundsOfUniverse;
+ List planets;
+ public PlanetManager ()
+ {
+ int size = 5000;
+ boundsOfUniverse = new Rectangle(-size,-size, 2*size, 2*size);
+
+
+ Random random = new Random();
+
+ planets = new List();
+
+ //planets.Add(new Planet(Vector2.Zero, 30000, 100, new Vector2(0,0)));
+ //planets.Add(new Planet(new Vector2(0,300), 1000, 20, new Vector2(20,0)));
+ //p.Add(new Planet(new Vector2(0,500), 20, 5, new Vector2(75,0)));
+ for (int i = 0; i < 200; i++) {
+
+ int radius = random.Next(1,40);
+ planets.Add(new Planet(new Vector2(random.Next(boundsOfUniverse.X, boundsOfUniverse.Width + boundsOfUniverse.X),
+ random.Next(boundsOfUniverse.Y, boundsOfUniverse.Height + boundsOfUniverse.Y))
+ ,(radius*radius)*6, radius
+ ,new Vector2(random.Next(-50,50),random.Next(-50,50))));
+ }
+ }
+ public void Update (GameTime gameTime)
+ {
+ for (int i = 0; i < (planets.Count -1); i++) {
+ for (int j = i+1; j < planets.Count; j++) {
+ calcForce (planets[i], planets[j]);
+ checkANDcalcCollision(planets[i], planets[j]);
+ }
+ }
+ foreach (Planet planet in planets) {
+ planet.Update(gameTime);
+ }
+ }
+ public void Draw(SpriteBatch spriteBatch)
+ {
+ foreach(Planet planet in planets)
+ {
+ planet.Draw(spriteBatch);
+ }
+ }
+
+ ///
+ /// Checks if a Collision occours between the two planets occours and
+ /// if they collide it calculates the Impact of the collision and the resulting force.
+ ///
+ ///
+ /// first planet
+ ///
+ ///
+ /// second plane
+ ///
+ private void checkANDcalcCollision (Planet p, Planet q)
+ {
+ var dx = p.Center.X - q.Center.X;
+ var dy = p.Center.Y - q.Center.Y;
+ var dist = p.Radius + q.Radius;
+
+ if (dx * dx + dy * dy <= dist * dist) {
+ //The planets Crash...
+
+ Vector2 v = Vector2.Add(Vector2.Multiply(p.Velocity,((float)p.Mass/(p.Mass + q.Mass))), Vector2.Multiply(q.Velocity,((float)q.Mass/(q.Mass + p.Mass))));
+ Vector2 center = (p.Mass > q.Mass)?p.Center:q.Center;
+ long r = (long)Math.Sqrt((p.Radius*p.Radius + q.Radius* q.Radius));
+
+ Planet _tmp = new Planet(center, p.Mass + q.Mass, r, v);
+ planets.Add(_tmp);
+ planets.Remove(p);
+ planets.Remove(q);
+ //Insert What happens when the planets crash here
+ }
+ }
+ ///
+/// Calculates the force of gravity which occours between the two planets
+/// and adds it to the List of Forces of each Planet
+///
+///
+/// first planet.
+///
+///
+/// second planet.
+///
+ private void calcForce(Planet p, Planet q)
+ {
+ //http://goo.gl/Yt6vdj Newtons law of Gravity
+ Vector2 direction = Vector2.Add(-p.Center,q.Center);
+ float F = G* ((p.Mass * q.Mass)/(Vector2.Distance(p.Center,q.Center)));
+
+ Vector2 Force = Vector2.Multiply(Vector2.Normalize(direction), F);
+ p.Forces.Add(Force);
+ q.Forces.Add(Vector2.Multiply(Force, -1f));
+ }
+
+ }
+}
+
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/PlanetSimulation.csproj b/C#_Mono/PlanetSimulation/PlanetSimulation/PlanetSimulation.csproj
new file mode 100644
index 0000000..64f73c8
--- /dev/null
+++ b/C#_Mono/PlanetSimulation/PlanetSimulation/PlanetSimulation.csproj
@@ -0,0 +1,57 @@
+
+
+
+ Debug
+ x86
+ 10.0.0
+ 2.0
+ {2877F3FC-9913-4CA7-91BC-C358597CCCB9}
+ {9B831FEF-F496-498F-9FE8-180DA5CB4258};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ Exe
+ PlanetSimulation
+ Linux
+ PlanetSimulation
+
+
+ true
+ full
+ false
+ bin\Debug
+ DEBUG;
+ prompt
+ 4
+ x86
+ false
+
+
+ none
+ true
+ bin\Release
+ prompt
+ 4
+ x86
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/Primitives2D.cs b/C#_Mono/PlanetSimulation/PlanetSimulation/Primitives2D.cs
new file mode 100644
index 0000000..e647ae0
--- /dev/null
+++ b/C#_Mono/PlanetSimulation/PlanetSimulation/Primitives2D.cs
@@ -0,0 +1,539 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace C3.XNA
+{
+ ///
+ ///
+ public static class Primitives2D
+ {
+
+
+ #region Private Members
+
+ private static readonly Dictionary> circleCache = new Dictionary>();
+ //private static readonly Dictionary> arcCache = new Dictionary>();
+ private static Texture2D pixel;
+
+ #endregion
+
+
+ #region Private Methods
+
+ private static void CreateThePixel(SpriteBatch spriteBatch)
+ {
+ pixel = new Texture2D(spriteBatch.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
+ pixel.SetData(new[]{ Color.White });
+ }
+
+
+ ///
+ /// Draws a list of connecting points
+ ///
+ /// The destination drawing surface
+ /// /// Where to position the points
+ /// The points to connect with lines
+ /// The color to use
+ /// The thickness of the lines
+ private static void DrawPoints(SpriteBatch spriteBatch, Vector2 position, List points, Color color, float thickness)
+ {
+ if (points.Count < 2)
+ return;
+
+ for (int i = 1; i < points.Count; i++)
+ {
+ DrawLine(spriteBatch, points[i - 1] + position, points[i] + position, color, thickness);
+ }
+ }
+
+
+ ///
+ /// Creates a list of vectors that represents a circle
+ ///
+ /// The radius of the circle
+ /// The number of sides to generate
+ /// A list of vectors that, if connected, will create a circle
+ private static List CreateCircle(double radius, int sides)
+ {
+ // Look for a cached version of this circle
+ String circleKey = radius + "x" + sides;
+ if (circleCache.ContainsKey(circleKey))
+ {
+ return circleCache[circleKey];
+ }
+
+ List vectors = new List();
+
+ const double max = 2.0 * Math.PI;
+ double step = max / sides;
+
+ for (double theta = 0.0; theta < max; theta += step)
+ {
+ vectors.Add(new Vector2((float)(radius * Math.Cos(theta)), (float)(radius * Math.Sin(theta))));
+ }
+
+ // then add the first vector again so it's a complete loop
+ vectors.Add(new Vector2((float)(radius * Math.Cos(0)), (float)(radius * Math.Sin(0))));
+
+ // Cache this circle so that it can be quickly drawn next time
+ circleCache.Add(circleKey, vectors);
+
+ return vectors;
+ }
+
+
+ ///
+ /// Creates a list of vectors that represents an arc
+ ///
+ /// The radius of the arc
+ /// The number of sides to generate in the circle that this will cut out from
+ /// The starting angle of arc, 0 being to the east, increasing as you go clockwise
+ /// The radians to draw, clockwise from the starting angle
+ /// A list of vectors that, if connected, will create an arc
+ private static List CreateArc(float radius, int sides, float startingAngle, float radians)
+ {
+ List points = new List();
+ points.AddRange(CreateCircle(radius, sides));
+ points.RemoveAt(points.Count - 1); // remove the last point because it's a duplicate of the first
+
+ // The circle starts at (radius, 0)
+ double curAngle = 0.0;
+ double anglePerSide = MathHelper.TwoPi / sides;
+
+ // "Rotate" to the starting point
+ while ((curAngle + (anglePerSide / 2.0)) < startingAngle)
+ {
+ curAngle += anglePerSide;
+
+ // move the first point to the end
+ points.Add(points[0]);
+ points.RemoveAt(0);
+ }
+
+ // Add the first point, just in case we make a full circle
+ points.Add(points[0]);
+
+ // Now remove the points at the end of the circle to create the arc
+ int sidesInArc = (int)((radians / anglePerSide) + 0.5);
+ points.RemoveRange(sidesInArc + 1, points.Count - sidesInArc - 1);
+
+ return points;
+ }
+
+ #endregion
+
+
+ #region FillRectangle
+
+ ///
+ /// Draws a filled rectangle
+ ///
+ /// The destination drawing surface
+ /// The rectangle to draw
+ /// The color to draw the rectangle in
+ public static void FillRectangle(this SpriteBatch spriteBatch, Rectangle rect, Color color)
+ {
+ if (pixel == null)
+ {
+ CreateThePixel(spriteBatch);
+ }
+
+ // Simply use the function already there
+ spriteBatch.Draw(pixel, rect, color);
+ }
+
+
+ ///
+ /// Draws a filled rectangle
+ ///
+ /// The destination drawing surface
+ /// The rectangle to draw
+ /// The color to draw the rectangle in
+ /// The angle in radians to draw the rectangle at
+ public static void FillRectangle(this SpriteBatch spriteBatch, Rectangle rect, Color color, float angle)
+ {
+ if (pixel == null)
+ {
+ CreateThePixel(spriteBatch);
+ }
+
+ spriteBatch.Draw(pixel, rect, null, color, angle, Vector2.Zero, SpriteEffects.None, 0);
+ }
+
+
+ ///
+ /// Draws a filled rectangle
+ ///
+ /// The destination drawing surface
+ /// Where to draw
+ /// The size of the rectangle
+ /// The color to draw the rectangle in
+ public static void FillRectangle(this SpriteBatch spriteBatch, Vector2 location, Vector2 size, Color color)
+ {
+ FillRectangle(spriteBatch, location, size, color, 0.0f);
+ }
+
+
+ ///
+ /// Draws a filled rectangle
+ ///
+ /// The destination drawing surface
+ /// Where to draw
+ /// The size of the rectangle
+ /// The angle in radians to draw the rectangle at
+ /// The color to draw the rectangle in
+ public static void FillRectangle(this SpriteBatch spriteBatch, Vector2 location, Vector2 size, Color color, float angle)
+ {
+ if (pixel == null)
+ {
+ CreateThePixel(spriteBatch);
+ }
+
+ // stretch the pixel between the two vectors
+ spriteBatch.Draw(pixel,
+ location,
+ null,
+ color,
+ angle,
+ Vector2.Zero,
+ size,
+ SpriteEffects.None,
+ 0);
+ }
+
+
+ ///
+ /// Draws a filled rectangle
+ ///
+ /// The destination drawing surface
+ /// The X coord of the left side
+ /// The Y coord of the upper side
+ /// Width
+ /// Height
+ /// The color to draw the rectangle in
+ public static void FillRectangle(this SpriteBatch spriteBatch, float x, float y, float w, float h, Color color)
+ {
+ FillRectangle(spriteBatch, new Vector2(x, y), new Vector2(w, h), color, 0.0f);
+ }
+
+
+ ///
+ /// Draws a filled rectangle
+ ///
+ /// The destination drawing surface
+ /// The X coord of the left side
+ /// The Y coord of the upper side
+ /// Width
+ /// Height
+ /// The color to draw the rectangle in
+ /// The angle of the rectangle in radians
+ public static void FillRectangle(this SpriteBatch spriteBatch, float x, float y, float w, float h, Color color, float angle)
+ {
+ FillRectangle(spriteBatch, new Vector2(x, y), new Vector2(w, h), color, angle);
+ }
+
+ #endregion
+
+
+ #region DrawRectangle
+
+ ///
+ /// Draws a rectangle with the thickness provided
+ ///
+ /// The destination drawing surface
+ /// The rectangle to draw
+ /// The color to draw the rectangle in
+ public static void DrawRectangle(this SpriteBatch spriteBatch, Rectangle rect, Color color)
+ {
+ DrawRectangle(spriteBatch, rect, color, 1.0f);
+ }
+
+
+ ///
+ /// Draws a rectangle with the thickness provided
+ ///
+ /// The destination drawing surface
+ /// The rectangle to draw
+ /// The color to draw the rectangle in
+ /// The thickness of the lines
+ public static void DrawRectangle(this SpriteBatch spriteBatch, Rectangle rect, Color color, float thickness)
+ {
+
+ // TODO: Handle rotations
+ // TODO: Figure out the pattern for the offsets required and then handle it in the line instead of here
+
+ DrawLine(spriteBatch, new Vector2(rect.X, rect.Y), new Vector2(rect.Right, rect.Y), color, thickness); // top
+ DrawLine(spriteBatch, new Vector2(rect.X + 1f, rect.Y), new Vector2(rect.X + 1f, rect.Bottom + thickness), color, thickness); // left
+ DrawLine(spriteBatch, new Vector2(rect.X, rect.Bottom), new Vector2(rect.Right, rect.Bottom), color, thickness); // bottom
+ DrawLine(spriteBatch, new Vector2(rect.Right + 1f, rect.Y), new Vector2(rect.Right + 1f, rect.Bottom + thickness), color, thickness); // right
+ }
+
+
+ ///
+ /// Draws a rectangle with the thickness provided
+ ///
+ /// The destination drawing surface
+ /// Where to draw
+ /// The size of the rectangle
+ /// The color to draw the rectangle in
+ public static void DrawRectangle(this SpriteBatch spriteBatch, Vector2 location, Vector2 size, Color color)
+ {
+ DrawRectangle(spriteBatch, new Rectangle((int)location.X, (int)location.Y, (int)size.X, (int)size.Y), color, 1.0f);
+ }
+
+
+ ///
+ /// Draws a rectangle with the thickness provided
+ ///
+ /// The destination drawing surface
+ /// Where to draw
+ /// The size of the rectangle
+ /// The color to draw the rectangle in
+ /// The thickness of the line
+ public static void DrawRectangle(this SpriteBatch spriteBatch, Vector2 location, Vector2 size, Color color, float thickness)
+ {
+ DrawRectangle(spriteBatch, new Rectangle((int)location.X, (int)location.Y, (int)size.X, (int)size.Y), color, thickness);
+ }
+
+ #endregion
+
+
+ #region DrawLine
+
+ ///
+ /// Draws a line from point1 to point2 with an offset
+ ///
+ /// The destination drawing surface
+ /// The X coord of the first point
+ /// The Y coord of the first point
+ /// The X coord of the second point
+ /// The Y coord of the second point
+ /// The color to use
+ public static void DrawLine(this SpriteBatch spriteBatch, float x1, float y1, float x2, float y2, Color color)
+ {
+ DrawLine(spriteBatch, new Vector2(x1, y1), new Vector2(x2, y2), color, 1.0f);
+ }
+
+
+ ///
+ /// Draws a line from point1 to point2 with an offset
+ ///
+ /// The destination drawing surface
+ /// The X coord of the first point
+ /// The Y coord of the first point
+ /// The X coord of the second point
+ /// The Y coord of the second point
+ /// The color to use
+ /// The thickness of the line
+ public static void DrawLine(this SpriteBatch spriteBatch, float x1, float y1, float x2, float y2, Color color, float thickness)
+ {
+ DrawLine(spriteBatch, new Vector2(x1, y1), new Vector2(x2, y2), color, thickness);
+ }
+
+
+ ///
+ /// Draws a line from point1 to point2 with an offset
+ ///
+ /// The destination drawing surface
+ /// The first point
+ /// The second point
+ /// The color to use
+ public static void DrawLine(this SpriteBatch spriteBatch, Vector2 point1, Vector2 point2, Color color)
+ {
+ DrawLine(spriteBatch, point1, point2, color, 1.0f);
+ }
+
+
+ ///
+ /// Draws a line from point1 to point2 with an offset
+ ///
+ /// The destination drawing surface
+ /// The first point
+ /// The second point
+ /// The color to use
+ /// The thickness of the line
+ public static void DrawLine(this SpriteBatch spriteBatch, Vector2 point1, Vector2 point2, Color color, float thickness)
+ {
+ // calculate the distance between the two vectors
+ float distance = Vector2.Distance(point1, point2);
+
+ // calculate the angle between the two vectors
+ float angle = (float)Math.Atan2(point2.Y - point1.Y, point2.X - point1.X);
+
+ DrawLine(spriteBatch, point1, distance, angle, color, thickness);
+ }
+
+
+ ///
+ /// Draws a line from point1 to point2 with an offset
+ ///
+ /// The destination drawing surface
+ /// The starting point
+ /// The length of the line
+ /// The angle of this line from the starting point in radians
+ /// The color to use
+ public static void DrawLine(this SpriteBatch spriteBatch, Vector2 point, float length, float angle, Color color)
+ {
+ DrawLine(spriteBatch, point, length, angle, color, 1.0f);
+ }
+
+
+ ///
+ /// Draws a line from point1 to point2 with an offset
+ ///
+ /// The destination drawing surface
+ /// The starting point
+ /// The length of the line
+ /// The angle of this line from the starting point
+ /// The color to use
+ /// The thickness of the line
+ public static void DrawLine(this SpriteBatch spriteBatch, Vector2 point, float length, float angle, Color color, float thickness)
+ {
+ if (pixel == null)
+ {
+ CreateThePixel(spriteBatch);
+ }
+
+ // stretch the pixel between the two vectors
+ spriteBatch.Draw(pixel,
+ point,
+ null,
+ color,
+ angle,
+ Vector2.Zero,
+ new Vector2(length, thickness),
+ SpriteEffects.None,
+ 0);
+ }
+
+ #endregion
+
+
+ #region PutPixel
+
+ public static void PutPixel(this SpriteBatch spriteBatch, float x, float y, Color color)
+ {
+ PutPixel(spriteBatch, new Vector2(x, y), color);
+ }
+
+
+ public static void PutPixel(this SpriteBatch spriteBatch, Vector2 position, Color color)
+ {
+ if (pixel == null)
+ {
+ CreateThePixel(spriteBatch);
+ }
+
+ spriteBatch.Draw(pixel, position, color);
+ }
+
+ #endregion
+
+
+ #region DrawCircle
+
+ ///
+ /// Draw a circle
+ ///
+ /// The destination drawing surface
+ /// The center of the circle
+ /// The radius of the circle
+ /// The number of sides to generate
+ /// The color of the circle
+ public static void DrawCircle(this SpriteBatch spriteBatch, Vector2 center, float radius, int sides, Color color)
+ {
+ DrawPoints(spriteBatch, center, CreateCircle(radius, sides), color, 1.0f);
+ }
+
+
+ ///
+ /// Draw a circle
+ ///
+ /// The destination drawing surface
+ /// The center of the circle
+ /// The radius of the circle
+ /// The number of sides to generate
+ /// The color of the circle
+ /// The thickness of the lines used
+ public static void DrawCircle(this SpriteBatch spriteBatch, Vector2 center, float radius, int sides, Color color, float thickness)
+ {
+ DrawPoints(spriteBatch, center, CreateCircle(radius, sides), color, thickness);
+ }
+
+
+ ///
+ /// Draw a circle
+ ///
+ /// The destination drawing surface
+ /// The center X of the circle
+ /// The center Y of the circle
+ /// The radius of the circle
+ /// The number of sides to generate
+ /// The color of the circle
+ public static void DrawCircle(this SpriteBatch spriteBatch, float x, float y, float radius, int sides, Color color)
+ {
+ DrawPoints(spriteBatch, new Vector2(x, y), CreateCircle(radius, sides), color, 1.0f);
+ }
+
+
+ ///
+ /// Draw a circle
+ ///
+ /// The destination drawing surface
+ /// The center X of the circle
+ /// The center Y of the circle
+ /// The radius of the circle
+ /// The number of sides to generate
+ /// The color of the circle
+ /// The thickness of the lines used
+ public static void DrawCircle(this SpriteBatch spriteBatch, float x, float y, float radius, int sides, Color color, float thickness)
+ {
+ DrawPoints(spriteBatch, new Vector2(x, y), CreateCircle(radius, sides), color, thickness);
+ }
+
+ #endregion
+
+
+ #region DrawArc
+
+ ///
+ /// Draw a arc
+ ///
+ /// The destination drawing surface
+ /// The center of the arc
+ /// The radius of the arc
+ /// The number of sides to generate
+ /// The starting angle of arc, 0 being to the east, increasing as you go clockwise
+ /// The number of radians to draw, clockwise from the starting angle
+ /// The color of the arc
+ public static void DrawArc(this SpriteBatch spriteBatch, Vector2 center, float radius, int sides, float startingAngle, float radians, Color color)
+ {
+ DrawArc(spriteBatch, center, radius, sides, startingAngle, radians, color, 1.0f);
+ }
+
+
+ ///
+ /// Draw a arc
+ ///
+ /// The destination drawing surface
+ /// The center of the arc
+ /// The radius of the arc
+ /// The number of sides to generate
+ /// The starting angle of arc, 0 being to the east, increasing as you go clockwise
+ /// The number of radians to draw, clockwise from the starting angle
+ /// The color of the arc
+ /// The thickness of the arc
+ public static void DrawArc(this SpriteBatch spriteBatch, Vector2 center, float radius, int sides, float startingAngle, float radians, Color color, float thickness)
+ {
+ List arc = CreateArc(radius, sides, startingAngle, radians);
+ //List arc = CreateArc2(radius, sides, startingAngle, degrees);
+ DrawPoints(spriteBatch, center, arc, color, thickness);
+ }
+
+ #endregion
+
+
+ }
+}
\ No newline at end of file
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/Program.cs b/C#_Mono/PlanetSimulation/PlanetSimulation/Program.cs
new file mode 100644
index 0000000..f0625de
--- /dev/null
+++ b/C#_Mono/PlanetSimulation/PlanetSimulation/Program.cs
@@ -0,0 +1,24 @@
+#region Using Statements
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+#endregion
+
+namespace PlanetSimulation
+{
+ static class Program
+ {
+ private static Game1 game;
+
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main ()
+ {
+ game = new Game1 ();
+ game.Run ();
+ }
+ }
+}
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/Properties/AssemblyInfo.cs b/C#_Mono/PlanetSimulation/PlanetSimulation/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..7f62166
--- /dev/null
+++ b/C#_Mono/PlanetSimulation/PlanetSimulation/Properties/AssemblyInfo.cs
@@ -0,0 +1,27 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("PlanetSimulation")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("hannes")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.0")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/Lidgren.Network.dll b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/Lidgren.Network.dll
new file mode 100644
index 0000000..a703f66
Binary files /dev/null and b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/Lidgren.Network.dll differ
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/MonoGame.Framework.dll b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/MonoGame.Framework.dll
new file mode 100644
index 0000000..65bf7c3
Binary files /dev/null and b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/MonoGame.Framework.dll differ
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/OpenTK.dll b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/OpenTK.dll
new file mode 100644
index 0000000..b1cd2e9
Binary files /dev/null and b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/OpenTK.dll differ
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/OpenTK.dll.config b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/OpenTK.dll.config
new file mode 100644
index 0000000..409cb8f
--- /dev/null
+++ b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/OpenTK.dll.config
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/PlanetSimulation.exe b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/PlanetSimulation.exe
new file mode 100644
index 0000000..42d43ca
Binary files /dev/null and b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/PlanetSimulation.exe differ
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/PlanetSimulation.exe.mdb b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/PlanetSimulation.exe.mdb
new file mode 100644
index 0000000..7c9f98d
Binary files /dev/null and b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/PlanetSimulation.exe.mdb differ
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/Tao.Sdl.dll b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/Tao.Sdl.dll
new file mode 100644
index 0000000..d2e2d47
Binary files /dev/null and b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/Tao.Sdl.dll differ
diff --git a/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/Tao.Sdl.dll.config b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/Tao.Sdl.dll.config
new file mode 100644
index 0000000..ec83f1e
--- /dev/null
+++ b/C#_Mono/PlanetSimulation/PlanetSimulation/bin/Debug/Tao.Sdl.dll.config
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/C#_Mono/UI/.vs/UI/v14/.suo b/C#_Mono/UI/.vs/UI/v14/.suo
new file mode 100644
index 0000000..8816757
Binary files /dev/null and b/C#_Mono/UI/.vs/UI/v14/.suo differ
diff --git a/C#_Mono/UI/UI.sln b/C#_Mono/UI/UI.sln
new file mode 100644
index 0000000..c9545ec
--- /dev/null
+++ b/C#_Mono/UI/UI.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UI", "UI\UI.csproj", "{C8A34B07-5506-435E-BD12-2C6E477E2EC5}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {C8A34B07-5506-435E-BD12-2C6E477E2EC5}.Debug|x86.ActiveCfg = Debug|x86
+ {C8A34B07-5506-435E-BD12-2C6E477E2EC5}.Debug|x86.Build.0 = Debug|x86
+ {C8A34B07-5506-435E-BD12-2C6E477E2EC5}.Release|x86.ActiveCfg = Release|x86
+ {C8A34B07-5506-435E-BD12-2C6E477E2EC5}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = UI\UI.csproj
+ EndGlobalSection
+EndGlobal
diff --git a/C#_Mono/UI/UI.userprefs b/C#_Mono/UI/UI.userprefs
new file mode 100644
index 0000000..a38577c
--- /dev/null
+++ b/C#_Mono/UI/UI.userprefs
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/C#_Mono/UI/UI/DemoToolBox.cs b/C#_Mono/UI/UI/DemoToolBox.cs
new file mode 100644
index 0000000..0685357
--- /dev/null
+++ b/C#_Mono/UI/UI/DemoToolBox.cs
@@ -0,0 +1,17 @@
+using System;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework;
+
+namespace UI
+{
+ public class DemoToolBox : ToolWindow
+ {
+ Button submit;
+ public DemoToolBox (Vector2 pos, Vector2 size) : base(pos,size)
+ {
+ submit = new Button (offset, new Rectangle (10, 10, 100, 20), Color.Gray, 2, Color.Black);
+ uiElements.Add(submit);
+ }
+ }
+}
+
diff --git a/C#_Mono/UI/UI/Game1.cs b/C#_Mono/UI/UI/Game1.cs
new file mode 100644
index 0000000..f644f91
--- /dev/null
+++ b/C#_Mono/UI/UI/Game1.cs
@@ -0,0 +1,91 @@
+#region Using Statements
+using System;
+
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Storage;
+using Microsoft.Xna.Framework.Input;
+
+#endregion
+
+namespace UI
+{
+ ///
+ /// This is the main type for your game
+ ///
+ public class Game1 : Game
+ {
+ GraphicsDeviceManager graphics;
+ SpriteBatch spriteBatch;
+
+ DemoToolBox t;
+
+ public Game1 ()
+ {
+ graphics = new GraphicsDeviceManager (this);
+ Content.RootDirectory = "Content";
+ graphics.IsFullScreen = false;
+ }
+
+ ///
+ /// Allows the game to perform any initialization it needs to before starting to run.
+ /// This is where it can query for any required services and load any non-graphic
+ /// related content. Calling base.Initialize will enumerate through any components
+ /// and initialize them as well.
+ ///
+ protected override void Initialize ()
+ {
+ // TODO: Add your initialization logic here
+ base.Initialize ();
+
+
+ }
+
+ ///
+ /// LoadContent will be called once per game and is the place to load
+ /// all of your content.
+ ///
+ protected override void LoadContent ()
+ {
+ // Create a new SpriteBatch, which can be used to draw textures.
+ spriteBatch = new SpriteBatch (GraphicsDevice);
+
+ //TODO: use this.Content to load your game content here
+ t = new DemoToolBox(Vector2.Zero, new Vector2(640, 480));
+
+ }
+
+ ///
+ /// Allows the game to run logic such as updating the world,
+ /// checking for collisions, gathering input, and playing audio.
+ ///
+ /// Provides a snapshot of timing values.
+ protected override void Update (GameTime gameTime)
+ {
+ // For Mobile devices, this logic will close the Game when the Back button is pressed
+ if (GamePad.GetState (PlayerIndex.One).Buttons.Back == ButtonState.Pressed) {
+ Exit ();
+ }
+ t.Update();
+ // TODO: Add your update logic here
+ base.Update (gameTime);
+ }
+
+ ///
+ /// This is called when the game should draw itself.
+ ///
+ /// Provides a snapshot of timing values.
+ protected override void Draw (GameTime gameTime)
+ {
+ graphics.GraphicsDevice.Clear (Color.CornflowerBlue);
+
+ //TODO: Add your drawing code here
+ //spriteBatch.Begin();
+ // b.Draw(graphics.GraphicsDevice, spriteBatch);
+ //spriteBatch.End();
+ t.DrawStatic(GraphicsDevice, spriteBatch);
+ base.Draw (gameTime);
+ }
+ }
+}
+
diff --git a/C#_Mono/UI/UI/Icon.png b/C#_Mono/UI/UI/Icon.png
new file mode 100644
index 0000000..c57cf36
Binary files /dev/null and b/C#_Mono/UI/UI/Icon.png differ
diff --git a/C#_Mono/UI/UI/Program.cs b/C#_Mono/UI/UI/Program.cs
new file mode 100644
index 0000000..9f0aab4
--- /dev/null
+++ b/C#_Mono/UI/UI/Program.cs
@@ -0,0 +1,24 @@
+#region Using Statements
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+#endregion
+
+namespace UI
+{
+ static class Program
+ {
+ private static Game1 game;
+
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main ()
+ {
+ game = new Game1 ();
+ game.Run ();
+ }
+ }
+}
diff --git a/C#_Mono/UI/UI/Properties/AssemblyInfo.cs b/C#_Mono/UI/UI/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..06d457b
--- /dev/null
+++ b/C#_Mono/UI/UI/Properties/AssemblyInfo.cs
@@ -0,0 +1,27 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("UI")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("hannes")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.0")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
diff --git a/C#_Mono/UI/UI/UI.csproj b/C#_Mono/UI/UI/UI.csproj
new file mode 100644
index 0000000..ee94b33
--- /dev/null
+++ b/C#_Mono/UI/UI/UI.csproj
@@ -0,0 +1,60 @@
+
+
+
+ Debug
+ x86
+ 10.0.0
+ 2.0
+ {C8A34B07-5506-435E-BD12-2C6E477E2EC5}
+ {9B831FEF-F496-498F-9FE8-180DA5CB4258};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ Exe
+ UI
+ Linux
+ UI
+
+
+ true
+ full
+ false
+ bin\Debug
+ DEBUG;
+ prompt
+ 4
+ x86
+ false
+
+
+ none
+ true
+ bin\Release
+ prompt
+ 4
+ x86
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/C#_Mono/UI/UI/UI/Button.cs b/C#_Mono/UI/UI/UI/Button.cs
new file mode 100644
index 0000000..b0489f6
--- /dev/null
+++ b/C#_Mono/UI/UI/UI/Button.cs
@@ -0,0 +1,38 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+
+namespace UI
+{
+ public class Button : UIElement
+ {
+ protected Color hColor {
+ get{ return new Color(Color.Black, 60); }}
+ protected Color innerColor;
+ protected int borderSize;
+
+ public Button (Vector2 offset, Rectangle b, Color c, int borderThickness, Color bColor): base(offset, b, bColor)
+ {
+ innerColor = c;
+ borderSize = borderThickness;
+ }
+ public override void Update()
+ {
+ base.Update();
+ }
+ public override void Draw(GraphicsDevice graphicsDevice, SpriteBatch spriteBatch)
+ {
+ base.Draw(graphicsDevice, spriteBatch);
+ var texture = new SolidColorTexture(graphicsDevice, innerColor);
+ var hTexture = new SolidColorTexture(graphicsDevice, hColor);
+ Rectangle inner = new Rectangle(bound.X + borderSize, bound.Y + borderSize , bound.Width - 2*borderSize, bound.Height - 2* borderSize);
+
+ spriteBatch.Draw(texture, inner, Color.White);
+ if(bound.Contains(m.MousePosition))
+ spriteBatch.Draw(hTexture, inner, Color.White);
+
+ }
+ }
+}
+
diff --git a/C#_Mono/UI/UI/UI/MouseManager.cs b/C#_Mono/UI/UI/UI/MouseManager.cs
new file mode 100644
index 0000000..e04eb9d
--- /dev/null
+++ b/C#_Mono/UI/UI/UI/MouseManager.cs
@@ -0,0 +1,48 @@
+using System;
+using Microsoft.Xna.Framework.Input;
+using Microsoft.Xna.Framework;
+
+namespace UI
+{
+ public class MouseManager
+ {
+ public event EventHandler LeftButtonClicked;
+ public event EventHandler LeftButtonReleased;
+ bool leftButtonLastState;
+ Point lastClickedPos;
+ public Point LastClickedPos {
+ get {return lastClickedPos;}}
+
+ public Point MousePosition {
+ get{
+ MouseState mState = Mouse.GetState();
+ return new Point(mState.X, mState.Y);
+ }
+ }
+
+ public MouseManager ()
+ {
+ leftButtonLastState = false;
+ }
+
+ public void Update ()
+ {
+ //If Clicked
+ if (Mouse.GetState ().LeftButton == ButtonState.Pressed && !leftButtonLastState) {
+ if (LeftButtonClicked != null)
+ LeftButtonClicked(this, null);
+ leftButtonLastState = true;
+ lastClickedPos = MousePosition;
+ }
+ //If Released
+ if(Mouse.GetState ().LeftButton == ButtonState.Released && leftButtonLastState)
+ {
+ if (LeftButtonReleased != null)
+ LeftButtonReleased(this, null);
+ leftButtonLastState = false;
+ lastClickedPos = Point.Zero;
+ }
+ }
+ }
+}
+
diff --git a/C#_Mono/UI/UI/UI/SolidColorTexture.cs b/C#_Mono/UI/UI/UI/SolidColorTexture.cs
new file mode 100644
index 0000000..80cfc60
--- /dev/null
+++ b/C#_Mono/UI/UI/UI/SolidColorTexture.cs
@@ -0,0 +1,38 @@
+using System;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework;
+
+namespace UI
+{
+public class SolidColorTexture : Texture2D
+ {
+ private Color _color;
+ // Gets or sets the color used to create the texture
+ public Color Color
+ {
+ get { return _color; }
+ set
+ {
+ if (value != _color)
+ {
+ _color = value;
+ SetData(new Color[] { _color });
+ }
+ }
+ }
+
+
+ public SolidColorTexture(GraphicsDevice graphicsDevice)
+ : base(graphicsDevice, 1, 1)
+ {
+ //default constructor
+ }
+ public SolidColorTexture(GraphicsDevice graphicsDevice, Color color)
+ : base(graphicsDevice, 1, 1)
+ {
+ Color = color;
+ }
+
+ }
+}
+
diff --git a/C#_Mono/UI/UI/UI/ToolWindow.cs b/C#_Mono/UI/UI/UI/ToolWindow.cs
new file mode 100644
index 0000000..0332b1d
--- /dev/null
+++ b/C#_Mono/UI/UI/UI/ToolWindow.cs
@@ -0,0 +1,60 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using System.Collections.Generic;
+
+namespace UI
+{
+ public class ToolWindow
+ {
+ protected List uiElements;
+ Button minimizeButton;
+
+ int windowBarHeight;
+ Vector2 pos;
+ Vector2 size;
+ Boolean minimized;
+ protected Vector2 offset;
+
+ public ToolWindow (Vector2 pos, Vector2 size)
+ {
+ uiElements = new List();
+ windowBarHeight = 20;
+ offset = new Vector2(pos.X, pos.Y + windowBarHeight);
+ minimized = false;
+ this.pos = pos;
+ this.size = size;
+ minimizeButton = new Button(new Vector2(2,2), new Rectangle((int)pos.X, (int) pos.Y, windowBarHeight - 4, windowBarHeight -4), Color.Red, 2, Color.Black);
+ minimizeButton.Clicked += new EventHandler(minimize);
+ }
+ public void Update ()
+ {
+ minimizeButton.Update();
+ foreach (var element in uiElements) {
+ element.Update();
+ }
+ }
+ public void DrawStatic (GraphicsDevice graphicsDevice, SpriteBatch spriteBatch)
+ {
+ var headBarTexture = new SolidColorTexture(graphicsDevice, Color.DarkGray);
+ var bodyTexture = new SolidColorTexture(graphicsDevice, Color.DimGray);
+
+ spriteBatch.Begin();
+ spriteBatch.Draw(headBarTexture, new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, windowBarHeight), Color.White);
+ minimizeButton.Draw(graphicsDevice, spriteBatch);
+ if (!minimized) {
+ spriteBatch.Draw(bodyTexture, new Rectangle((int)pos.X, (int)pos.Y + windowBarHeight, (int)size.X,(int)size.Y - windowBarHeight), Color.White);
+ //Draw all UI Elements
+ foreach (var element in uiElements) {
+ element.Draw(graphicsDevice, spriteBatch);
+ }
+ }
+ spriteBatch.End();
+ }
+ protected void minimize(object sender, EventArgs e)
+ {
+ minimized = !minimized;
+ }
+ }
+}
+
diff --git a/C#_Mono/UI/UI/UI/UICamera.cs b/C#_Mono/UI/UI/UI/UICamera.cs
new file mode 100644
index 0000000..60a4600
--- /dev/null
+++ b/C#_Mono/UI/UI/UI/UICamera.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace UI
+{
+ public class UICamera
+ {
+ public UICamera ()
+ {
+ }
+ }
+}
+
diff --git a/C#_Mono/UI/UI/UI/UIElement.cs b/C#_Mono/UI/UI/UI/UIElement.cs
new file mode 100644
index 0000000..c630731
--- /dev/null
+++ b/C#_Mono/UI/UI/UI/UIElement.cs
@@ -0,0 +1,47 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace UI
+{
+ public class UIElement
+ {
+ protected MouseManager m;
+ protected Rectangle bound;
+ protected Color color;
+
+ public event EventHandler Clicked;
+
+ public UIElement (Vector2 offset ,Rectangle b, Color c)
+ {
+ m = new MouseManager();
+ m.LeftButtonClicked += new EventHandler(click);
+
+ color = c;
+ bound = new Rectangle((int)(b.X + offset.X), (int)(b.Y + offset.Y), b.Width, b.Height);
+ }
+
+ public virtual void Update ()
+ {
+ m.Update();
+ }
+ public virtual void Draw(GraphicsDevice graphicsDevice, SpriteBatch spriteBatch)
+ {
+ var texture = new SolidColorTexture(graphicsDevice, color);
+ spriteBatch.Draw(texture, bound, Color.White);
+ }
+ private void click (object sender, EventArgs e)
+ {
+ if (Clicked != null && bound.Contains (m.MousePosition)) {
+ onClick();
+ Clicked (this, null);
+ }
+ }
+ public virtual void onClick()
+ {
+ //Should be overidden by UI Elements
+ }
+
+ }
+}
+
diff --git a/C#_Mono/UI/UI/bin/Debug/Lidgren.Network.dll b/C#_Mono/UI/UI/bin/Debug/Lidgren.Network.dll
new file mode 100644
index 0000000..a703f66
Binary files /dev/null and b/C#_Mono/UI/UI/bin/Debug/Lidgren.Network.dll differ
diff --git a/C#_Mono/UI/UI/bin/Debug/MonoGame.Framework.dll b/C#_Mono/UI/UI/bin/Debug/MonoGame.Framework.dll
new file mode 100644
index 0000000..65bf7c3
Binary files /dev/null and b/C#_Mono/UI/UI/bin/Debug/MonoGame.Framework.dll differ
diff --git a/C#_Mono/UI/UI/bin/Debug/OpenTK.dll b/C#_Mono/UI/UI/bin/Debug/OpenTK.dll
new file mode 100644
index 0000000..b1cd2e9
Binary files /dev/null and b/C#_Mono/UI/UI/bin/Debug/OpenTK.dll differ
diff --git a/C#_Mono/UI/UI/bin/Debug/OpenTK.dll.config b/C#_Mono/UI/UI/bin/Debug/OpenTK.dll.config
new file mode 100644
index 0000000..409cb8f
--- /dev/null
+++ b/C#_Mono/UI/UI/bin/Debug/OpenTK.dll.config
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/C#_Mono/UI/UI/bin/Debug/Tao.Sdl.dll b/C#_Mono/UI/UI/bin/Debug/Tao.Sdl.dll
new file mode 100644
index 0000000..d2e2d47
Binary files /dev/null and b/C#_Mono/UI/UI/bin/Debug/Tao.Sdl.dll differ
diff --git a/C#_Mono/UI/UI/bin/Debug/Tao.Sdl.dll.config b/C#_Mono/UI/UI/bin/Debug/Tao.Sdl.dll.config
new file mode 100644
index 0000000..ec83f1e
--- /dev/null
+++ b/C#_Mono/UI/UI/bin/Debug/Tao.Sdl.dll.config
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/C#_Mono/UI/UI/bin/Debug/UI.exe b/C#_Mono/UI/UI/bin/Debug/UI.exe
new file mode 100644
index 0000000..c058742
Binary files /dev/null and b/C#_Mono/UI/UI/bin/Debug/UI.exe differ
diff --git a/C#_Mono/UI/UI/bin/Debug/UI.exe.mdb b/C#_Mono/UI/UI/bin/Debug/UI.exe.mdb
new file mode 100644
index 0000000..56e983d
Binary files /dev/null and b/C#_Mono/UI/UI/bin/Debug/UI.exe.mdb differ
diff --git a/C#_Mono/UI/UpgradeLog.htm b/C#_Mono/UI/UpgradeLog.htm
new file mode 100644
index 0000000..74da685
Binary files /dev/null and b/C#_Mono/UI/UpgradeLog.htm differ
diff --git a/Java/20x20 (printf)/.idea/.name b/Java/20x20 (printf)/.idea/.name
new file mode 100644
index 0000000..2edf5be
--- /dev/null
+++ b/Java/20x20 (printf)/.idea/.name
@@ -0,0 +1 @@
+20x20 (printf)
\ No newline at end of file
diff --git a/Java/20x20 (printf)/.idea/checkstyle-idea.xml b/Java/20x20 (printf)/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..2a0f48e
--- /dev/null
+++ b/Java/20x20 (printf)/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Java/20x20 (printf)/.idea/compiler.xml b/Java/20x20 (printf)/.idea/compiler.xml
new file mode 100644
index 0000000..96cc43e
--- /dev/null
+++ b/Java/20x20 (printf)/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Java/20x20 (printf)/.idea/copyright/profiles_settings.xml b/Java/20x20 (printf)/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/Java/20x20 (printf)/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/Java/20x20 (printf)/.idea/encodings.xml b/Java/20x20 (printf)/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/Java/20x20 (printf)/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Java/20x20 (printf)/.idea/misc.xml b/Java/20x20 (printf)/.idea/misc.xml
new file mode 100644
index 0000000..db1dbaa
--- /dev/null
+++ b/Java/20x20 (printf)/.idea/misc.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Java/20x20 (printf)/.idea/modules.xml b/Java/20x20 (printf)/.idea/modules.xml
new file mode 100644
index 0000000..b97f2be
--- /dev/null
+++ b/Java/20x20 (printf)/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Java/20x20 (printf)/.idea/workspace.xml b/Java/20x20 (printf)/.idea/workspace.xml
new file mode 100644
index 0000000..2160bc3
--- /dev/null
+++ b/Java/20x20 (printf)/.idea/workspace.xml
@@ -0,0 +1,653 @@
+
+
+
+
+
+
+
+
+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+
+
+
Package
+
Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+
+
Interfaces (italic)
+
Classes
+
Enums
+
Exceptions
+
Errors
+
Annotation Types
+
+
+
+
Class/Interface
+
Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+
+
Class inheritance diagram
+
Direct Subclasses
+
All Known Subinterfaces
+
All Known Implementing Classes
+
Class/interface declaration
+
Class/interface description
+
+
+
Nested Class Summary
+
Field Summary
+
Constructor Summary
+
Method Summary
+
+
+
Field Detail
+
Constructor Detail
+
Method Detail
+
+
Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+
+
+
Annotation Type
+
Each annotation type has its own separate page with the following sections:
+
+
Annotation Type declaration
+
Annotation Type description
+
Required Element Summary
+
Optional Element Summary
+
Element Detail
+
+
+
+
Enum
+
Each enum has its own separate page with the following sections:
+
+
Enum declaration
+
Enum description
+
Enum Constant Summary
+
Enum Constant Detail
+
+
+
+
Use
+
Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+
+
+
Tree (Class Hierarchy)
+
There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
+
+
When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
+
When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
+
+
+
+
Deprecated API
+
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+
+
+
Index
+
The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+
+
+
Prev/Next
+
These links take you to the next or previous class, interface, package, or related page.
+
+
+
Frames/No Frames
+
These links show and hide the HTML frames. All pages are available with or without frames.
+
+
+
All Classes
+
The All Classes link shows all classes and interfaces except non-static nested types.
+
+
+
Serialized Form
+
Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
Returns an array containing the constants of this enum type, in
+the order they are declared. This method may be used to iterate
+over the constants as follows:
+
+for (FieldState c : FieldState.values())
+ System.out.println(c);
+
+
+
Returns:
+
an array containing the constants of this enum type, in the order they are declared
public static FieldState valueOf(java.lang.String name)
+
Returns the enum constant of this type with the specified name.
+The string must match exactly an identifier used to declare an
+enum constant in this type. (Extraneous whitespace characters are
+not permitted.)
+
+
Parameters:
+
name - the name of the enum constant to be returned.
+
Returns:
+
the enum constant with the specified name
+
Throws:
+
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
+
java.lang.NullPointerException - if the argument is null