diff --git a/Lighthouse/.gitignore b/Lighthouse/.gitignore
new file mode 100644
index 0000000..add57be
--- /dev/null
+++ b/Lighthouse/.gitignore
@@ -0,0 +1,5 @@
+bin/
+obj/
+/packages/
+riderModule.iml
+/_ReSharper.Caches/
\ No newline at end of file
diff --git a/Lighthouse/.gitmodules b/Lighthouse/.gitmodules
new file mode 100644
index 0000000..acc7e36
--- /dev/null
+++ b/Lighthouse/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "Nez"]
+ path = Nez
+ url = git@github.com:prime31/Nez.git
diff --git a/Lighthouse/.idea/.idea.Lighthouse/.idea/.gitignore b/Lighthouse/.idea/.idea.Lighthouse/.idea/.gitignore
new file mode 100644
index 0000000..e112fb0
--- /dev/null
+++ b/Lighthouse/.idea/.idea.Lighthouse/.idea/.gitignore
@@ -0,0 +1,11 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/projectSettingsUpdater.xml
+/contentModel.xml
+/.idea.Lighthouse.iml
+/modules.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/Lighthouse/.idea/.idea.Lighthouse/.idea/encodings.xml b/Lighthouse/.idea/.idea.Lighthouse/.idea/encodings.xml
new file mode 100644
index 0000000..df87cf9
--- /dev/null
+++ b/Lighthouse/.idea/.idea.Lighthouse/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Lighthouse/.idea/.idea.Lighthouse/.idea/indexLayout.xml b/Lighthouse/.idea/.idea.Lighthouse/.idea/indexLayout.xml
new file mode 100644
index 0000000..7b08163
--- /dev/null
+++ b/Lighthouse/.idea/.idea.Lighthouse/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Lighthouse/.idea/.idea.Lighthouse/.idea/vcs.xml b/Lighthouse/.idea/.idea.Lighthouse/.idea/vcs.xml
new file mode 100644
index 0000000..bee80b2
--- /dev/null
+++ b/Lighthouse/.idea/.idea.Lighthouse/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse.sln b/Lighthouse/Lighthouse.sln
new file mode 100644
index 0000000..04f5bbf
--- /dev/null
+++ b/Lighthouse/Lighthouse.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lighthouse", "Lighthouse\Lighthouse.csproj", "{9CB2B6B8-C67F-4D18-920C-B5A3A568D016}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nez.MG38", "Nez\Nez.Portable\Nez.MG38.csproj", "{E7007463-3FF6-4953-9C19-B70E4E73B851}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9CB2B6B8-C67F-4D18-920C-B5A3A568D016}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9CB2B6B8-C67F-4D18-920C-B5A3A568D016}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9CB2B6B8-C67F-4D18-920C-B5A3A568D016}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9CB2B6B8-C67F-4D18-920C-B5A3A568D016}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E7007463-3FF6-4953-9C19-B70E4E73B851}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E7007463-3FF6-4953-9C19-B70E4E73B851}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E7007463-3FF6-4953-9C19-B70E4E73B851}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E7007463-3FF6-4953-9C19-B70E4E73B851}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/Lighthouse/Lighthouse.sln.DotSettings.user b/Lighthouse/Lighthouse.sln.DotSettings.user
new file mode 100644
index 0000000..427f625
--- /dev/null
+++ b/Lighthouse/Lighthouse.sln.DotSettings.user
@@ -0,0 +1,6 @@
+
+ <SessionState ContinuousTestingMode="0" IsActive="True" Name="Session" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
+ <Nothing />
+</SessionState>
+ True
+ True
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Components/DebugOverlay.cs b/Lighthouse/Lighthouse/Components/DebugOverlay.cs
new file mode 100644
index 0000000..5ae96c9
--- /dev/null
+++ b/Lighthouse/Lighthouse/Components/DebugOverlay.cs
@@ -0,0 +1,21 @@
+using Microsoft.Xna.Framework;
+using Nez;
+
+namespace Lighthouse
+{
+ public class DebugOverlay : RenderableComponent
+ {
+ public override float Width => 100;
+ public override float Height => 100;
+
+ public override void Render(Batcher batcher, Camera camera)
+ {
+ var world = (Entity.Scene as MainScene)?.World;
+ var color = Color.Lime;
+ batcher.DrawString(Graphics.Instance.BitmapFont, $"Position: {world.Player.X}, {world.Player.Y}",
+ new Vector2(500, 0), color);
+ batcher.DrawString(Graphics.Instance.BitmapFont, $"Day: {(Entity.Scene as MainScene).CurrentDay.DayOfYear}", new Vector2(500, 10), color);
+ batcher.DrawString(Graphics.Instance.BitmapFont, $"Hour: {world.DayTime:.0}", new Vector2(500, 20), color);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Components/Dialog.cs b/Lighthouse/Lighthouse/Components/Dialog.cs
new file mode 100644
index 0000000..efab868
--- /dev/null
+++ b/Lighthouse/Lighthouse/Components/Dialog.cs
@@ -0,0 +1,107 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Nez;
+using Nez.BitmapFonts;
+
+namespace Lighthouse
+{
+ public enum DialogState
+ {
+ Empty,
+ Writing,
+ Done,
+ }
+
+ public class Dialog : RenderableComponent, IUpdatable
+ {
+ private string _text;
+ private int _letterCount;
+ private float _nextTime;
+ private const float LetterSpeed = 0.1f;
+ private const float AutoDisplayTime = 10f;
+ private Queue _thoughts;
+ private Texture2D _more;
+ private DialogState _state;
+
+ public override float Width => 400;
+ public override float Height => 100;
+
+ public Dialog()
+ {
+ _text = "";
+ _thoughts = new Queue();
+ }
+
+ public override void OnAddedToEntity()
+ {
+ _more = Graphics.CreateSingleColorTexture(10, 10, Color.White);
+ }
+
+ public void AddThought(string text)
+ {
+ if (_state == DialogState.Empty)
+ Think(text);
+ else
+ _thoughts.Enqueue(text);
+ }
+
+ public void Think(string text)
+ {
+ _text = text;
+ _letterCount = 1;
+ _state = DialogState.Writing;
+ _nextTime = Time.TotalTime + LetterSpeed;
+ }
+
+ public void Update()
+ {
+ // nothing to update
+ if (Time.TotalTime < _nextTime && !VirtualInput.Action.IsPressed)
+ return;
+
+ switch (_state)
+ {
+ case DialogState.Writing:
+ _nextTime = Time.TotalTime + LetterSpeed;
+ _letterCount += 1;
+ if (_letterCount == _text.Length || VirtualInput.Action.IsPressed)
+ {
+ _letterCount = _text.Length;
+ _state = DialogState.Done;
+ _nextTime = Time.TotalTime + AutoDisplayTime;
+ }
+ break;
+ case DialogState.Done:
+ if (_thoughts.Count != 0)
+ Think(_thoughts.Dequeue());
+ else
+ _state = DialogState.Empty;
+ break;
+ default:
+ break;
+ }
+ }
+
+ public override void Render(Batcher batcher, Camera camera)
+ {
+ if (_state == DialogState.Empty)
+ return;
+ var s = _text.Substring(0, _letterCount);
+ var width = Graphics.Instance.BitmapFont.MeasureString(s).X;
+ var pos = new Vector2((Entity.Scene.Camera.Bounds.Width - width)/2, Entity.Position.Y);
+ var alpha = 1f;
+ if (_state == DialogState.Done)
+ {
+ alpha = (_nextTime - Time.TotalTime) / AutoDisplayTime;
+ }
+ batcher.DrawString(Graphics.Instance.BitmapFont, s, pos, Color.White * alpha);
+ if (_state == DialogState.Done && _thoughts.Count != 0)
+ {
+ pos += new Vector2(2 + width, 0);
+ batcher.Draw(_more, pos, Color.White * alpha);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Components/MapRenderer.cs b/Lighthouse/Lighthouse/Components/MapRenderer.cs
new file mode 100644
index 0000000..7b4bf00
--- /dev/null
+++ b/Lighthouse/Lighthouse/Components/MapRenderer.cs
@@ -0,0 +1,69 @@
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Nez;
+
+namespace Lighthouse
+{
+ public class MapRenderer : RenderableComponent
+ {
+ // 640/16 = 40, 360/16=22.5 (half a tile cut off? seems ok)
+ private const int VisibleTilesWide = 40;
+ private const int VisibleTilesTall = 23;
+
+ private Texture2D _tilesetTexture;
+ private readonly World _world;
+ // how far from top left corner should player sprite be pinned
+ private int _playerXOffset;
+ private int _playerYOffset;
+
+ public override float Width => VisibleTilesWide * _tilesetTexture.Width;
+ public override float Height => VisibleTilesTall * _tilesetTexture.Height;
+
+ public MapRenderer(World world, int xOffset, int yOffset)
+ {
+ _world = world;
+ LayerDepth = 1f;
+ _playerXOffset = xOffset;
+ _playerYOffset = yOffset;
+ }
+
+ public override void OnAddedToEntity()
+ {
+ _tilesetTexture = Entity.Scene.Content.Load("Textures/Ground");
+ }
+
+ public override void Render(Batcher batcher, Camera camera)
+ {
+ var map = _world.Location.Map;
+ var dest = new Rectangle(0, 0, map.TileWidth, map.TileHeight);
+ var src = new Rectangle(0, 0, map.TileWidth, map.TileHeight);
+ var xOffset = _world.Player.X - _playerXOffset;
+ var yOffset = _world.Player.Y - _playerYOffset;
+
+ foreach (var layer in map.Layers)
+ {
+ for (int y = yOffset; y < yOffset+VisibleTilesTall; y++)
+ {
+ for (int x = xOffset; x < xOffset+VisibleTilesWide; x++)
+ {
+ if (y < 0 || x < 0 || x >= layer.width || y >= layer.height)
+ continue;
+ int gid = layer.data[x + (y * layer.width)];
+ if (gid == 0)
+ continue;
+ var mapTileset = map.GetTiledMapTileset(gid);
+ var tileset = _world.Location.Tilesets[mapTileset.firstgid];
+ var rect = map.GetSourceRect(mapTileset, tileset, gid);
+
+ dest.X = (x - xOffset) * map.TileWidth;
+ dest.Y = (y - yOffset) * map.TileHeight;
+ src.X = rect.x;
+ src.Y = rect.y;
+ batcher.Draw(_tilesetTexture, dest, src, Color.White);
+ }
+ }
+ }
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Components/Minimap.cs b/Lighthouse/Lighthouse/Components/Minimap.cs
new file mode 100644
index 0000000..3e2cc85
--- /dev/null
+++ b/Lighthouse/Lighthouse/Components/Minimap.cs
@@ -0,0 +1,66 @@
+using System.Collections.Generic;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Nez;
+
+namespace Lighthouse
+{
+ public class Minimap : RenderableComponent, IUpdatable
+ {
+ private Texture2D _texture;
+ private Texture2D _shroudTex;
+ private Color[] _shroudData;
+ private readonly World _world;
+
+ public override float Width => 100;
+ public override float Height => 100;
+
+ public Minimap(World world)
+ {
+ _world = world;
+ _shroudTex = Graphics.CreateSingleColorTexture(1000, 1000, Color.Black);
+ _shroudData = new Color[1000*1000];
+ _texture = Graphics.CreateSingleColorTexture(1000, 1000, Color.Black);
+ var data = new Color[1000*1000];
+ var colors = new Dictionary();
+ colors["water"] = new Color(0, 100, 200);
+ colors["ground"] = new Color(0, 200, 0);
+ colors["wall"] = new Color(128, 128, 128);
+ colors[""] = new Color(255, 0, 0);
+ for (var x = 0; x < 1000; x++)
+ {
+ for (var y = 0; y < 1000; y++)
+ {
+ _shroudData[x+y*1000] = Color.Black;
+ data[x+y*1000] = colors[world.GetTileType(x, y)];
+ }
+ }
+ _texture.SetData(data);
+ LayerDepth = 0.2f;
+ }
+
+ public void Update()
+ {
+ for (var x = _world.Player.X-20; x < _world.Player.X+20; x++)
+ {
+ for (var y = _world.Player.Y-10; y < _world.Player.Y+10; y++)
+ {
+ _shroudData[x + y * 1000] = new Color(0, 0, 0, 0);
+ }
+ }
+ _shroudTex.SetData(_shroudData);
+ }
+
+ public override void Render(Batcher batcher, Camera camera)
+ {
+ batcher.Draw(_texture, new Rectangle(540, 260, 100, 100),
+ new Rectangle(_world.Player.X-50, _world.Player.Y-50, 100, 100),
+ Color.White
+ );
+ batcher.Draw(_shroudTex, new Rectangle(540, 260, 100, 100),
+ new Rectangle(_world.Player.X-50, _world.Player.Y-50, 100, 100),
+ Color.White
+ );
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Components/Player.cs b/Lighthouse/Lighthouse/Components/Player.cs
new file mode 100644
index 0000000..db18137
--- /dev/null
+++ b/Lighthouse/Lighthouse/Components/Player.cs
@@ -0,0 +1,76 @@
+using Nez;
+
+namespace Lighthouse
+{
+ public class Player : Component, IUpdatable
+ {
+ private const double MoveDelaySeconds = 0.05;
+ private double _lastMoveTime;
+
+ public PlayerAnimator Animator;
+ private World _world;
+ // world coordinates
+ public int X;
+ public int Y;
+
+ public Player(World world)
+ {
+ _world = world;
+ }
+
+ public void Update()
+ {
+ if (Time.TotalTime - _lastMoveTime > MoveDelaySeconds)
+ {
+ var newX = X;
+ var newY = Y;
+
+ if (VirtualInput.Left.IsDown)
+ {
+ newX -= 1;
+ Animator.StepAnimation("walk left");
+ }
+ else if (VirtualInput.Right.IsDown)
+ {
+ newX += 1;
+ Animator.StepAnimation("walk right");
+ }
+ else if (VirtualInput.Up.IsDown)
+ {
+ newY -= 1;
+ Animator.StepAnimation("walk up");
+ }
+ else if (VirtualInput.Down.IsDown)
+ {
+ newY += 1;
+ Animator.StepAnimation("walk down");
+ }
+
+ if (newX != X || newY != Y)
+ {
+ if (_world.GetTileType(newX, newY) == "ground")
+ {
+ _lastMoveTime = Time.TotalTime;
+ SetPlayerPosition(newX, newY);
+ }
+ }
+ }
+ }
+
+ public void SetPlayerPosition(int x, int y)
+ {
+ foreach (var warp in _world.Location.Warps)
+ {
+ if (x == warp.FromX && y == warp.FromY)
+ {
+ //Console.WriteLine($"{warp.FromX} {warp.FromY} => {warp.ToX} {warp.ToY}");
+ x = warp.ToX;
+ y = warp.ToY;
+ _world.Location = warp.To;
+ }
+ }
+ X = x;
+ Y = y;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Components/PlayerAnimator.cs b/Lighthouse/Lighthouse/Components/PlayerAnimator.cs
new file mode 100644
index 0000000..bf00067
--- /dev/null
+++ b/Lighthouse/Lighthouse/Components/PlayerAnimator.cs
@@ -0,0 +1,43 @@
+using Nez.Sprites;
+using Nez.Textures;
+
+namespace Lighthouse
+{
+ public class PlayerAnimator : SpriteAnimator
+ {
+ public override void OnAddedToEntity()
+ {
+ var texture = Entity.Scene.Content.LoadTexture("Textures/FarmerCyan");
+ var sprites = Sprite.SpritesFromAtlas(texture, 16, 16);
+ SetSprite(sprites[1]);
+ LayerDepth = 0.5f;
+ AddAnimation("walk down", new Sprite[] {sprites[1], sprites[2], sprites[3], sprites[4]});
+ AddAnimation("walk up", new Sprite[] {sprites[6], sprites[7], sprites[8], sprites[9]});
+ AddAnimation("walk right", new Sprite[] {sprites[11], sprites[12], sprites[13], sprites[14]});
+ AddAnimation("walk left", new Sprite[] {sprites[16], sprites[17], sprites[18], sprites[19]});
+ }
+
+ public void StepAnimation(string name)
+ {
+ if (name != CurrentAnimationName)
+ {
+ Play(name);
+ Pause();
+ }
+ else
+ {
+ AdvanceFrame();
+ }
+ }
+
+ private void AdvanceFrame()
+ {
+ CurrentFrame += 1;
+ if (CurrentFrame >= CurrentAnimation.Sprites.Length)
+ CurrentFrame = 0;
+ // Update won't be called because of Paused state, so need to do this ourselves
+ Sprite = CurrentAnimation.Sprites[CurrentFrame];
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Components/SkyRenderer.cs b/Lighthouse/Lighthouse/Components/SkyRenderer.cs
new file mode 100644
index 0000000..410ed0f
--- /dev/null
+++ b/Lighthouse/Lighthouse/Components/SkyRenderer.cs
@@ -0,0 +1,153 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Nez;
+
+namespace Lighthouse
+{
+ public struct Star
+ {
+ public double R;
+ public double Theta;
+ public Color Color;
+
+ public Star(double r, double theta, Color color)
+ {
+ R = r;
+ Theta = theta;
+ Color = color;
+ }
+ }
+
+ public class SkyRenderer : RenderableComponent, IUpdatable
+ {
+ public const int CycleDays = 20;
+
+ private Texture2D _moon;
+ private Texture2D _moonShadow;
+ private Texture2D _dot;
+ private Star[] _stars;
+ private int _northPoleX;
+ private int _northPoleY;
+ private int _moonDay;
+ private World _world;
+
+ public override float Width => 100;
+ public override float Height => 100;
+
+ public SkyRenderer(World world)
+ {
+ _world = world;
+
+ _northPoleX = 300;
+ _northPoleY = 300;
+ // force first update
+ _moonDay = -1;
+
+ _stars = new[]
+ {
+ new Star(5, 0.1, new Color(205, 205, 205)),
+ new Star(10, 0.4, new Color(205, 205, 205)),
+ new Star(20, 1, new Color(205, 205, 205)),
+ new Star(30, 1.3, new Color(205, 205, 205)),
+ new Star(40, 2.0, new Color(205, 205, 205)),
+ new Star(40, 2.4, new Color(205, 205, 205)),
+ new Star(50, 2.9, new Color(205, 205, 205)),
+ new Star(70, 4, new Color(205, 205, 205)),
+ new Star(80, 5, new Color(205, 205, 205)),
+ new Star(90, 6, new Color(205, 205, 205)),
+ };
+ }
+
+ public override void OnAddedToEntity()
+ {
+ _moon = Entity.Scene.Content.LoadTexture("Textures/Moon");
+ _moonShadow = new Texture2D(Core.GraphicsDevice, _moon.Width, _moon.Height, false, _moon.Format);
+ _dot = new Texture2D(Core.GraphicsDevice, 1, 1);
+ _dot.SetData(new[] { Color.White });
+ CalculateMoonShadow();
+ }
+
+ private void CalculateMoonShadow()
+ {
+ /*
+ 0: New Moon (100% obscured)
+ Waxing Crescent (over-filled from left)
+ 0.25: First Quarter (50% filled from left)
+ Waxing Gibbous (under-filled from left)
+ 0.5: Full Moon (100% unobscured)
+ Waning Gibbous (under-filled from right)
+ 0.75: Third Quarter (50% filled from right)
+ Waning Crescent (over-filled from right)
+ */
+ if (_moonDay == _world.Day)
+ return;
+ _moonDay = _world.Day;
+ float amount = ((float)_moonDay % CycleDays / CycleDays);
+ var dataColors = new Color[_moon.Width*_moon.Height];
+ _moon.GetData(dataColors);
+ //Console.WriteLine($"updating moon {_moonDay} {_world.Day} {amount}");
+
+ Color left;
+ Color right;
+ double percent;
+
+ if (amount <= 0.5)
+ {
+ // wind down from left -> right
+ percent = 1 - (amount / 0.5);
+ left = new Color(0, 0, 0, 200);
+ right = new Color(0, 0, 0, 0);
+ }
+ else
+ {
+ // fill from right -> left
+ percent = 1 - ((amount-0.5) / 0.5);
+ left = new Color(0, 0, 0, 0);
+ right = new Color(0, 0, 0, 200);
+ }
+
+ int firstPixel;
+ int lastPixel;
+ for (var y = 0; y < _moon.Height; ++y)
+ {
+ firstPixel = -1;
+ lastPixel = _moon.Width;
+ for (var x = 0; x < _moon.Width; ++x)
+ {
+ if (dataColors[x + y * _moon.Width].A > 0)
+ {
+ if(firstPixel == -1)
+ firstPixel = x;
+ lastPixel = x;
+ }
+ }
+
+ for (var x = firstPixel; x <= lastPixel; ++x)
+ {
+ dataColors[x + y * _moon.Width] = (float)(x-firstPixel)/(lastPixel-firstPixel) <= percent ? left : right;
+ }
+ }
+ _moonShadow.SetData(dataColors);
+ }
+
+ public override void Render(Batcher batcher, Camera camera)
+ {
+ var t = _world.DayTime/24*2*Math.PI;
+ // stars
+ foreach(var star in _stars)
+ batcher.Draw(_dot,
+ new Rectangle((int) (_northPoleX + star.R * Math.Sin(star.Theta+t)),
+ (int) (_northPoleY + star.R * Math.Cos(star.Theta+t)), 2, 2), star.Color);
+
+ // moon
+ batcher.Draw(_moon, new Rectangle(50, 50, 96, 96), Color.White);
+ batcher.Draw(_moonShadow, new Rectangle(50, 50, 96, 96), Color.White);
+ }
+
+ public void Update()
+ {
+ CalculateMoonShadow();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Components/TimeOfDayRenderer.cs b/Lighthouse/Lighthouse/Components/TimeOfDayRenderer.cs
new file mode 100644
index 0000000..24086b1
--- /dev/null
+++ b/Lighthouse/Lighthouse/Components/TimeOfDayRenderer.cs
@@ -0,0 +1,93 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Nez;
+using Random = Nez.Random;
+
+namespace Lighthouse
+{
+ public class TimeOfDayRenderer : RenderableComponent, IUpdatable
+ {
+ public override float Width => 640;
+ public override float Height => 360;
+ private Texture2D _rect;
+ private readonly World _world;
+ private float _lastWeatherUpdate;
+ private float[,] _rainParams;
+ private float _windDirection;
+
+ public TimeOfDayRenderer(World world)
+ {
+ _world = world;
+ LayerDepth = 0.3f;
+ _rainParams = new float[50, 3];
+ _windDirection = 0;
+ }
+
+ public override void OnAddedToEntity()
+ {
+ _rect = Graphics.CreateSingleColorTexture(1, 1, Color.White);
+ }
+
+ public void Update()
+ {
+ if (Time.TotalTime - _lastWeatherUpdate < 0.1)
+ return;
+ _lastWeatherUpdate = Time.TotalTime;
+ _windDirection += (Random.NextFloat() - 0.5f);
+
+ for (int i = 0; i < _rainParams.GetLength(0); ++i)
+ {
+ _rainParams[i, 0] = Random.NextFloat() * Entity.Scene.Camera.Bounds.Width;
+ _rainParams[i, 1] = Random.NextFloat() * Entity.Scene.Camera.Bounds.Height;
+
+ switch (_world.Weather)
+ {
+ case WeatherType.Rain:
+ _rainParams[i, 2] = 5 + Random.NextFloat() * 20;
+ break;
+ case WeatherType.Snow:
+ _rainParams[i, 2] = Random.NextFloat() * 4;
+ break;
+ }
+ }
+ }
+
+ public override void Render(Batcher batcher, Camera camera)
+ {
+ var brightness = Math.Sin((_world.DayTime + (24-World.Sunrise)) * Math.PI / 12);
+ var percent = (float) (brightness < 0 ? 0.9f : Math.Max(0.9 - brightness, 0));
+ batcher.Draw(_rect, new Rectangle(0, 0, 640, 360), new Color(0, 0, 0, percent));
+ Color _rainColor = new Color(0, 0, 128, 128);
+
+ switch (_world.Weather)
+ {
+ case WeatherType.Rain:
+ for (int i = 0; i < _rainParams.GetLength(0); ++i)
+ {
+ batcher.DrawLine(
+ _rainParams[i, 0],
+ _rainParams[i, 1],
+ _rainParams[i, 0] + _windDirection,
+ _rainParams[i, 1] + _rainParams[i, 2],
+ _rainColor
+ );
+ }
+ break;
+ case WeatherType.Snow:
+ for (int i = 0; i < _rainParams.GetLength(0); ++i)
+ {
+ batcher.DrawCircle(
+ _rainParams[i, 0],
+ _rainParams[i, 1],
+ _rainParams[i, 2],
+ Color.White
+ );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Components/World.cs b/Lighthouse/Lighthouse/Components/World.cs
new file mode 100644
index 0000000..e315de5
--- /dev/null
+++ b/Lighthouse/Lighthouse/Components/World.cs
@@ -0,0 +1,85 @@
+using Lighthouse.Data;
+using Nez;
+
+namespace Lighthouse
+{
+ public enum WeatherType
+ {
+ Sun,
+ Rain,
+ Snow,
+ }
+
+ public class World : SceneComponent, IUpdatable
+ {
+ // space
+ public Location Location;
+ public bool IsIndoors => Location == Locations.Island;
+
+ // time
+ public const int DayInSeconds = 30;
+ public const float Sunrise = 6;
+ public int Day;
+ public double DayTime;
+ public int Hour => (int)DayTime;
+ public Player Player;
+ private double _lastDayStart = 0;
+
+ // weather
+ public WeatherType Weather;
+
+ // minimap
+ public bool[,] Shroud;
+
+ public World()
+ {
+ Day = 0;
+ Shroud = new bool[1000, 1000];
+ Weather = WeatherType.Snow;
+ }
+
+ public override void Update()
+ {
+ if (_lastDayStart == 0)
+ {
+ _lastDayStart = Time.TotalTime;
+ }
+
+ DayTime = (Time.TotalTime - _lastDayStart) / DayInSeconds * 24;
+ if (DayTime > 24)
+ {
+ DayTime -= 24;
+ Day += 1;
+ _lastDayStart = Time.TotalTime;
+ }
+
+ for (var x = Player.X - 20; x < Player.X + 20; x++)
+ {
+ for (var y = Player.Y - 10; y < Player.Y + 10; y++)
+ {
+ Shroud[x, y] = true;
+ }
+ }
+ }
+
+ public string GetTileType(int x, int y)
+ {
+ // top down
+ for(var i=Location.Map.Layers.Length-1; i >= 0; i--)
+ {
+ var layer = Location.Map.Layers[i];
+ if (y < 0 || x < 0 || x >= layer.width || y >= layer.height)
+ continue;
+ int gid = layer.data[x + (y * layer.width)];
+ if (gid == 0)
+ continue;
+ var mapTileset = Location.Map.GetTiledMapTileset(gid);
+ var tileset = Location.Tilesets[mapTileset.firstgid];
+ var tile = Location.Map.GetTiledTile(mapTileset, tileset, gid);
+ if (tile?.type != null)
+ return tile.type;
+ }
+ return "";
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Content/Content.mgcb b/Lighthouse/Lighthouse/Content/Content.mgcb
new file mode 100644
index 0000000..70b1489
--- /dev/null
+++ b/Lighthouse/Lighthouse/Content/Content.mgcb
@@ -0,0 +1,51 @@
+
+#----------------------------- Global Properties ----------------------------#
+
+/outputDir:bin/$(Platform)
+/intermediateDir:obj/$(Platform)
+/platform:DesktopGL
+/config:
+/profile:Reach
+/compress:False
+
+#-------------------------------- References --------------------------------#
+
+
+#---------------------------------- Content ---------------------------------#
+
+#begin Textures/FarmerCyan.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Textures/FarmerCyan.png
+
+#begin Textures/Ground.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Textures/Ground.png
+
+#begin Textures/Moon.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Textures/Moon.png
+
diff --git a/Lighthouse/Lighthouse/Content/Maps/Cave.tmx b/Lighthouse/Lighthouse/Content/Maps/Cave.tmx
new file mode 100644
index 0000000..d136f2a
--- /dev/null
+++ b/Lighthouse/Lighthouse/Content/Maps/Cave.tmx
@@ -0,0 +1,48 @@
+
+
diff --git a/Lighthouse/Lighthouse/Content/Maps/Ground.tsx b/Lighthouse/Lighthouse/Content/Maps/Ground.tsx
new file mode 100644
index 0000000..fa4e888
--- /dev/null
+++ b/Lighthouse/Lighthouse/Content/Maps/Ground.tsx
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Lighthouse/Lighthouse/Content/Maps/Island.tmx b/Lighthouse/Lighthouse/Content/Maps/Island.tmx
new file mode 100644
index 0000000..5210a3b
--- /dev/null
+++ b/Lighthouse/Lighthouse/Content/Maps/Island.tmx
@@ -0,0 +1,252 @@
+
+
diff --git a/Lighthouse/Lighthouse/Content/Maps/World.tmx b/Lighthouse/Lighthouse/Content/Maps/World.tmx
new file mode 100644
index 0000000..e5396e1
--- /dev/null
+++ b/Lighthouse/Lighthouse/Content/Maps/World.tmx
@@ -0,0 +1,2012 @@
+
+
diff --git a/Lighthouse/Lighthouse/Content/Textures/FarmerCyan.png b/Lighthouse/Lighthouse/Content/Textures/FarmerCyan.png
new file mode 100644
index 0000000..f7b4bd9
Binary files /dev/null and b/Lighthouse/Lighthouse/Content/Textures/FarmerCyan.png differ
diff --git a/Lighthouse/Lighthouse/Content/Textures/Ground.png b/Lighthouse/Lighthouse/Content/Textures/Ground.png
new file mode 100644
index 0000000..c5b5d7c
Binary files /dev/null and b/Lighthouse/Lighthouse/Content/Textures/Ground.png differ
diff --git a/Lighthouse/Lighthouse/Content/Textures/Moon.png b/Lighthouse/Lighthouse/Content/Textures/Moon.png
new file mode 100644
index 0000000..e8b1e39
Binary files /dev/null and b/Lighthouse/Lighthouse/Content/Textures/Moon.png differ
diff --git a/Lighthouse/Lighthouse/Data/Days.cs b/Lighthouse/Lighthouse/Data/Days.cs
new file mode 100644
index 0000000..38d3174
--- /dev/null
+++ b/Lighthouse/Lighthouse/Data/Days.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+
+namespace Lighthouse.Data
+{
+ public class Event
+ {
+ public double Time;
+ public string Thought;
+ public bool Fired;
+
+ public Event(double time, string thought)
+ {
+ Time = time;
+ Thought = thought;
+ Fired = false;
+ }
+ }
+
+ public class Day
+ {
+ public int Number { get; }
+ public List TimedDialog;
+
+ public Day(int n)
+ {
+ Number = n;
+ TimedDialog = new List();
+ }
+
+ public DateTime StartDay = new DateTime(2022, 3, 1);
+ public DateTime DayOfYear => StartDay + TimeSpan.FromDays((double)Number);
+ }
+
+ public static class Days
+ {
+ public static Dictionary AllDays;
+
+ static Days()
+ {
+ AllDays = new Dictionary();
+
+ AllDays[0] = new Day(0);
+ AllDays[0].TimedDialog.Add(new Event(4, "What did I get myself into?"));
+ AllDays[0].TimedDialog.Add(new Event(8, "My only job is to keep the lighthouse working."));
+ AllDays[0].TimedDialog.Add(new Event(9, "One full year."));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Data/Items.cs b/Lighthouse/Lighthouse/Data/Items.cs
new file mode 100644
index 0000000..5638ce0
--- /dev/null
+++ b/Lighthouse/Lighthouse/Data/Items.cs
@@ -0,0 +1,10 @@
+namespace Lighthouse
+{
+ public struct Item
+ {
+ public int Id;
+ public string Name;
+ public string MapTextureName;
+ public bool Unique;
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Data/Locations.cs b/Lighthouse/Lighthouse/Data/Locations.cs
new file mode 100644
index 0000000..8e0d421
--- /dev/null
+++ b/Lighthouse/Lighthouse/Data/Locations.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using TiledCS;
+
+namespace Lighthouse.Data
+{
+ public class Locations
+ {
+ public static Location Island;
+ public static Location Cave;
+
+ public static void Initialize()
+ {
+ Island = new Location( "Content/Maps/World.tmx");
+ Cave = new Location("Content/Maps/Cave.tmx");
+ AddWarp(Island, 421, 269, Cave, 22, 38);
+ }
+
+ static void AddWarp(Location from, int fromX, int fromY, Location to, int toX, int toY)
+ {
+ from.Warps.Add(new Warp(fromX, fromY, to, toX, toY));
+ to.Warps.Add(new Warp(toX, toY + 1, from, fromX, fromY + 1));
+ }
+ }
+
+ public struct Warp
+ {
+ public int FromX;
+ public int FromY;
+ public Location To;
+ public int ToX;
+ public int ToY;
+
+ public Warp(int fromX, int fromY, Location to, int toX, int toY)
+ {
+ FromX = fromX;
+ FromY = fromY;
+ To = to;
+ ToX = toX;
+ ToY = toY;
+ }
+ }
+
+ public class Location
+ {
+ public Location(string tmxPath)
+ {
+ // be sure to set "Copy to Output Directory" property of these files to `Copy if newer`
+ Map = new TiledMap(tmxPath);
+ Tilesets = Map.GetTiledTilesets(Path.GetDirectoryName(tmxPath) + "/");
+
+ if (Map.Layers[0].chunks != null)
+ {
+ Console.WriteLine("ERROR: Chunks still present, make map non-infinite!");
+ }
+ }
+
+ public TiledMap Map;
+ public Dictionary Tilesets;
+ public List Warps = new List();
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Game1.cs b/Lighthouse/Lighthouse/Game1.cs
new file mode 100644
index 0000000..b4264f6
--- /dev/null
+++ b/Lighthouse/Lighthouse/Game1.cs
@@ -0,0 +1,15 @@
+using Nez;
+
+namespace Lighthouse
+{
+ public class Game1 : Core
+ {
+ protected override void Initialize()
+ {
+ base.Initialize();
+ VirtualInput.Initialize();
+ //Scene = new SplashScene("Textures/FarmerCyan", 2, new MenuScene());
+ Scene = new MainScene();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Icon.bmp b/Lighthouse/Lighthouse/Icon.bmp
new file mode 100644
index 0000000..2b48165
Binary files /dev/null and b/Lighthouse/Lighthouse/Icon.bmp differ
diff --git a/Lighthouse/Lighthouse/Icon.ico b/Lighthouse/Lighthouse/Icon.ico
new file mode 100644
index 0000000..7d9dec1
Binary files /dev/null and b/Lighthouse/Lighthouse/Icon.ico differ
diff --git a/Lighthouse/Lighthouse/Lighthouse.csproj b/Lighthouse/Lighthouse/Lighthouse.csproj
new file mode 100644
index 0000000..fc719f8
--- /dev/null
+++ b/Lighthouse/Lighthouse/Lighthouse.csproj
@@ -0,0 +1,49 @@
+
+
+ WinExe
+ netcoreapp3.1
+ false
+ false
+
+
+ app.manifest
+ Icon.ico
+
+
+
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ Always
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/MainScene.cs b/Lighthouse/Lighthouse/MainScene.cs
new file mode 100644
index 0000000..c501213
--- /dev/null
+++ b/Lighthouse/Lighthouse/MainScene.cs
@@ -0,0 +1,114 @@
+using Lighthouse.Data;
+using Microsoft.Xna.Framework;
+using Nez;
+
+namespace Lighthouse
+{
+ public enum SceneState
+ {
+ World,
+ Sky,
+ Inventory,
+ }
+
+ public class MainScene : Scene
+ {
+ private const int PlayerSpawnX = 400;
+ private const int PlayerSpawnY = 200;
+
+ private SceneState _state;
+ public World World;
+ private Dialog _dialog;
+ private readonly Entity _playerEntity;
+ private readonly Entity _sky;
+ private readonly Entity _map;
+
+ public Day CurrentDay
+ {
+ get
+ {
+ if (!Days.AllDays.ContainsKey(World.Day))
+ return new Day(World.Day);
+ return Days.AllDays[World.Day];
+ }
+ }
+
+ public MainScene()
+ {
+ SetDesignResolution(640, 360, SceneResolutionPolicy.ShowAllPixelPerfect);
+ Screen.SetSize(1280, 720);
+ Locations.Initialize();
+
+ World = new World();
+ World.Location = Locations.Island;
+ World.Player = new Player(World);
+ World.Player.X = PlayerSpawnX;
+ World.Player.Y = PlayerSpawnY;
+ AddSceneComponent(World);
+
+ const int MapPlayerOffsetX = 19;
+ const int MapPlayerOffsetY = 10;
+
+ _map = CreateEntity("map");
+ _map.AddComponent(new MapRenderer(World, MapPlayerOffsetX, MapPlayerOffsetY));
+ _map.AddComponent(new TimeOfDayRenderer(World));
+ var minimap = _map.AddComponent(new Minimap(World));
+
+ _sky = CreateEntity("sky");
+ _sky.AddComponent(new SkyRenderer(World));
+
+ var playerPos = new Vector2(16 * MapPlayerOffsetX + 8, 16 * MapPlayerOffsetY + 8);
+ _playerEntity = CreateEntity("player", playerPos);
+ _playerEntity.AddComponent(World.Player);
+ World.Player.Animator = _playerEntity.AddComponent(new PlayerAnimator());
+
+ var dialog = CreateEntity("dialog", playerPos + new Vector2(0, -20));
+ _dialog = new Dialog();
+ dialog.AddComponent(_dialog);
+
+ var debug = CreateEntity("debug");
+ var overlay = new DebugOverlay();
+ debug.AddComponent(new DebugOverlay());
+
+ SetState(SceneState.World);
+ }
+
+ public void SetState(SceneState state)
+ {
+ _state = state;
+ switch (state)
+ {
+ case SceneState.World:
+ _map.Enabled = true;
+ _sky.Enabled = false;
+ _playerEntity.Enabled = true;
+ break;
+ case SceneState.Sky:
+ _map.Enabled = false;
+ _sky.Enabled = true;
+ _playerEntity.Enabled = false;
+ break;
+ }
+ }
+
+ public override void Update()
+ {
+ base.Update();
+
+ if (VirtualInput.LookUp.IsPressed && World.IsIndoors)
+ {
+ SetState(_state == SceneState.World ? SceneState.Sky : SceneState.World);
+ }
+
+ for (var index = 0; index < CurrentDay.TimedDialog.Count; index++)
+ {
+ var e = CurrentDay.TimedDialog[index];
+ if (World.Hour >= e.Time && !e.Fired)
+ {
+ _dialog.AddThought(e.Thought);
+ e.Fired = true;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Menu.cs b/Lighthouse/Lighthouse/Menu.cs
new file mode 100644
index 0000000..f9ee2c7
--- /dev/null
+++ b/Lighthouse/Lighthouse/Menu.cs
@@ -0,0 +1,72 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Nez;
+using Nez.BitmapFonts;
+
+namespace Lighthouse
+{
+ public class Menu : RenderableComponent
+ {
+ private string[] _options;
+ private Vector2[] _offsets;
+ private int _selection = 0;
+
+ public override float Width => 640;
+ public override float Height => 360;
+
+ public int Selection
+ {
+ get => _selection;
+ set
+ {
+ if (value <= 0)
+ {
+ _selection = 0;
+ }
+ else if(value >= _options.Length)
+ {
+ _selection = _options.Length - 1;
+ }
+ else
+ {
+ _selection = value;
+ }
+ }
+ }
+
+ public Menu(string[] options)
+ {
+ _options = options;
+
+ // compute word spacing
+ var totalFontHeight = 0f;
+ _offsets = new Vector2[options.Length];
+ for(var i=0; i < options.Length; i++)
+ {
+ var m = Graphics.Instance.BitmapFont.MeasureString(options[i]);
+ _offsets[i] = new Vector2((Width - m.X) / 2, totalFontHeight);
+ totalFontHeight += m.Y;
+ }
+
+ var addYPadding = (Height - totalFontHeight) / options.Length;
+ for(var i=0; i < options.Length; i++)
+ {
+ _offsets[i].Y += addYPadding*i;
+ }
+ }
+
+ public override void Render(Batcher batcher, Camera camera)
+ {
+ for(int i=0; i < _options.Length; i++)
+ batcher.DrawString(Graphics.Instance.BitmapFont, _options[i], _offsets[i],
+ i == Selection ? Color.GreenYellow : Color.Green);
+ }
+
+ public virtual void OnSelection()
+ {
+ Console.WriteLine($"Option Selected: {Selection}: {_options[Selection]}");
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/MenuScene.cs b/Lighthouse/Lighthouse/MenuScene.cs
new file mode 100644
index 0000000..bc299f7
--- /dev/null
+++ b/Lighthouse/Lighthouse/MenuScene.cs
@@ -0,0 +1,37 @@
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input;
+using Nez;
+
+namespace Lighthouse
+{
+ public class MenuScene : Scene
+ {
+ private Menu _menu;
+
+ public MenuScene()
+ {
+ SetDesignResolution(640, 360, SceneResolutionPolicy.ShowAllPixelPerfect);
+ Screen.SetSize(640*2, 360*2);
+ var menu = CreateEntity("menu");
+ _menu = new Menu(new[] {"New Game", "Options", "Credits", "Quit"});
+ menu.AddComponent(_menu);
+ }
+
+ public override void Update()
+ {
+ base.Update();
+ if (Input.IsKeyPressed(Keys.Down))
+ {
+ _menu.Selection += 1;
+ }
+ else if(Input.IsKeyPressed(Keys.Up))
+ {
+ _menu.Selection -= 1;
+ }
+ else if (Input.IsKeyPressed(Keys.Space))
+ {
+ _menu.OnSelection();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/Program.cs b/Lighthouse/Lighthouse/Program.cs
new file mode 100644
index 0000000..08681c6
--- /dev/null
+++ b/Lighthouse/Lighthouse/Program.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace Lighthouse
+{
+ public static class Program
+ {
+ [STAThread]
+ static void Main()
+ {
+ using (var game = new Game1())
+ game.Run();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/SplashScene.cs b/Lighthouse/Lighthouse/SplashScene.cs
new file mode 100644
index 0000000..809f7cf
--- /dev/null
+++ b/Lighthouse/Lighthouse/SplashScene.cs
@@ -0,0 +1,33 @@
+using Microsoft.Xna.Framework;
+using Nez;
+using Nez.Sprites;
+
+namespace Lighthouse
+{
+ public class SplashScene : Scene
+ {
+ private float _durationSeconds;
+ private Scene _nextScene;
+
+ public SplashScene(string resourceName, float durationSeconds, Scene nextScene)
+ {
+ SetDesignResolution(640, 360, SceneResolutionPolicy.ShowAllPixelPerfect);
+ Screen.SetSize(640*2, 360*2);
+
+ _durationSeconds = durationSeconds;
+ _nextScene = nextScene;
+
+ var texture = Content.LoadTexture(resourceName);
+ var entity = CreateEntity("splash", new Vector2(Screen.Width / 2, Screen.Height / 2));
+ entity.AddComponent(new SpriteRenderer(texture));
+ }
+
+ public override void Update()
+ {
+ if (Time.TimeSinceSceneLoad >= _durationSeconds)
+ {
+ Core.Scene = _nextScene;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/VirtualInput.cs b/Lighthouse/Lighthouse/VirtualInput.cs
new file mode 100644
index 0000000..4c7daaf
--- /dev/null
+++ b/Lighthouse/Lighthouse/VirtualInput.cs
@@ -0,0 +1,34 @@
+using Microsoft.Xna.Framework.Input;
+using Nez;
+
+namespace Lighthouse
+{
+ public static class VirtualInput
+ {
+ public static VirtualButton Up;
+ public static VirtualButton Down;
+ public static VirtualButton Left;
+ public static VirtualButton Right;
+ public static VirtualButton Start;
+ public static VirtualButton Action;
+ public static VirtualButton LookUp;
+
+ public static void Initialize()
+ {
+ Up = new VirtualButton();
+ Down = new VirtualButton();
+ Left = new VirtualButton();
+ Right = new VirtualButton();
+ Start = new VirtualButton();
+ Action = new VirtualButton();
+ LookUp = new VirtualButton();
+ Up.AddKeyboardKey(Keys.Up).AddKeyboardKey(Keys.W);
+ Down.AddKeyboardKey(Keys.Down).AddKeyboardKey(Keys.S);
+ Left.AddKeyboardKey(Keys.Left).AddKeyboardKey(Keys.A);
+ Right.AddKeyboardKey(Keys.Right).AddKeyboardKey(Keys.D);
+ Start.AddKeyboardKey(Keys.Enter);
+ Action.AddKeyboardKey(Keys.Space);
+ LookUp.AddKeyboardKey(Keys.LeftShift);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lighthouse/Lighthouse/app.manifest b/Lighthouse/Lighthouse/app.manifest
new file mode 100644
index 0000000..e910eaf
--- /dev/null
+++ b/Lighthouse/Lighthouse/app.manifest
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true/pm
+ permonitorv2,permonitor
+
+
+
+