From 6f23a80f7feef9e49971ff4936ad7082ea9ecffc Mon Sep 17 00:00:00 2001 From: Michel Fedde Date: Sun, 17 Jan 2021 21:13:37 +0100 Subject: [PATCH] 17.01.2021 + WPF-Support + Game Controller System + GameKeybind System + SM_WPF_TEST --- SMCode/SM.Base/Controls/Mouse.cs | 2 +- SMCode/SM.Base/SM.Base.csproj | 26 +++- SMCode/SM.Base/SMRenderer.cs | 2 +- SMCode/SM.Base/Scene/GenericScene.cs | 3 +- SMCode/SM.Base/Time/Stopwatch.cs | 8 +- SMCode/SM.Base/Time/Timer.cs | 11 +- SMCode/SM.Base/Utility/RotationUtility.cs | 2 +- SMCode/SM.Base/Window/Contexts/DrawContext.cs | 4 +- .../SM.Base/Window/Contexts/UpdateContext.cs | 3 + SMCode/SM.Base/Window/GenericWPFWindow.cs | 109 ++++++++++++++++ SMCode/SM.Base/Window/GenericWindow.cs | 102 ++++----------- SMCode/SM.Base/Window/GenericWindowCode.cs | 107 ++++++++++++++++ SMCode/SM.Base/Window/IGenericWindow.cs | 37 ++++++ SMCode/SM.Base/Window/RenderPipeline.cs | 9 +- SMCode/SM.Base/packages.config | 5 +- SMCode/SM.OGL/Framebuffer/Framebuffer.cs | 4 +- .../SM.OGL/Framebuffer/IFramebufferWindow.cs | 8 ++ SMCode/SM.OGL/SM.OGL.csproj | 8 +- SMCode/SM.OGL/packages.config | 2 +- SMCode/SM2D/Controls/Mouse2D.cs | 4 +- SMCode/SM2D/Pipelines/Default2DPipeline.cs | 5 +- SMCode/SM2D/SM2D.csproj | 17 ++- SMCode/SM2D/SM2D.csproj.DotSettings | 3 +- SMCode/SM2D/Shader/Default2DShader.cs | 1 - SMCode/SM2D/Types/Transformation.cs | 2 +- SMCode/SM2D/Window/GLWPFWindow2D.cs | 48 +++++++ SMCode/SM2D/{ => Window}/GLWindow2D.cs | 11 +- SMCode/SM2D/Window/IGLWindow2D.cs | 14 ++ .../SM.Game/Controls/GameController.cs | 39 ++++++ .../SM.Game/Controls/GameControllerState.cs | 57 +++++++++ .../Controls/GameControllerStateButtons.cs | 45 +++++++ .../Controls/GameControllerStateDPad.cs | 28 ++++ .../Controls/GameControllerStateThumbs.cs | 21 +++ .../Controls/GameControllerStateTriggers.cs | 14 ++ SMOptionals/SM.Game/Controls/GameKeybind.cs | 32 +++++ .../SM.Game/Controls/GameKeybindActor.cs | 90 +++++++++++++ .../SM.Game/Controls/GameKeybindContext.cs | 17 +++ .../SM.Game/Controls/GameKeybindHost.cs | 40 ++++++ .../SM.Game/Controls/GameKeybindList.cs | 26 ++++ SMOptionals/SM.Game/OpenTK.dll.config | 25 ++++ .../SM.Game/Properties/AssemblyInfo.cs | 36 ++++++ SMOptionals/SM.Game/SM.Game.csproj | 71 +++++++++++ SMOptionals/SM.Game/packages.config | 6 + SMRendererV3.sln | 15 +++ SM_TEST/Program.cs | 20 +-- SM_TEST/SM_TEST.csproj | 14 +- SM_TEST/packages.config | 4 +- SM_WPF_TEST/App.config | 6 + SM_WPF_TEST/App.xaml | 9 ++ SM_WPF_TEST/App.xaml.cs | 17 +++ SM_WPF_TEST/MainWindow.xaml | 16 +++ SM_WPF_TEST/MainWindow.xaml.cs | 46 +++++++ SM_WPF_TEST/OpenTK.dll.config | 25 ++++ SM_WPF_TEST/Properties/AssemblyInfo.cs | 55 ++++++++ SM_WPF_TEST/Properties/Resources.Designer.cs | 70 ++++++++++ SM_WPF_TEST/Properties/Resources.resx | 117 +++++++++++++++++ SM_WPF_TEST/Properties/Settings.Designer.cs | 29 +++++ SM_WPF_TEST/Properties/Settings.settings | 7 + SM_WPF_TEST/SM_WPF_TEST.csproj | 120 ++++++++++++++++++ SM_WPF_TEST/packages.config | 5 + 60 files changed, 1536 insertions(+), 143 deletions(-) create mode 100644 SMCode/SM.Base/Window/GenericWPFWindow.cs create mode 100644 SMCode/SM.Base/Window/GenericWindowCode.cs create mode 100644 SMCode/SM.Base/Window/IGenericWindow.cs create mode 100644 SMCode/SM.OGL/Framebuffer/IFramebufferWindow.cs create mode 100644 SMCode/SM2D/Window/GLWPFWindow2D.cs rename SMCode/SM2D/{ => Window}/GLWindow2D.cs (79%) create mode 100644 SMCode/SM2D/Window/IGLWindow2D.cs create mode 100644 SMOptionals/SM.Game/Controls/GameController.cs create mode 100644 SMOptionals/SM.Game/Controls/GameControllerState.cs create mode 100644 SMOptionals/SM.Game/Controls/GameControllerStateButtons.cs create mode 100644 SMOptionals/SM.Game/Controls/GameControllerStateDPad.cs create mode 100644 SMOptionals/SM.Game/Controls/GameControllerStateThumbs.cs create mode 100644 SMOptionals/SM.Game/Controls/GameControllerStateTriggers.cs create mode 100644 SMOptionals/SM.Game/Controls/GameKeybind.cs create mode 100644 SMOptionals/SM.Game/Controls/GameKeybindActor.cs create mode 100644 SMOptionals/SM.Game/Controls/GameKeybindContext.cs create mode 100644 SMOptionals/SM.Game/Controls/GameKeybindHost.cs create mode 100644 SMOptionals/SM.Game/Controls/GameKeybindList.cs create mode 100644 SMOptionals/SM.Game/OpenTK.dll.config create mode 100644 SMOptionals/SM.Game/Properties/AssemblyInfo.cs create mode 100644 SMOptionals/SM.Game/SM.Game.csproj create mode 100644 SMOptionals/SM.Game/packages.config create mode 100644 SM_WPF_TEST/App.config create mode 100644 SM_WPF_TEST/App.xaml create mode 100644 SM_WPF_TEST/App.xaml.cs create mode 100644 SM_WPF_TEST/MainWindow.xaml create mode 100644 SM_WPF_TEST/MainWindow.xaml.cs create mode 100644 SM_WPF_TEST/OpenTK.dll.config create mode 100644 SM_WPF_TEST/Properties/AssemblyInfo.cs create mode 100644 SM_WPF_TEST/Properties/Resources.Designer.cs create mode 100644 SM_WPF_TEST/Properties/Resources.resx create mode 100644 SM_WPF_TEST/Properties/Settings.Designer.cs create mode 100644 SM_WPF_TEST/Properties/Settings.settings create mode 100644 SM_WPF_TEST/SM_WPF_TEST.csproj create mode 100644 SM_WPF_TEST/packages.config diff --git a/SMCode/SM.Base/Controls/Mouse.cs b/SMCode/SM.Base/Controls/Mouse.cs index 9491c8e..e06437d 100644 --- a/SMCode/SM.Base/Controls/Mouse.cs +++ b/SMCode/SM.Base/Controls/Mouse.cs @@ -12,7 +12,7 @@ namespace SM.Base.Controls /// /// The type of window this controller is connected to. public class Mouse - where TWindow : GenericWindow + where TWindow : IGenericWindow { /// /// The window it is connected to. diff --git a/SMCode/SM.Base/SM.Base.csproj b/SMCode/SM.Base/SM.Base.csproj index d030961..09a0669 100644 --- a/SMCode/SM.Base/SM.Base.csproj +++ b/SMCode/SM.Base/SM.Base.csproj @@ -34,8 +34,19 @@ latest - - ..\..\packages\OpenTK.3.2.1\lib\net20\OpenTK.dll + + ..\..\packages\OpenTK.GLWpfControl.3.2.3\lib\net452\GLWpfControl.dll + + + ..\..\packages\OpenTK.3.3.1\lib\net20\OpenTK.dll + + + + + ..\..\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll + + + ..\..\packages\SharpDX.XInput.4.2.0\lib\net45\SharpDX.XInput.dll @@ -43,6 +54,8 @@ + + @@ -92,6 +105,9 @@ + + + @@ -112,10 +128,12 @@ - - + + + + \ No newline at end of file diff --git a/SMCode/SM.Base/SMRenderer.cs b/SMCode/SM.Base/SMRenderer.cs index d69a1c7..c1696d5 100644 --- a/SMCode/SM.Base/SMRenderer.cs +++ b/SMCode/SM.Base/SMRenderer.cs @@ -55,6 +55,6 @@ namespace SM.Base /// /// Represents the current active window. /// - public static GenericWindow CurrentWindow { get; internal set; } + public static IGenericWindow CurrentWindow { get; internal set; } } } \ No newline at end of file diff --git a/SMCode/SM.Base/Scene/GenericScene.cs b/SMCode/SM.Base/Scene/GenericScene.cs index 1769e89..5b17a44 100644 --- a/SMCode/SM.Base/Scene/GenericScene.cs +++ b/SMCode/SM.Base/Scene/GenericScene.cs @@ -89,7 +89,7 @@ namespace SM.Base.Scene return (T)ext; } - + /// /// Called, when the user activates the scene. /// @@ -178,7 +178,6 @@ namespace SM.Base.Scene } } - /// public override void Update(UpdateContext context) { diff --git a/SMCode/SM.Base/Time/Stopwatch.cs b/SMCode/SM.Base/Time/Stopwatch.cs index 7212f85..667a100 100644 --- a/SMCode/SM.Base/Time/Stopwatch.cs +++ b/SMCode/SM.Base/Time/Stopwatch.cs @@ -52,6 +52,8 @@ namespace SM.Base.Time /// public TimeSpan ElapsedSpan { get; protected set; } + public event Action Tick; + /// /// Starts the stopwatch. /// @@ -69,10 +71,12 @@ namespace SM.Base.Time /// Performs a tick. /// /// - private protected virtual void Tick(UpdateContext context) + private protected virtual void Ticking(UpdateContext context) { Elapsed += context.Deltatime; ElapsedSpan = TimeSpan.FromSeconds(Elapsed); + + Tick?.Invoke(this, context); } /// @@ -115,7 +119,7 @@ namespace SM.Base.Time for (var i = 0; i < _activeStopwatches.Count; i++) { if (_activeStopwatches[i].Paused) continue; - _activeStopwatches[i].Tick(context); + _activeStopwatches[i].Ticking(context); } } } diff --git a/SMCode/SM.Base/Time/Timer.cs b/SMCode/SM.Base/Time/Timer.cs index 2b973a8..7eec1ca 100644 --- a/SMCode/SM.Base/Time/Timer.cs +++ b/SMCode/SM.Base/Time/Timer.cs @@ -1,6 +1,7 @@ #region usings using System; +using System.Diagnostics.Eventing.Reader; using SM.Base.Contexts; #endregion @@ -43,7 +44,7 @@ namespace SM.Base.Time /// /// The event, that is triggered when the timer stops. /// - public event Action EndAction; + public event Action End; /// public override void Start() @@ -52,9 +53,9 @@ namespace SM.Base.Time Reset(); } - private protected override void Tick(UpdateContext context) + private protected override void Ticking(UpdateContext context) { - base.Tick(context); + base.Ticking(context); ElapsedNormalized = Elapsed / Target; if (ElapsedNormalized >= 1) Stopping(context); @@ -70,12 +71,12 @@ namespace SM.Base.Time } /// - /// This will trigger + /// This will trigger /// /// protected void TriggerEndAction(UpdateContext context) { - EndAction?.Invoke(this, context); + End?.Invoke(this, context); } } } \ No newline at end of file diff --git a/SMCode/SM.Base/Utility/RotationUtility.cs b/SMCode/SM.Base/Utility/RotationUtility.cs index e7523b5..719b779 100644 --- a/SMCode/SM.Base/Utility/RotationUtility.cs +++ b/SMCode/SM.Base/Utility/RotationUtility.cs @@ -18,7 +18,7 @@ namespace SM.Utility /// public static float TurnTowards(Vector2 origin, Vector2 target) { - return MathHelper.RadiansToDegrees((float) Math.Atan2(target.Y - origin.Y, target.X - origin.X)); + return MathHelper.RadiansToDegrees((float) Math.Atan2(origin.X - target.X, target.Y - origin.Y)); } } } \ No newline at end of file diff --git a/SMCode/SM.Base/Window/Contexts/DrawContext.cs b/SMCode/SM.Base/Window/Contexts/DrawContext.cs index a3c42a1..cb449f5 100644 --- a/SMCode/SM.Base/Window/Contexts/DrawContext.cs +++ b/SMCode/SM.Base/Window/Contexts/DrawContext.cs @@ -27,11 +27,11 @@ namespace SM.Base.Contexts public RenderPipeline ActivePipeline; public GenericScene ActiveScene; - public GenericWindow Window; + public IGenericWindow Window; public GenericCamera UsedCamera => - ForceViewport || ActiveScene._camera == null ? Window._viewportCamera : ActiveScene._camera; + ForceViewport || ActiveScene._camera == null ? Window.ViewportCamera : ActiveScene._camera; diff --git a/SMCode/SM.Base/Window/Contexts/UpdateContext.cs b/SMCode/SM.Base/Window/Contexts/UpdateContext.cs index 16a47cc..63eb913 100644 --- a/SMCode/SM.Base/Window/Contexts/UpdateContext.cs +++ b/SMCode/SM.Base/Window/Contexts/UpdateContext.cs @@ -1,6 +1,7 @@ #region usings using OpenTK.Input; +using SM.Base.Scene; #endregion @@ -25,5 +26,7 @@ namespace SM.Base.Contexts /// The current mouse state. /// public MouseState MouseState; + + public GenericScene CurrentScene; } } \ No newline at end of file diff --git a/SMCode/SM.Base/Window/GenericWPFWindow.cs b/SMCode/SM.Base/Window/GenericWPFWindow.cs new file mode 100644 index 0000000..4f18636 --- /dev/null +++ b/SMCode/SM.Base/Window/GenericWPFWindow.cs @@ -0,0 +1,109 @@ +using System; +using System.Drawing; +using System.Windows; +using System.Windows.Media; +using OpenTK; +using OpenTK.Wpf; +using SM.Base.Scene; +using SM.OGL; + +namespace SM.Base +{ + public class GenericWPFWindow : OpenTK.Wpf.GLWpfControl, IGenericWindow + { + private bool _renderContinuesly; + + protected GenericCamera _viewportCamera; + + public bool Loading => !base.IsInitialized; + public float Aspect { get; set; } + public GenericCamera ViewportCamera => _viewportCamera; + public bool ForceViewportCamera { get; set; } + public int Width => (int) base.ActualWidth; + public int Height => (int) base.ActualHeight; + public Rectangle ClientRectangle => new Rectangle((int)base.RenderTransformOrigin.X, (int)RenderTransformOrigin.Y, Width, Height); + public Vector2 WorldScale { get; set; } + + public GenericWPFWindow(bool renderContinuesly = false) + { + _renderContinuesly = renderContinuesly; + + Ready += Init; + Render += Rendering; + } + + protected virtual void Init() + { + GenericWindowCode.Load(this); + } + + protected virtual void Rendering(TimeSpan delta) + { + + } + + protected override void OnRenderSizeChanged(SizeChangedInfo info) + { + base.OnRenderSizeChanged(info); + + GenericWindowCode.Resize(this); + } + + public void Start() + { + GLWpfControlSettings settings = new GLWpfControlSettings() + { + MajorVersion = GLSettings.ForcedVersion.MajorVersion, + MinorVersion = GLSettings.ForcedVersion.MinorVersion, + RenderContinuously = _renderContinuesly + }; + base.Start(settings); + } + + public virtual void SetWorldScale() + { } + } + + public class GenericWPFWindow : GenericWPFWindow, IGenericWindow + where TScene : GenericScene, new() + where TCamera : GenericCamera, new() + { + private TScene _scene; + private RenderPipeline _renderPipeline; + + public TScene CurrentScene => _scene; + public RenderPipeline RenderPipeline => _renderPipeline; + + public GenericWPFWindow(bool renderContinuesly = false) : base(renderContinuesly) + { + _viewportCamera = new TCamera(); + } + + protected override void Rendering(TimeSpan delta) + { + base.Rendering(delta); + + GenericWindowCode.Render(this, (float)delta.TotalSeconds); + } + + protected override void OnRenderSizeChanged(SizeChangedInfo info) + { + base.OnRenderSizeChanged(info); + + GenericWindowCode.Resize(this); + } + + public void SetScene(TScene scene) + { + _scene = scene; + scene.Activate(); + RenderPipeline.SceneChanged(scene); + } + + public void SetRenderPipeline(RenderPipeline renderPipeline) + { + _renderPipeline = renderPipeline; + renderPipeline.Activate(this); + } + } +} \ No newline at end of file diff --git a/SMCode/SM.Base/Window/GenericWindow.cs b/SMCode/SM.Base/Window/GenericWindow.cs index 0a4cb36..cb6a887 100644 --- a/SMCode/SM.Base/Window/GenericWindow.cs +++ b/SMCode/SM.Base/Window/GenericWindow.cs @@ -26,20 +26,24 @@ namespace SM.Base /// /// The base window. /// - public abstract class GenericWindow : GameWindow + public abstract class GenericWindow : GameWindow, IGenericWindow { + protected GenericCamera _viewportCamera; + internal bool _loading = true; internal List _actionsAfterLoading = new List(); + public bool Loading => _loading; + /// /// This tells you the current world scale. /// - protected Vector2 _worldScale = Vector2.Zero; + public Vector2 WorldScale { get; set; } = Vector2.Zero; /// /// This tells you the current aspect ratio of this window. /// - public float Aspect { get; private set; } + public float Aspect { get; set; } /// /// If false, the window will not react on updates and will not render something. @@ -49,7 +53,8 @@ namespace SM.Base /// public bool ReactWhileUnfocused = false; - internal GenericCamera _viewportCamera; + public GenericCamera ViewportCamera => _viewportCamera; + public bool ForceViewportCamera { get; set; } /// protected GenericWindow() : this(1280, 720, "Generic OGL Title", GameWindowFlags.Default) @@ -70,33 +75,7 @@ namespace SM.Base /// protected override void OnLoad(EventArgs e) { - SMRenderer.CurrentWindow = this; - - GLSystem.INIT_SYSTEM(); - GLSettings.ShaderPreProcessing = true; - - var args = Environment.GetCommandLineArgs(); - if (args.Contains("--advDebugging")) - { - SMRenderer.AdvancedDebugging = true; - GLSettings.InfoEveryUniform = true; - } - - Log.Init(); - - Log.Write("#", ConsoleColor.Cyan, "----------------------", - "--- OpenGL Loading ---", - "----------------------------------", - $"--- {"DeviceVersion",14}: {GLSystem.DeviceVersion,-10} ---", - $"--- {"ForcedVersion",14}: {GLSettings.ForcedVersion,-10} ---", - $"--- {"ShadingVersion",14}: {GLSystem.ShadingVersion,-10} ---", - $"--- {"Debugging",14}: {GLSystem.Debugging,-10} ---", - $"--- {"AdvDebugging",14}: {SMRenderer.AdvancedDebugging,-10} ---", - "----------------------------------"); - - if (SMRenderer.AdvancedDebugging) Log.Write("Extension", ConsoleColor.DarkCyan, GLSystem.Extensions); - - ExtensionManager.InitExtensions(); + GenericWindowCode.Load(this); base.OnLoad(e); } @@ -106,17 +85,14 @@ namespace SM.Base { base.OnResize(e); - Aspect = (float) Width / Height; - _worldScale = new Vector2(Width, Height); - SetWorldScale(); - GL.Viewport(ClientRectangle); + GenericWindowCode.Resize(this); if (_loading) { _loading = false; OnLoaded(); - + _actionsAfterLoading.ForEach(a => a()); _actionsAfterLoading = null; } @@ -132,7 +108,7 @@ namespace SM.Base /// /// Sets the world scale. /// - protected virtual void SetWorldScale() + public virtual void SetWorldScale() { } @@ -218,10 +194,13 @@ namespace SM.Base /// /// The scene type /// The camera type - public abstract class GenericWindow : GenericWindow + public abstract class GenericWindow : GenericWindow, IGenericWindow where TScene : GenericScene, new() where TCamera : GenericCamera, new() { + private RenderPipeline _renderPipeline; + private TScene _scene; + /// protected GenericWindow() { @@ -244,17 +223,18 @@ namespace SM.Base /// /// The current scene. /// - public TScene CurrentScene { get; private set; } + public TScene CurrentScene => _scene; /// /// Controls how a scene is rendered. /// - public RenderPipeline RenderPipeline { get; private set; } + public RenderPipeline RenderPipeline => _renderPipeline; /// protected override void Update(FrameEventArgs e, ref UpdateContext context) { base.Update(e, ref context); + context.CurrentScene = CurrentScene; CurrentScene?.Update(context); } @@ -263,37 +243,9 @@ namespace SM.Base { if (!ReactWhileUnfocused && !Focused) return; - if (CurrentScene == null) return; - - SMRenderer.CurrentFrame++; - - Deltatime.RenderDelta = (float) e.Time; - var drawContext = new DrawContext - { - ForceViewport = ForceViewportCamera, - ActiveScene = CurrentScene, - Window = this, - - Instances = new[] - { - new Instance - {ModelMatrix = Matrix4.Identity, TexturePosition = Vector2.Zero, TextureScale = Vector2.One} - }, - Mesh = Plate.Object, - - WorldScale = _worldScale, - LastPassthough = this, - - ShaderArguments = new Dictionary(), - - World = ViewportCamera.World, - View = ViewportCamera.CalculateViewMatrix(), - ModelMaster = Matrix4.Identity - }; - base.OnRenderFrame(e); - RenderPipeline.Render(ref drawContext); + GenericWindowCode.Render(this, (float)e.Time); SwapBuffers(); @@ -305,13 +257,7 @@ namespace SM.Base { base.OnResize(e); - ViewportCamera.RecalculateWorld(_worldScale, Aspect); - RenderPipeline.Resize(); - - PostProcessEffect.Model = Matrix4.CreateScale(_worldScale.X, -_worldScale.Y, 1); - PostProcessEffect.Mvp = PostProcessEffect.Model * - Matrix4.LookAt(0, 0, 1, 0, 0, 0, 0, 1, 0) * - GenericCamera.OrthographicWorld; + GenericWindowCode.Resize(this); } /// @@ -326,7 +272,7 @@ namespace SM.Base return; } - CurrentScene = scene; + _scene = scene; scene.Activate(); RenderPipeline.SceneChanged(scene); } @@ -343,7 +289,7 @@ namespace SM.Base return; } - RenderPipeline = pipeline; + _renderPipeline = pipeline; pipeline.Activate(this); } } diff --git a/SMCode/SM.Base/Window/GenericWindowCode.cs b/SMCode/SM.Base/Window/GenericWindowCode.cs new file mode 100644 index 0000000..4750d85 --- /dev/null +++ b/SMCode/SM.Base/Window/GenericWindowCode.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using OpenTK; +using OpenTK.Graphics.OpenGL4; +using SM.Base.Contexts; +using SM.Base.Drawing; +using SM.Base.Objects.Static; +using SM.Base.PostProcess; +using SM.Base.Scene; +using SM.Base.ShaderExtension; +using SM.OGL; +using SM.Utility; + +namespace SM.Base +{ + public class GenericWindowCode + { + internal static void Load(IGenericWindow window) + { + SMRenderer.CurrentWindow = window; + + GLSystem.INIT_SYSTEM(); + GLSettings.ShaderPreProcessing = true; + + var args = Environment.GetCommandLineArgs(); + if (args.Contains("--advDebugging")) + { + SMRenderer.AdvancedDebugging = true; + GLSettings.InfoEveryUniform = true; + } + + Log.Init(); + + Log.Write("#", ConsoleColor.Cyan, "----------------------", + "--- OpenGL Loading ---", + "----------------------------------", + $"--- {"DeviceVersion",14}: {GLSystem.DeviceVersion,-10} ---", + $"--- {"ForcedVersion",14}: {GLSettings.ForcedVersion,-10} ---", + $"--- {"ShadingVersion",14}: {GLSystem.ShadingVersion,-10} ---", + $"--- {"Debugging",14}: {GLSystem.Debugging,-10} ---", + $"--- {"AdvDebugging",14}: {SMRenderer.AdvancedDebugging,-10} ---", + "----------------------------------"); + + if (SMRenderer.AdvancedDebugging) Log.Write("Extension", ConsoleColor.DarkCyan, GLSystem.Extensions); + + ExtensionManager.InitExtensions(); + } + + internal static void Resize(IGenericWindow window) + { + window.Aspect = (float) window.Width / window.Height; + window.WorldScale = new Vector2(window.Width, window.Height); + window.SetWorldScale(); + GL.Viewport(window.ClientRectangle); + } + + internal static void Resize(IGenericWindow window) + where TScene : GenericScene, new() + where TCamera : GenericCamera, new() + { + window.ViewportCamera.RecalculateWorld(window.WorldScale, window.Aspect); + window.RenderPipeline.Resize(); + + PostProcessEffect.Model = Matrix4.CreateScale(window.WorldScale.X, -window.WorldScale.Y, 1); + PostProcessEffect.Mvp = PostProcessEffect.Model * + Matrix4.LookAt(0, 0, 1, 0, 0, 0, 0, 1, 0) * + GenericCamera.OrthographicWorld; + } + + internal static void Render(IGenericWindow window, float deltatime) + where TScene : GenericScene, new() + where TCamera : GenericCamera, new() + { + if (window.CurrentScene == null) return; + + SMRenderer.CurrentFrame++; + + Deltatime.RenderDelta = deltatime; + var drawContext = new DrawContext + { + ForceViewport = window.ForceViewportCamera, + ActiveScene = window.CurrentScene, + Window = window, + + Instances = new[] + { + new Instance + {ModelMatrix = Matrix4.Identity, TexturePosition = Vector2.Zero, TextureScale = Vector2.One} + }, + Mesh = Plate.Object, + + WorldScale = window.WorldScale, + LastPassthough = window, + + ShaderArguments = new Dictionary(), + + World = window.ViewportCamera.World, + View = window.ViewportCamera.CalculateViewMatrix(), + ModelMaster = Matrix4.Identity + }; + + + window.RenderPipeline?.Render(ref drawContext); + } + } +} \ No newline at end of file diff --git a/SMCode/SM.Base/Window/IGenericWindow.cs b/SMCode/SM.Base/Window/IGenericWindow.cs new file mode 100644 index 0000000..bc93341 --- /dev/null +++ b/SMCode/SM.Base/Window/IGenericWindow.cs @@ -0,0 +1,37 @@ +using System.Drawing; +using System.Windows; +using OpenTK; +using SM.Base.Scene; +using SM.OGL.Framebuffer; + +namespace SM.Base +{ + public interface IGenericWindow : IFramebufferWindow + { + bool Loading { get; } + float Aspect { get; set; } + + GenericCamera ViewportCamera { get; } + bool ForceViewportCamera { get; set; } + + int Width { get; } + int Height { get; } + + Rectangle ClientRectangle { get; } + Vector2 WorldScale { get; set; } + + void SetWorldScale(); + } + + public interface IGenericWindow : IGenericWindow + where TScene : GenericScene, new() + where TCamera : GenericCamera, new() + { + TScene CurrentScene { get; } + + RenderPipeline RenderPipeline { get; } + + void SetScene(TScene scene); + void SetRenderPipeline(RenderPipeline renderPipeline); + } +} \ No newline at end of file diff --git a/SMCode/SM.Base/Window/RenderPipeline.cs b/SMCode/SM.Base/Window/RenderPipeline.cs index c24a8db..689511a 100644 --- a/SMCode/SM.Base/Window/RenderPipeline.cs +++ b/SMCode/SM.Base/Window/RenderPipeline.cs @@ -24,7 +24,7 @@ namespace SM.Base /// /// The window the pipeline is connected to. /// - protected GenericWindow _window { get; private set; } + protected IGenericWindow _window { get; private set; } /// /// The framebuffers, that are used in this Pipeline. @@ -63,7 +63,7 @@ namespace SM.Base } } - internal void Activate(GenericWindow window) + internal void Activate(IGenericWindow window) { _window = window; @@ -85,7 +85,7 @@ namespace SM.Base /// /// Occurs, when the pipeline was connected to a window. /// - protected internal virtual void Activation(GenericWindow window) + protected internal virtual void Activation(IGenericWindow window) { } @@ -94,7 +94,7 @@ namespace SM.Base /// Occurs, when the pipeline was connected to a window the first time. /// /// - protected internal virtual void Initialization(GenericWindow window) + protected internal virtual void Initialization(IGenericWindow window) { } @@ -131,6 +131,7 @@ namespace SM.Base internal void Render(ref DrawContext context) { context.ActivePipeline = this; + if (context.ActiveScene == null) return; RenderProcess(ref context, (TScene)context.ActiveScene); } diff --git a/SMCode/SM.Base/packages.config b/SMCode/SM.Base/packages.config index 9a4debe..87df345 100644 --- a/SMCode/SM.Base/packages.config +++ b/SMCode/SM.Base/packages.config @@ -1,4 +1,7 @@  - + + + + \ No newline at end of file diff --git a/SMCode/SM.OGL/Framebuffer/Framebuffer.cs b/SMCode/SM.OGL/Framebuffer/Framebuffer.cs index ca5610f..e2f387d 100644 --- a/SMCode/SM.OGL/Framebuffer/Framebuffer.cs +++ b/SMCode/SM.OGL/Framebuffer/Framebuffer.cs @@ -25,7 +25,7 @@ namespace SM.OGL.Framebuffer private bool _canBeCompiled = true; - private INativeWindow _window; + private IFramebufferWindow _window; private float _windowScale; /// @@ -40,7 +40,7 @@ namespace SM.OGL.Framebuffer /// /// /// - public Framebuffer(INativeWindow window, float scale = 1) : this(new Vector2(window.Width * scale, + public Framebuffer(IFramebufferWindow window, float scale = 1) : this(new Vector2(window.Width * scale, window.Height * scale)) { _window = window; diff --git a/SMCode/SM.OGL/Framebuffer/IFramebufferWindow.cs b/SMCode/SM.OGL/Framebuffer/IFramebufferWindow.cs new file mode 100644 index 0000000..43ce0b5 --- /dev/null +++ b/SMCode/SM.OGL/Framebuffer/IFramebufferWindow.cs @@ -0,0 +1,8 @@ +namespace SM.OGL.Framebuffer +{ + public interface IFramebufferWindow + { + int Width { get; } + int Height { get; } + } +} \ No newline at end of file diff --git a/SMCode/SM.OGL/SM.OGL.csproj b/SMCode/SM.OGL/SM.OGL.csproj index 7a25b52..e731e18 100644 --- a/SMCode/SM.OGL/SM.OGL.csproj +++ b/SMCode/SM.OGL/SM.OGL.csproj @@ -34,8 +34,8 @@ latest - - ..\..\packages\OpenTK.3.2.1\lib\net20\OpenTK.dll + + ..\..\packages\OpenTK.3.3.1\lib\net20\OpenTK.dll @@ -43,6 +43,7 @@ + @@ -71,5 +72,8 @@ + + + \ No newline at end of file diff --git a/SMCode/SM.OGL/packages.config b/SMCode/SM.OGL/packages.config index 9a4debe..82cdaeb 100644 --- a/SMCode/SM.OGL/packages.config +++ b/SMCode/SM.OGL/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/SMCode/SM2D/Controls/Mouse2D.cs b/SMCode/SM2D/Controls/Mouse2D.cs index 0385dcf..3fae862 100644 --- a/SMCode/SM2D/Controls/Mouse2D.cs +++ b/SMCode/SM2D/Controls/Mouse2D.cs @@ -10,9 +10,9 @@ using SM2D.Types; namespace SM2D.Controls { - public class Mouse2D : Mouse + public class Mouse2D : Mouse { - protected internal Mouse2D(GLWindow2D window) : base(window) + protected internal Mouse2D(IGLWindow2D window) : base(window) { } diff --git a/SMCode/SM2D/Pipelines/Default2DPipeline.cs b/SMCode/SM2D/Pipelines/Default2DPipeline.cs index e4aced1..ae21000 100644 --- a/SMCode/SM2D/Pipelines/Default2DPipeline.cs +++ b/SMCode/SM2D/Pipelines/Default2DPipeline.cs @@ -22,7 +22,7 @@ namespace SM2D.Pipelines } - protected override void Initialization(GenericWindow window) + protected override void Initialization(IGenericWindow window) { MainFramebuffer = CreateWindowFramebuffer(); } @@ -31,13 +31,10 @@ namespace SM2D.Pipelines { if (scene != null) { - MainFramebuffer.Activate(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); scene.DrawBackground(context); scene.DrawMainObjects(context); - Framebuffer.Screen.Activate(); - scene.DrawHUD(context); scene.DrawDebug(context); } diff --git a/SMCode/SM2D/SM2D.csproj b/SMCode/SM2D/SM2D.csproj index c54202c..0e33453 100644 --- a/SMCode/SM2D/SM2D.csproj +++ b/SMCode/SM2D/SM2D.csproj @@ -31,12 +31,13 @@ 4 - - ..\..\packages\OpenTK.3.2.1\lib\net20\OpenTK.dll - + + + + @@ -44,7 +45,8 @@ - + + @@ -58,6 +60,7 @@ + @@ -74,11 +77,15 @@ - 3.2.1 + 3.3.1 + + + 3.2.3 + \ No newline at end of file diff --git a/SMCode/SM2D/SM2D.csproj.DotSettings b/SMCode/SM2D/SM2D.csproj.DotSettings index 4613214..c1524cb 100644 --- a/SMCode/SM2D/SM2D.csproj.DotSettings +++ b/SMCode/SM2D/SM2D.csproj.DotSettings @@ -1,2 +1,3 @@  - True \ No newline at end of file + True + True \ No newline at end of file diff --git a/SMCode/SM2D/Shader/Default2DShader.cs b/SMCode/SM2D/Shader/Default2DShader.cs index 3a54736..7038ca6 100644 --- a/SMCode/SM2D/Shader/Default2DShader.cs +++ b/SMCode/SM2D/Shader/Default2DShader.cs @@ -18,7 +18,6 @@ namespace SM2D.Shader private Default2DShader() : base(AssemblyUtility.ReadAssemblyFile("SM2D.Shader.ShaderFiles.default.glsl")) { - Load(); } protected override void DrawProcess(DrawContext context) diff --git a/SMCode/SM2D/Types/Transformation.cs b/SMCode/SM2D/Types/Transformation.cs index a603073..d75f00a 100644 --- a/SMCode/SM2D/Types/Transformation.cs +++ b/SMCode/SM2D/Types/Transformation.cs @@ -36,7 +36,7 @@ namespace SM2D.Types { if (_modelMatrix.Determinant < 0.0001) return new Vector2(0); - var vec = Vector3.TransformNormal(Vector3.UnitX, _modelMatrix); + var vec = Vector3.TransformNormal(Vector3.UnitY, _modelMatrix); vec.Normalize(); return vec.Xy; } diff --git a/SMCode/SM2D/Window/GLWPFWindow2D.cs b/SMCode/SM2D/Window/GLWPFWindow2D.cs new file mode 100644 index 0000000..5bc3654 --- /dev/null +++ b/SMCode/SM2D/Window/GLWPFWindow2D.cs @@ -0,0 +1,48 @@ +using System; +using System.Windows.Media; +using OpenTK; +using OpenTK.Graphics.ES11; +using SM.Base; +using SM2D.Controls; +using SM2D.Pipelines; +using SM2D.Scene; +using SM2D.Shader; + +namespace SM2D +{ + public class GLWPFWindow2D : GenericWPFWindow, IGLWindow2D + { + public GLWPFWindow2D() + { + Mouse = new Mouse2D(this); + } + + public Vector2? Scaling { get; set; } + public Mouse2D Mouse { get; } + + protected override void Init() + { + base.Init(); + + SMRenderer.DefaultMaterialShader = Default2DShader.MaterialShader; + + SetRenderPipeline(Default2DPipeline.Pipeline); + } + + protected override void Rendering(TimeSpan delta) + { + GL.Disable(EnableCap.DepthTest); + base.Rendering(delta); + } + + public override void SetWorldScale() + { + if (Scaling.HasValue) + { + if (Scaling.Value.X > 0 && Scaling.Value.Y > 0) WorldScale = Scaling.Value; + else if (Scaling.Value.X > 0) WorldScale = new Vector2(Scaling.Value.X, Scaling.Value.X / Aspect); + else if (Scaling.Value.Y > 0) WorldScale = new Vector2(Aspect * Scaling.Value.Y, Scaling.Value.Y); + } + } + } +} \ No newline at end of file diff --git a/SMCode/SM2D/GLWindow2D.cs b/SMCode/SM2D/Window/GLWindow2D.cs similarity index 79% rename from SMCode/SM2D/GLWindow2D.cs rename to SMCode/SM2D/Window/GLWindow2D.cs index 6f18668..dc3924d 100644 --- a/SMCode/SM2D/GLWindow2D.cs +++ b/SMCode/SM2D/Window/GLWindow2D.cs @@ -14,7 +14,7 @@ using SM2D.Shader; namespace SM2D { - public class GLWindow2D : GenericWindow + public class GLWindow2D : GenericWindow, IGLWindow2D { public GLWindow2D() { @@ -22,7 +22,6 @@ namespace SM2D } public Vector2? Scaling { get; set; } - public Vector2 WorldScale => _worldScale; public Mouse2D Mouse { get; } @@ -47,13 +46,13 @@ namespace SM2D base.OnRenderFrame(e); } - protected override void SetWorldScale() + public override void SetWorldScale() { if (Scaling.HasValue) { - if (Scaling.Value.X > 0 && Scaling.Value.Y > 0) _worldScale = Scaling.Value; - else if (Scaling.Value.X > 0) _worldScale = new Vector2(Scaling.Value.X, Scaling.Value.X / Aspect); - else if (Scaling.Value.Y > 0) _worldScale = new Vector2(Aspect * Scaling.Value.Y, Scaling.Value.Y); + if (Scaling.Value.X > 0 && Scaling.Value.Y > 0) WorldScale = Scaling.Value; + else if (Scaling.Value.X > 0) WorldScale = new Vector2(Scaling.Value.X, Scaling.Value.X / Aspect); + else if (Scaling.Value.Y > 0) WorldScale = new Vector2(Aspect * Scaling.Value.Y, Scaling.Value.Y); } } diff --git a/SMCode/SM2D/Window/IGLWindow2D.cs b/SMCode/SM2D/Window/IGLWindow2D.cs new file mode 100644 index 0000000..1d783e3 --- /dev/null +++ b/SMCode/SM2D/Window/IGLWindow2D.cs @@ -0,0 +1,14 @@ +using OpenTK; +using SM.Base; +using SM2D.Controls; +using SM2D.Scene; + +namespace SM2D +{ + public interface IGLWindow2D : IGenericWindow + { + Vector2? Scaling { get; set; } + + Mouse2D Mouse { get; } + } +} \ No newline at end of file diff --git a/SMOptionals/SM.Game/Controls/GameController.cs b/SMOptionals/SM.Game/Controls/GameController.cs new file mode 100644 index 0000000..65f41dd --- /dev/null +++ b/SMOptionals/SM.Game/Controls/GameController.cs @@ -0,0 +1,39 @@ +using SharpDX.XInput; + +namespace SM.Game.Controls +{ + public struct GameController + { + public static float GlobalDeadband = 2500; + + private Controller _controller; + + public float Deadband { get; set; } + public bool IsConnected => _controller.IsConnected; + + public UserIndex Index { get; private set; } + + public GameController(int id) : this((UserIndex)id) + {} + + public GameController(UserIndex index = UserIndex.Any) + { + _controller = new Controller(index); + Index = index; + Deadband = GlobalDeadband; + } + + public GameControllerState GetState() + { + if (!IsConnected) + { + return new GameControllerState(true); + } + + Gamepad state = _controller.GetState().Gamepad; + + return new GameControllerState(state, ref this); + } + + } +} \ No newline at end of file diff --git a/SMOptionals/SM.Game/Controls/GameControllerState.cs b/SMOptionals/SM.Game/Controls/GameControllerState.cs new file mode 100644 index 0000000..414a2ae --- /dev/null +++ b/SMOptionals/SM.Game/Controls/GameControllerState.cs @@ -0,0 +1,57 @@ +using System; +using OpenTK; +using SharpDX.XInput; + +namespace SM.Game.Controls +{ + public struct GameControllerState + { + public GameControllerStateThumbs Thumbs; + public GameControllerStateTriggers Triggers; + public GameControllerStateDPad DPad; + public GameControllerStateButtons Buttons; + + public bool FromConnected { get; } + + internal GameControllerState(bool empty) + { + FromConnected = false; + + Thumbs = GameControllerStateThumbs.Default; + Triggers = GameControllerStateTriggers.Default; + DPad = GameControllerStateDPad.Default; + Buttons = GameControllerStateButtons.Default; + } + internal GameControllerState(Gamepad state, ref GameController controller) + { + FromConnected = true; + + Thumbs = new GameControllerStateThumbs + { + Left = new Vector2( + Math.Abs((float)state.LeftThumbX) < controller.Deadband ? 0 : (float)state.LeftThumbX / short.MaxValue, + Math.Abs((float)state.LeftThumbY) < controller.Deadband ? 0 : (float)state.LeftThumbY / short.MaxValue), + Right = new Vector2( + Math.Abs((float)state.RightThumbX) < controller.Deadband ? 0 : (float)state.RightThumbX / short.MaxValue, + Math.Abs((float)state.RightThumbY) < controller.Deadband ? 0 : (float)state.RightThumbY / short.MaxValue), + + PressedLeft = state.Buttons.HasFlag(GamepadButtonFlags.LeftThumb), + PressedRight = state.Buttons.HasFlag(GamepadButtonFlags.RightThumb) + }; + + Triggers = new GameControllerStateTriggers() + { + Left = (float)state.LeftTrigger / byte.MaxValue, + Right = (float)state.RightTrigger / byte.MaxValue + }; + + DPad = new GameControllerStateDPad(state.Buttons); + Buttons = new GameControllerStateButtons(state.Buttons); + } + + public override string ToString() + { + return !FromConnected ? "[From a disconnected controller]" : $"Thumbs: [{Thumbs}]; Trigger: [{Triggers}]; DPad: [{DPad}]; Buttons: [{Buttons}]"; + } + } +} \ No newline at end of file diff --git a/SMOptionals/SM.Game/Controls/GameControllerStateButtons.cs b/SMOptionals/SM.Game/Controls/GameControllerStateButtons.cs new file mode 100644 index 0000000..57aca8c --- /dev/null +++ b/SMOptionals/SM.Game/Controls/GameControllerStateButtons.cs @@ -0,0 +1,45 @@ +using SharpDX.XInput; + +namespace SM.Game.Controls +{ + public struct GameControllerStateButtons + { + public static GameControllerStateButtons Default = new GameControllerStateButtons(GamepadButtonFlags.None); + + private GamepadButtonFlags _buttonFlags; + + public bool X; + public bool Y; + public bool A; + public bool B; + + public bool LB; + public bool RB; + + public bool LeftThumb; + public bool RightThumb; + + public bool this[GamepadButtonFlags flags] => _buttonFlags.HasFlag(flags); + + internal GameControllerStateButtons(GamepadButtonFlags flags) + { + _buttonFlags = flags; + + X = flags.HasFlag(GamepadButtonFlags.X); + Y = flags.HasFlag(GamepadButtonFlags.Y); + A = flags.HasFlag(GamepadButtonFlags.A); + B = flags.HasFlag(GamepadButtonFlags.B); + + LB = flags.HasFlag(GamepadButtonFlags.LeftShoulder); + RB = flags.HasFlag(GamepadButtonFlags.RightShoulder); + + LeftThumb = flags.HasFlag(GamepadButtonFlags.LeftThumb); + RightThumb = flags.HasFlag(GamepadButtonFlags.RightThumb); + } + + public override string ToString() + { + return $"X: {(X ? "1" : "0")}; Y: {(Y ? "1" : "0")}; A: {(A ? "1" : "0")}; B: {(B ? "1" : "0")}; LB: {(LB ? "1" : "0")}; RB: {(RB ? "1" : "0")}; LT: {(LeftThumb ? "1" : "0")}; RT: {(RightThumb ? "1" : "0")}"; + } + } +} \ No newline at end of file diff --git a/SMOptionals/SM.Game/Controls/GameControllerStateDPad.cs b/SMOptionals/SM.Game/Controls/GameControllerStateDPad.cs new file mode 100644 index 0000000..5385e60 --- /dev/null +++ b/SMOptionals/SM.Game/Controls/GameControllerStateDPad.cs @@ -0,0 +1,28 @@ +using SharpDX.XInput; + +namespace SM.Game.Controls +{ + public struct GameControllerStateDPad + { + public static GameControllerStateDPad Default = new GameControllerStateDPad(GamepadButtonFlags.None); + + public bool Up; + public bool Down; + public bool Left; + public bool Right; + + internal GameControllerStateDPad(GamepadButtonFlags flags) + { + Up = flags.HasFlag(GamepadButtonFlags.DPadUp); + Down = flags.HasFlag(GamepadButtonFlags.DPadDown); + Left = flags.HasFlag(GamepadButtonFlags.DPadLeft); + Right = flags.HasFlag(GamepadButtonFlags.DPadRight); + } + + public override string ToString() + { + return + $"Up: {(Up ? "1" : "0")}; Down: {(Down ? "1" : "0")}; Left: {(Left ? "1" : "0")}; Right: {(Right ? "1" : "0")};"; + } + } +} \ No newline at end of file diff --git a/SMOptionals/SM.Game/Controls/GameControllerStateThumbs.cs b/SMOptionals/SM.Game/Controls/GameControllerStateThumbs.cs new file mode 100644 index 0000000..1d4eefd --- /dev/null +++ b/SMOptionals/SM.Game/Controls/GameControllerStateThumbs.cs @@ -0,0 +1,21 @@ +using OpenTK; + +namespace SM.Game.Controls +{ + public struct GameControllerStateThumbs + { + public static GameControllerStateThumbs Default = new GameControllerStateThumbs() + {Left = Vector2.Zero, Right = Vector2.Zero}; + + public Vector2 Left; + public Vector2 Right; + + public bool PressedLeft; + public bool PressedRight; + + public override string ToString() + { + return $"Left: ({Left.X}; {Left.Y}){(PressedLeft ? " Pressed" : "")}; Right: ({Right.X}; {Right.Y}){(PressedRight ? " Pressed" : "")}"; + } + } +} \ No newline at end of file diff --git a/SMOptionals/SM.Game/Controls/GameControllerStateTriggers.cs b/SMOptionals/SM.Game/Controls/GameControllerStateTriggers.cs new file mode 100644 index 0000000..3c99852 --- /dev/null +++ b/SMOptionals/SM.Game/Controls/GameControllerStateTriggers.cs @@ -0,0 +1,14 @@ +namespace SM.Game.Controls +{ + public struct GameControllerStateTriggers + { + public static GameControllerStateTriggers Default = new GameControllerStateTriggers {Left = 0f, Right = 0f}; + + public float Left; + public float Right; + public override string ToString() + { + return $"Left: {Left}; Right: {Right}"; + } + } +} \ No newline at end of file diff --git a/SMOptionals/SM.Game/Controls/GameKeybind.cs b/SMOptionals/SM.Game/Controls/GameKeybind.cs new file mode 100644 index 0000000..1b82c63 --- /dev/null +++ b/SMOptionals/SM.Game/Controls/GameKeybind.cs @@ -0,0 +1,32 @@ +using System; +using OpenTK.Input; + +namespace SM.Game.Controls +{ + public class GameKeybind + { + public Func Keyboard; + public Func Controller; + public Func AI; + + public Func this[GameKeybindActorType type] + { + get + { + switch (type) + { + case GameKeybindActorType.AI: + return AI; + case GameKeybindActorType.Keyboard: + return Keyboard; + break; + case GameKeybindActorType.Controller: + return Controller; + break; + default: + throw new ArgumentOutOfRangeException(nameof(type), type, null); + } + } + } + } +} \ No newline at end of file diff --git a/SMOptionals/SM.Game/Controls/GameKeybindActor.cs b/SMOptionals/SM.Game/Controls/GameKeybindActor.cs new file mode 100644 index 0000000..1f56234 --- /dev/null +++ b/SMOptionals/SM.Game/Controls/GameKeybindActor.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using OpenTK.Input; + +namespace SM.Game.Controls +{ + public enum GameKeybindActorType + { + AI, + Keyboard, + Controller + } + + public struct GameKeybindActor + { + private GameKeybindActorType _type; + private GameController? _controller; + + private GameKeybindHost _keybindHost; + + public GameKeybindActorType Type => _type; + public GameController? Controller => _controller; + + public object[] Parameter; + + private GameKeybindActor(GameKeybindActorType type, GameController? controller) + { + _type = type; + _controller = controller; + + _keybindHost = null; + + Parameter = new object[0]; + } + + public void ConnectHost(GameKeybindHost host) + { + _keybindHost = host; + } + + public ReturnType Get(string name, params object[] param) + { + return (ReturnType) Get(name, param); + } + + public object Get(string name, params object[] objects) + { + if (_keybindHost == null) return null; + if (!_keybindHost._actions.ContainsKey(name)) return null; + + GameKeybind keybind = _keybindHost._actions[name]; + + GameKeybindContext context = new GameKeybindContext() + { + Actor = this, + Host = _keybindHost, + + ActorParameter = Parameter, + InstanceParameter = objects, + + KeyboardState = Keyboard.GetState(), + MouseState = Mouse.GetState(), + ControllerState = Controller?.GetState(), + }; + + return keybind[Type].Invoke(context); + } + + public static GameKeybindActor CreateAIActor() + { + return new GameKeybindActor(GameKeybindActorType.AI, null); + } + + public static GameKeybindActor CreateKeyboardActor() + { + return new GameKeybindActor(GameKeybindActorType.Keyboard, null); + } + + public static GameKeybindActor CreateControllerActor(int id) + { + return CreateControllerActor(new GameController(id)); + } + + public static GameKeybindActor CreateControllerActor(GameController controller) + { + return new GameKeybindActor(GameKeybindActorType.Controller, controller); + } + + } +} \ No newline at end of file diff --git a/SMOptionals/SM.Game/Controls/GameKeybindContext.cs b/SMOptionals/SM.Game/Controls/GameKeybindContext.cs new file mode 100644 index 0000000..08b6cb4 --- /dev/null +++ b/SMOptionals/SM.Game/Controls/GameKeybindContext.cs @@ -0,0 +1,17 @@ +using OpenTK.Input; + +namespace SM.Game.Controls +{ + public struct GameKeybindContext + { + public KeyboardState KeyboardState; + public MouseState MouseState; + public GameControllerState? ControllerState; + + public GameKeybindActor Actor; + public GameKeybindHost Host; + + public object[] InstanceParameter; + public object[] ActorParameter; + } +} \ No newline at end of file diff --git a/SMOptionals/SM.Game/Controls/GameKeybindHost.cs b/SMOptionals/SM.Game/Controls/GameKeybindHost.cs new file mode 100644 index 0000000..404a9bf --- /dev/null +++ b/SMOptionals/SM.Game/Controls/GameKeybindHost.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using OpenTK.Input; + +namespace SM.Game.Controls +{ + public class GameKeybindHost + { + internal Dictionary _actions = new Dictionary(); + + public GameKeybindHost() + { } + + public GameKeybindHost(GameKeybindList setup) + { + for (int i = 0; i < setup.Count; i++) + { + _actions[setup[i].Key] = setup[i].Value; + } + } + + public void Setup(string name, Func keyboard = null, Func gameController = null, Func ai = null) + { + GameKeybind bind; + if (_actions.ContainsKey(name)) + { + bind = _actions[name]; + } + else + { + bind = new GameKeybind(); + _actions.Add(name, bind); + } + + bind.Keyboard = keyboard; + bind.Controller = gameController; + bind.AI = ai; + } + } +} \ No newline at end of file diff --git a/SMOptionals/SM.Game/Controls/GameKeybindList.cs b/SMOptionals/SM.Game/Controls/GameKeybindList.cs new file mode 100644 index 0000000..2305d1a --- /dev/null +++ b/SMOptionals/SM.Game/Controls/GameKeybindList.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using OpenTK.Input; + +namespace SM.Game.Controls +{ + public class GameKeybindList : List> + { + public void Add(string name, GameKeybind keybind) + { + Add(new KeyValuePair(name, keybind)); + } + + public void Add(string name, Func keyboard = null, + Func controller = null) + { + Add(new KeyValuePair(name, new GameKeybind() + { + AI = null, + Controller = controller, + Keyboard = keyboard + })); + } + } +} \ No newline at end of file diff --git a/SMOptionals/SM.Game/OpenTK.dll.config b/SMOptionals/SM.Game/OpenTK.dll.config new file mode 100644 index 0000000..7098d39 --- /dev/null +++ b/SMOptionals/SM.Game/OpenTK.dll.config @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SMOptionals/SM.Game/Properties/AssemblyInfo.cs b/SMOptionals/SM.Game/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c7c6aa5 --- /dev/null +++ b/SMOptionals/SM.Game/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("SM.Game")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SM.Game")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[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("079bab31-3dc4-40da-90c7-efaa8517c647")] + +// 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/SMOptionals/SM.Game/SM.Game.csproj b/SMOptionals/SM.Game/SM.Game.csproj new file mode 100644 index 0000000..3b175c5 --- /dev/null +++ b/SMOptionals/SM.Game/SM.Game.csproj @@ -0,0 +1,71 @@ + + + + + Debug + AnyCPU + {079BAB31-3DC4-40DA-90C7-EFAA8517C647} + Library + Properties + SM.Game + SM.Game + v4.5.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\packages\OpenTK.3.3.1\lib\net20\OpenTK.dll + + + ..\..\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll + + + ..\..\packages\SharpDX.XInput.4.2.0\lib\net45\SharpDX.XInput.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SMOptionals/SM.Game/packages.config b/SMOptionals/SM.Game/packages.config new file mode 100644 index 0000000..2a7b555 --- /dev/null +++ b/SMOptionals/SM.Game/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SMRendererV3.sln b/SMRendererV3.sln index fd602d1..93ce3e3 100644 --- a/SMRendererV3.sln +++ b/SMRendererV3.sln @@ -15,6 +15,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SM2D", "SMCode\SM2D\SM2D.cs EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SM_TEST", "SM_TEST\SM_TEST.csproj", "{6D4FB8E6-4D0B-4928-8F9E-EF5C2FBF44E8}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Optionals", "Optionals", "{AE5B181B-BD8F-4F36-A64E-32C4FF7B6FD6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SM.Game", "SMOptionals\SM.Game\SM.Game.csproj", "{079BAB31-3DC4-40DA-90C7-EFAA8517C647}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SM_WPF_TEST", "SM_WPF_TEST\SM_WPF_TEST.csproj", "{6F5367D3-B7E9-40CE-A692-29F9892B6F2A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -41,6 +47,14 @@ Global {6D4FB8E6-4D0B-4928-8F9E-EF5C2FBF44E8}.Debug|Any CPU.Build.0 = Debug|Any CPU {6D4FB8E6-4D0B-4928-8F9E-EF5C2FBF44E8}.Release|Any CPU.ActiveCfg = Release|Any CPU {6D4FB8E6-4D0B-4928-8F9E-EF5C2FBF44E8}.Release|Any CPU.Build.0 = Release|Any CPU + {079BAB31-3DC4-40DA-90C7-EFAA8517C647}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {079BAB31-3DC4-40DA-90C7-EFAA8517C647}.Debug|Any CPU.Build.0 = Debug|Any CPU + {079BAB31-3DC4-40DA-90C7-EFAA8517C647}.Release|Any CPU.ActiveCfg = Release|Any CPU + {079BAB31-3DC4-40DA-90C7-EFAA8517C647}.Release|Any CPU.Build.0 = Release|Any CPU + {6F5367D3-B7E9-40CE-A692-29F9892B6F2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6F5367D3-B7E9-40CE-A692-29F9892B6F2A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6F5367D3-B7E9-40CE-A692-29F9892B6F2A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6F5367D3-B7E9-40CE-A692-29F9892B6F2A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -50,6 +64,7 @@ Global {8E733844-4204-43E7-B3DC-3913CDDABB0D} = {47EA2879-1D40-4683-BA6C-AB51F286EBDE} {9BECA849-E6E9-4E15-83A6-ADD8C18065CB} = {47EA2879-1D40-4683-BA6C-AB51F286EBDE} {A4565538-625A-42C6-A330-DD4F1ABB3986} = {47EA2879-1D40-4683-BA6C-AB51F286EBDE} + {079BAB31-3DC4-40DA-90C7-EFAA8517C647} = {AE5B181B-BD8F-4F36-A64E-32C4FF7B6FD6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {51C827AB-3306-4EE6-9E60-B7BF84854469} diff --git a/SM_TEST/Program.cs b/SM_TEST/Program.cs index ee69ee8..df42ad5 100644 --- a/SM_TEST/Program.cs +++ b/SM_TEST/Program.cs @@ -1,21 +1,10 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Drawing; -using System.Runtime.InteropServices; -using System.Security.Authentication.ExtendedProtection.Configuration; using OpenTK; -using OpenTK.Graphics; using OpenTK.Input; using SM.Base; -using SM.Base.Scene; -using SM.Base.Textures; -using SM.Base.Time; -using SM.Utility; +using SM.Game.Controls; using SM2D; using SM2D.Drawing; -using SM2D.Object; -using SM2D.Pipelines; using SM2D.Scene; using Font = SM.Base.Drawing.Text.Font; using Vector2 = OpenTK.Vector2; @@ -36,7 +25,7 @@ namespace SM_TEST Log.SetLogFile(compressionFolder:"logs"); - window = new GLWindow2D {Scaling = new Vector2(0, 1000)}; + window = new GLWindow2D {Scaling = new Vector2(0, 1000), VSync = VSyncMode.Off}; //window.GrabCursor(); window.SetRenderPipeline(new TestRenderPipeline()); window.SetScene(scene = new Scene()); @@ -51,10 +40,13 @@ namespace SM_TEST if (Keyboard.GetState()[Key.R]) particles.Trigger(); //particles.Paused = Keyboard.GetState()[Key.P]; + + GameControllerState s1 = new GameController(0).GetState(); + GameControllerState s2 = new GameController(1).GetState(); } private static void WindowOnLoad(object sender, EventArgs e) - { + { scene.ShowAxisHelper = true; diff --git a/SM_TEST/SM_TEST.csproj b/SM_TEST/SM_TEST.csproj index 5006629..b70f0eb 100644 --- a/SM_TEST/SM_TEST.csproj +++ b/SM_TEST/SM_TEST.csproj @@ -33,8 +33,14 @@ 4 - - ..\packages\OpenTK.3.2.1\lib\net20\OpenTK.dll + + ..\packages\OpenTK.3.3.1\lib\net20\OpenTK.dll + + + ..\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll + + + ..\packages\SharpDX.XInput.4.2.0\lib\net45\SharpDX.XInput.dll @@ -69,6 +75,10 @@ {a4565538-625a-42c6-a330-dd4f1abb3986} SM2D + + {079bab31-3dc4-40da-90c7-efaa8517c647} + SM.Game + \ No newline at end of file diff --git a/SM_TEST/packages.config b/SM_TEST/packages.config index 9a4debe..2a7b555 100644 --- a/SM_TEST/packages.config +++ b/SM_TEST/packages.config @@ -1,4 +1,6 @@  - + + + \ No newline at end of file diff --git a/SM_WPF_TEST/App.config b/SM_WPF_TEST/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/SM_WPF_TEST/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SM_WPF_TEST/App.xaml b/SM_WPF_TEST/App.xaml new file mode 100644 index 0000000..c032034 --- /dev/null +++ b/SM_WPF_TEST/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/SM_WPF_TEST/App.xaml.cs b/SM_WPF_TEST/App.xaml.cs new file mode 100644 index 0000000..6a3f3c6 --- /dev/null +++ b/SM_WPF_TEST/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace SM_WPF_TEST +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/SM_WPF_TEST/MainWindow.xaml b/SM_WPF_TEST/MainWindow.xaml new file mode 100644 index 0000000..be260a8 --- /dev/null +++ b/SM_WPF_TEST/MainWindow.xaml @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/SM_WPF_TEST/MainWindow.xaml.cs b/SM_WPF_TEST/MainWindow.xaml.cs new file mode 100644 index 0000000..7aae84d --- /dev/null +++ b/SM_WPF_TEST/MainWindow.xaml.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using OpenTK.Graphics; +using SM2D; +using SM2D.Drawing; +using SM2D.Scene; + +namespace SM_WPF_TEST +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + + GLWPFWindow2D gl; + Scene scene; + gl = new GLWPFWindow2D(); + Grid.SetColumn(gl, 1); + grid.Children.Add(gl); + + gl.Start(); + + gl.SetScene(scene = new Scene()); + + DrawObject2D cube = new DrawObject2D(); + cube.Color = Color4.Blue; + scene.Objects.Add(cube); + } + } +} diff --git a/SM_WPF_TEST/OpenTK.dll.config b/SM_WPF_TEST/OpenTK.dll.config new file mode 100644 index 0000000..7098d39 --- /dev/null +++ b/SM_WPF_TEST/OpenTK.dll.config @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SM_WPF_TEST/Properties/AssemblyInfo.cs b/SM_WPF_TEST/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8702efa --- /dev/null +++ b/SM_WPF_TEST/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 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("SM_WPF_TEST")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SM_WPF_TEST")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[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)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// 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/SM_WPF_TEST/Properties/Resources.Designer.cs b/SM_WPF_TEST/Properties/Resources.Designer.cs new file mode 100644 index 0000000..9cf796e --- /dev/null +++ b/SM_WPF_TEST/Properties/Resources.Designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +namespace SM_WPF_TEST.Properties +{ + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SM_WPF_TEST.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/SM_WPF_TEST/Properties/Resources.resx b/SM_WPF_TEST/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/SM_WPF_TEST/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SM_WPF_TEST/Properties/Settings.Designer.cs b/SM_WPF_TEST/Properties/Settings.Designer.cs new file mode 100644 index 0000000..a1c90c7 --- /dev/null +++ b/SM_WPF_TEST/Properties/Settings.Designer.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +namespace SM_WPF_TEST.Properties +{ + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/SM_WPF_TEST/Properties/Settings.settings b/SM_WPF_TEST/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/SM_WPF_TEST/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/SM_WPF_TEST/SM_WPF_TEST.csproj b/SM_WPF_TEST/SM_WPF_TEST.csproj new file mode 100644 index 0000000..f09db9a --- /dev/null +++ b/SM_WPF_TEST/SM_WPF_TEST.csproj @@ -0,0 +1,120 @@ + + + + + Debug + AnyCPU + {6F5367D3-B7E9-40CE-A692-29F9892B6F2A} + WinExe + SM_WPF_TEST + SM_WPF_TEST + v4.5.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\OpenTK.GLWpfControl.3.2.3\lib\net452\GLWpfControl.dll + + + ..\packages\OpenTK.3.3.1\lib\net20\OpenTK.dll + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + {8e733844-4204-43e7-b3dc-3913cddabb0d} + SM.Base + + + {f604d684-bc1d-4819-88b5-8b5d03a17be0} + SM.OGL + + + {a4565538-625a-42c6-a330-dd4f1abb3986} + SM2D + + + + \ No newline at end of file diff --git a/SM_WPF_TEST/packages.config b/SM_WPF_TEST/packages.config new file mode 100644 index 0000000..c51d6ce --- /dev/null +++ b/SM_WPF_TEST/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file