diff --git a/Source/Demos/Demo.Features.Windows/Demo.Features.NetCore.csproj b/Source/Demos/Demo.Features.Windows/Demo.Features.NetCore.csproj new file mode 100644 index 00000000..feab699c --- /dev/null +++ b/Source/Demos/Demo.Features.Windows/Demo.Features.NetCore.csproj @@ -0,0 +1,28 @@ + + + WinExe + netcoreapp2.0 + Icon.ico + + + + + + + + + + + + + + true + + + + + + + + + diff --git a/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsDirectX.csproj b/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsDirectX.csproj deleted file mode 100644 index 5651630f..00000000 --- a/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsDirectX.csproj +++ /dev/null @@ -1,99 +0,0 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {BDAEDFAF-2EDA-4BCA-9675-3625456FAB78} - WinExe - Properties - Demo.Features.Windows - Demo.Features.Windows - 512 - DesktopGL - v4.5 - - - true - bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ - DEBUG;TRACE;LINUX - full - AnyCPU - prompt - false - 4 - 6 - 1591 - - - bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ - TRACE;LINUX - true - pdbonly - AnyCPU - prompt - false - 4 - - - Icon.ico - - - app.manifest - - - - - - - - False - $(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll - - - - - - - - - - - Raw\title-screen.json - PreserveNewest - - - Raw\adventure-gui-skin.json - PreserveNewest - - - Content\Content.mgcb - - - - - - {8e425575-378a-4f83-88c9-f8bebad227c9} - MonoGame.Extended.Gui - - - {41724c52-3d50-45bb-81eb-3c8a247eafd1} - MonoGame.Extended - - - {d8c6d896-5abf-4823-84da-f1191beec004} - Demo.Features - - - - - - \ No newline at end of file diff --git a/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsOpenGL.csproj b/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsOpenGL.csproj deleted file mode 100644 index 1e065169..00000000 --- a/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsOpenGL.csproj +++ /dev/null @@ -1,142 +0,0 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {57C47653-BC51-43BA-98F4-1D0EEE78782D} - WinExe - Properties - Demo.Features.Windows - Demo.Features.Windows - 512 - DesktopGL - v4.5 - - - true - bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ - DEBUG;TRACE;LINUX - full - AnyCPU - prompt - false - 4 - 6 - 1591 - - - bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ - TRACE;LINUX - true - pdbonly - AnyCPU - prompt - false - 4 - - - Icon.ico - - - app.manifest - - - - - - - - $(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll - - - - - - - - - - - x86\SDL2.dll - PreserveNewest - - - x64\SDL2.dll - PreserveNewest - - - x86\soft_oal.dll - PreserveNewest - - - x64\soft_oal.dll - PreserveNewest - - - x86\libSDL2-2.0.so.0 - PreserveNewest - - - x64\libSDL2-2.0.so.0 - PreserveNewest - - - x86\libopenal.so.1 - PreserveNewest - - - x64\libopenal.so.1 - PreserveNewest - - - libSDL2-2.0.0.dylib - PreserveNewest - - - libopenal.1.dylib - PreserveNewest - - - MonoGame.Framework.dll.config - PreserveNewest - - - Raw\title-screen.json - PreserveNewest - - - Raw\adventure-gui-skin.json - PreserveNewest - - - Content\Content.mgcb - - - - - - {8e425575-378a-4f83-88c9-f8bebad227c9} - MonoGame.Extended.Gui - - - {41724c52-3d50-45bb-81eb-3c8a247eafd1} - MonoGame.Extended - - - {d8c6d896-5abf-4823-84da-f1191beec004} - Demo.Features - - - - - - \ No newline at end of file diff --git a/Source/Demos/Demo.Features.Windows/Properties/AssemblyInfo.cs b/Source/Demos/Demo.Features.Windows/Properties/AssemblyInfo.cs deleted file mode 100644 index 264773dd..00000000 --- a/Source/Demos/Demo.Features.Windows/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Demo.Windows")] -[assembly: AssemblyProduct("Demo.Windows")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("958dc6a4-0d1f-4d40-aae6-d71bef2aa584")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Source/Demos/Demo.Features.Windows/app.manifest b/Source/Demos/Demo.Features.Windows/app.manifest deleted file mode 100644 index 5606c0aa..00000000 --- a/Source/Demos/Demo.Features.Windows/app.manifest +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true/pm - - - - diff --git a/Source/Demos/Demo.Features/Content/Content.mgcb b/Source/Demos/Demo.Features/Content/Content.mgcb index efb9e9f9..3fa77c22 100644 --- a/Source/Demos/Demo.Features/Content/Content.mgcb +++ b/Source/Demos/Demo.Features/Content/Content.mgcb @@ -10,7 +10,7 @@ #-------------------------------- References --------------------------------# -/reference:..\..\..\MonoGame.Extended.Content.Pipeline\bin\MonoGame.Extended.Content.Pipeline.dll +/reference:../../../MonoGame.Extended.Content.Pipeline/bin/netstandard2.0/MonoGame.Extended.Content.Pipeline.dll #---------------------------------- Content ---------------------------------# diff --git a/Source/Demos/Demo.Features/Demo.Features.csproj b/Source/Demos/Demo.Features/Demo.Features.csproj index 5b111200..e7948d22 100644 --- a/Source/Demos/Demo.Features/Demo.Features.csproj +++ b/Source/Demos/Demo.Features/Demo.Features.csproj @@ -1,188 +1,50 @@ - - - + - 10.0 - Debug - AnyCPU - {D8C6D896-5ABF-4823-84DA-F1191BEEC004} Library - Demo.Features - Demo.Features - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile111 - v4.5 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - 6 - 1591 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + netcoreapp2.0 + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - PreserveNewest - - - - - - - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - - Designer - - - Designer - - - - - - - - + + + + - - {587ce536-216f-41a1-b223-ae502c125b09} - MonoGame.Extended.Animations - - - {02562c6f-5bfb-467e-8a95-68b6ce2d635a} - MonoGame.Extended.Collisions - - - {9b3ab8a1-78aa-471a-afd0-b10b932115bc} - MonoGame.Extended.Graphics - - - {8e425575-378a-4f83-88c9-f8bebad227c9} - MonoGame.Extended.Gui - - - {49c87598-994c-49b5-bbb3-7ffc342635d3} - MonoGame.Extended.Input - - - {6C8B9E29-D09B-4901-80FD-45AAA35882C6} - MonoGame.Extended.Particles - - - {fe61c3d7-d96d-4aa4-9ef1-17e457bb2c7c} - MonoGame.Extended.SceneGraphs - - - {07b2ade2-73e3-41c4-aea1-d5566a5ab902} - MonoGame.Extended.Tiled - - - {1cf61f4f-a2ee-49bf-95d0-379e870de90e} - MonoGame.Extended.Tweening - - - {41724c52-3d50-45bb-81eb-3c8a247eafd1} - MonoGame.Extended + + + true + + + + + + + + + + - - - - - - - - - - - - - - - - + - - - - - - - - ..\..\packages\MonoGame.Framework.Portable.3.6.0.1625\lib\portable-net45+win8+wpa81\MonoGame.Framework.dll - - - ..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll - - - - \ No newline at end of file + diff --git a/Source/Demos/Demo.Features/Demos/CollisionDemo.cs b/Source/Demos/Demo.Features/Demos/CollisionDemo.cs index 333374e1..45ce7280 100644 --- a/Source/Demos/Demo.Features/Demos/CollisionDemo.cs +++ b/Source/Demos/Demo.Features/Demos/CollisionDemo.cs @@ -38,7 +38,7 @@ namespace Demo.Features.Demos var demoBall1 = new DemoBall(new Sprite(_spikeyBallTexture)) { Position = new Vector2(200, 240), - BoundingBox = new RectangleF(200, 240, 20, 20), + Bounds = new RectangleF(200, 240, 20, 20), Velocity = new Vector2(0, -120) }; _actors.Add(demoBall1); @@ -46,17 +46,17 @@ namespace Demo.Features.Demos var demoBall2 = new DemoBall(new Sprite(_spikeyBallTexture)) { Position = new Vector2(600, 240), - BoundingBox = new RectangleF(600, 240, 20, 20), + Bounds = new RectangleF(600, 240, 20, 20), Velocity = new Vector2(0, 120) }; _actors.Add(demoBall2); var wall1 = new DemoWall(new Sprite(_blankTexture)); - wall1.BoundingBox = new RectangleF(0, 0, 800, 20); + wall1.Bounds = new RectangleF(0, 0, 800, 20); _actors.Add(wall1); var wall2 = new DemoWall(new Sprite(_blankTexture)); - wall2.BoundingBox = new RectangleF(0, 460, 800, 20); + wall2.Bounds = new RectangleF(0, 460, 800, 20); _actors.Add(wall2); foreach (var actor in _actors) @@ -87,7 +87,7 @@ namespace Demo.Features.Demos _spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp); foreach (var actor in _actors) { - _spriteBatch.Draw(_blankTexture, actor.BoundingBox.ToRectangle(), Color.WhiteSmoke); + //_spriteBatch.Draw(_blankTexture, actor.BoundingBox.ToRectangle(), Color.WhiteSmoke); actor.Draw(_spriteBatch); } _spriteBatch.End(); @@ -98,30 +98,30 @@ namespace Demo.Features.Demos #region Collision Demo Implementation - class DemoActor : IActorTarget, IUpdate + class DemoActor : ICollisionActor, IUpdate { private readonly Sprite _sprite; public DemoActor(Sprite sprite) { _sprite = sprite; - BoundingBox = sprite.BoundingRectangle; + Bounds = sprite.GetBoundingRectangle(new Transform2()); } public Vector2 Position { get; set; } - public RectangleF BoundingBox { get; set; } + public IShapeF Bounds { get; set; } + public Vector2 Velocity { get; set; } - public virtual void OnCollision(CollisionInfo collisionInfo) + public virtual void OnCollision(CollisionEventArgs collisionInfo) { } public void Draw(SpriteBatch spriteBatch) { - _sprite.Position = Position; - _sprite.Draw(spriteBatch); + _sprite.Draw(spriteBatch, Position, 0, Vector2.One); } public virtual void Update(GameTime gameTime) @@ -149,15 +149,15 @@ namespace Demo.Features.Demos public override void Update(GameTime gameTime) { base.Update(gameTime); - BoundingBox = new RectangleF(Position.X, Position.Y, BoundingBox.Width, BoundingBox.Height); + Bounds.Position = Position; } - public override void OnCollision(CollisionInfo collisionInfo) + public override void OnCollision(CollisionEventArgs collisionInfo) { Velocity *= -1; Position -= collisionInfo.PenetrationVector; - BoundingBox = new RectangleF(Position.X, Position.Y, BoundingBox.Width, BoundingBox.Height); + Bounds.Position = Position; base.OnCollision(collisionInfo); } } diff --git a/Source/Demos/Demo.Features/GameMain.cs b/Source/Demos/Demo.Features/GameMain.cs index e5f6d29c..b93bbb6a 100644 --- a/Source/Demos/Demo.Features/GameMain.cs +++ b/Source/Demos/Demo.Features/GameMain.cs @@ -5,6 +5,7 @@ using Demo.Features.Screens; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; using MonoGame.Extended; +using MonoGame.Extended.BitmapFonts; using MonoGame.Extended.Gui; using MonoGame.Extended.ViewportAdapters; @@ -36,21 +37,21 @@ namespace Demo.Features }; Content.RootDirectory = "Content"; - IsMouseVisible = false; + IsMouseVisible = true; Window.AllowUserResizing = true; _demos = new DemoBase[] { - new GuiLayoutDemo(this), - new GuiDemo(this), + //new GuiLayoutDemo(this), + //new GuiDemo(this), //new ScreensDemo(this), new ViewportAdaptersDemo(this), - new CollisionDemo(this), + new CollisionDemo(this), new TiledMapsDemo(this), new AnimationsDemo(this), new SpritesDemo(this), new BatchingDemo(this), - new TweeningDemo(this), + //new TweeningDemo(this), new InputListenersDemo(this), new SceneGraphsDemo(this), new ParticlesDemo(this), @@ -85,15 +86,18 @@ namespace Demo.Features { ViewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480); - var skin = GuiSkin.FromFile(Content, @"Raw/adventure-gui-skin.json"); + //var skin = GuiSkin.FromFile(Content, @"Raw/adventure-gui-skin.json"); var guiRenderer = new GuiSpriteBatchRenderer(GraphicsDevice, ViewportAdapter.GetScaleMatrix); + var font = Content.Load("small-font"); + BitmapFont.UseKernings = false; + Skin.CreateDefault(font); + _selectDemoScreen = new SelectDemoScreen(_demos, LoadDemo, Exit); + _guiSystem = new GuiSystem(ViewportAdapter, guiRenderer) { - Screens = { new SelectDemoScreen(skin, _demos, LoadDemo, Exit) } + ActiveScreen = _selectDemoScreen, }; - - //LoadDemo(_demoIndex); } private void LoadDemo(string name) @@ -106,6 +110,7 @@ namespace Demo.Features } private KeyboardState _previousKeyboardState; + private SelectDemoScreen _selectDemoScreen; protected override void Update(GameTime gameTime) { @@ -124,11 +129,13 @@ namespace Demo.Features public void Back() { - if (_guiSystem.Screens[0].IsVisible) + if (_selectDemoScreen.IsVisible) Exit(); IsMouseVisible = false; - _guiSystem.Screens[0].Show(); + _currentDemo = null; + _selectDemoScreen.IsVisible = true; + _guiSystem.ActiveScreen = _selectDemoScreen; } protected override void Draw(GameTime gameTime) diff --git a/Source/Demos/Demo.Features/Properties/AssemblyInfo.cs b/Source/Demos/Demo.Features/Properties/AssemblyInfo.cs deleted file mode 100644 index 5d2e7125..00000000 --- a/Source/Demos/Demo.Features/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Resources; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Demo")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Demo")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguage("en")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Source/Demos/Demo.Features/Screens/SelectDemoScreen.cs b/Source/Demos/Demo.Features/Screens/SelectDemoScreen.cs index d620b52b..03efa18b 100644 --- a/Source/Demos/Demo.Features/Screens/SelectDemoScreen.cs +++ b/Source/Demos/Demo.Features/Screens/SelectDemoScreen.cs @@ -4,6 +4,7 @@ using System.Linq; using Demo.Features.Demos; using Microsoft.Xna.Framework; using MonoGame.Extended; +using MonoGame.Extended.BitmapFonts; using MonoGame.Extended.Gui; using MonoGame.Extended.Gui.Controls; using MonoGame.Extended.TextureAtlases; @@ -20,36 +21,28 @@ namespace Demo.Features.Screens _demos = demos; _loadDemo = loadDemo; - var dialog = Skin.Create("dialog"); - var grid = new UniformGrid { Columns = 3 }; + var grid = new UniformGrid(); foreach (var demo in _demos.Values.OrderBy(i => i.Name)) { - var button = Skin.Create