summaryrefslogtreecommitdiff
path: root/Penguloon/Main.cs
diff options
context:
space:
mode:
authoraldrikboy <aldrikboy@gmail.com>2017-12-11 22:02:13 +0100
committeraldrikboy <aldrikboy@gmail.com>2017-12-11 22:02:13 +0100
commitfd6fa4e5cebbe3edb65d50c78dcc8a97ce98ce64 (patch)
tree8950f6b9023e0b47e22e1cd4869ab76de0803f4c /Penguloon/Main.cs
parentc4c0f3c887d627b6432551e96009c7aeecd4cdd8 (diff)
First commit
Diffstat (limited to 'Penguloon/Main.cs')
-rw-r--r--Penguloon/Main.cs121
1 files changed, 121 insertions, 0 deletions
diff --git a/Penguloon/Main.cs b/Penguloon/Main.cs
new file mode 100644
index 0000000..b2844fc
--- /dev/null
+++ b/Penguloon/Main.cs
@@ -0,0 +1,121 @@
+using System.Linq;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+using Microsoft.Xna.Framework.Input.Touch;
+
+using Android.Content.Res;
+
+namespace Penguloon
+{
+ /// <summary>
+ /// This is the main type for your game.
+ /// </summary>
+ public class Main : Game
+ {
+ private GraphicsDeviceManager _graphics;
+ private SpriteBatch _spriteBatch;
+ private Resources _resources;
+
+ public GraphicsDeviceManager Graphics
+ {
+ get => _graphics;
+ set => _graphics = value;
+ }
+
+ public SpriteBatch SpriteBatch
+ {
+ get => _spriteBatch;
+ set => _spriteBatch = value;
+ }
+
+ public Resources Resources
+ {
+ get => _resources;
+ set => _resources = value;
+ }
+
+ public Main(Resources resources)
+ {
+ Resources = resources;
+ Graphics = new GraphicsDeviceManager(this);
+ Content.RootDirectory = "Content";
+
+ Graphics.IsFullScreen = true;
+ Graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
+ }
+
+ /// <summary>
+ /// 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.
+ /// </summary>
+ protected override void Initialize()
+ {
+ SceneManager.Initialize(this);
+ StaticUIValues.Initialize(this);
+
+ base.Initialize();
+ }
+
+ /// <summary>
+ /// LoadContent will be called once per game and is the place to load
+ /// all of your content.
+ /// </summary>
+ protected override void LoadContent()
+ {
+ // Create a new SpriteBatch, which can be used to draw textures.
+ SpriteBatch = new SpriteBatch(GraphicsDevice);
+
+ ContentManager.LoadContent(this);
+
+ // TODO: use this.Content to load your game content here
+ }
+
+ /// <summary>
+ /// UnloadContent will be called once per game and is the place to unload
+ /// game-specific content.
+ /// </summary>
+ protected override void UnloadContent()
+ {
+ // TODO: Unload any non ContentManager content here
+ ContentManager.DisposeContent();
+ }
+
+ /// <summary>
+ /// Allows the game to run logic such as updating the world,
+ /// checking for collisions, gathering input, and playing audio.
+ /// </summary>
+ /// <param name="gameTime">Provides a snapshot of timing values.</param>
+ protected override void Update(GameTime gameTime)
+ {
+ var delta = (float)gameTime.ElapsedGameTime.TotalSeconds;
+
+ TouchLocation[] touchLocations = TouchPanel.GetState().ToArray();
+
+ SceneManager.Update(delta, touchLocations);
+
+ base.Update(gameTime);
+ }
+
+ /// <summary>
+ /// This is called when the game should draw itself.
+ /// </summary>
+ /// <param name="gameTime">Provides a snapshot of timing values.</param>
+ protected override void Draw(GameTime gameTime)
+ {
+ var delta = (float)gameTime.ElapsedGameTime.TotalSeconds;
+
+ GraphicsDevice.Clear(Color.Black);
+
+ SpriteBatch.Begin();
+
+ SceneManager.Draw(delta);
+
+ SpriteBatch.End();
+
+ base.Draw(gameTime);
+ }
+ }
+}