- <?xml version="1.0" encoding="utf-8"?>
- <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-<Project Sdk="Microsoft.NET.Sdk">
++<Project Sdk="Microsoft.NET.Sdk">
+ <Import Project="$(SolutionDir)netfx.props" />
<PropertyGroup>
- <OutputType>Exe</OutputType>
- <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
- <OutputPath>$(SolutionDir)build\$(Configuration)\samples\</OutputPath>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{56329D48-D382-4850-93DE-59C453894E8A}</ProjectGuid>
+ <TargetFrameworks>net472</TargetFrameworks>
+ <OutputPath>$(SolutionDir)build\$(Configuration)\</OutputPath>
+ <OutputType>Exe</OutputType>
+ <RepositoryUrl>https://github.com/jpbruyere/Crow</RepositoryUrl>
+ <License>https://opensource.org/licenses/MIT</License>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <EnableDefaultNoneItems>false</EnableDefaultNoneItems>
+ <TargetFramework>net472</TargetFramework>
<ReleaseVersion>0.8.0</ReleaseVersion>
</PropertyGroup>
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <DefineConstants>DEBUG</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
+ <DefineConstants>TRACE;DEBUG</DefineConstants>
+ <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
</PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <Optimize>true</Optimize>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="*.cs" />
+
+ <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
+ <Reference Include="System" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\..\Crow\Crow.csproj" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="..\common\CrowWin.cs" />
+ <Datas Include="..\data\**\*.*">
+ <Link>data\%(RecursiveDir)%(Filename)%(Extension)</Link>
+ </Datas>
<EmbeddedResource Include="ui\*.*">
<LogicalName>ShowCase.%(Filename)%(Extension)</LogicalName>
- </EmbeddedResource>
- <None Include="ui\Interfaces\**\*.*">
+ </EmbeddedResource>
+ <None Include="..\common\ui\Interfaces\**\*.*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>Interfaces\%(RecursiveDir)%(Filename)%(Extension)</Link>
</None>
- <EmbeddedResource Include="ui\divers\*.*">
- <LogicalName>ShowCase.divers.%(Filename)%(Extension)</LogicalName>
- </EmbeddedResource>
- </ItemGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
- </Reference>
- <Reference Include="glTFLoader">
- <HintPath>..\..\packages\glTF2Loader.1.1.3-alpha\lib\net35\glTFLoader.dll</HintPath>
- </Reference>
- <Reference Include="System.Numerics.Vectors">
- <HintPath>..\..\packages\System.Numerics.Vectors.4.6.0-preview4.19212.13\lib\net46\System.Numerics.Vectors.dll</HintPath>
- </Reference>
- <Reference Include="mscorlib" />
- <Reference Include="System.Numerics" />
- <Reference Include="System.Runtime.CompilerServices.Unsafe">
- <HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0-preview4.19212.13\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
- </Reference>
- <Reference Include="VK">
- <HintPath>..\..\packages\Vulkan.0.1.2.6\lib\netstandard2.0\VK.dll</HintPath>
- </Reference>
- <Reference Include="CVKL-dotnet">
- <HintPath>..\..\packages\CVKL.0.1.2\lib\netstandard2.0\CVKL-dotnet.dll</HintPath>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\Crow\Crow.csproj">
- <Project>{C2980F9B-4798-4C05-99E2-E174810F7C7B}</Project>
- <Name>Crow</Name>
- </ProjectReference>
- </ItemGroup>
+ </ItemGroup>
<ItemGroup>
- <None Include="packages.config" />
+ <PackageReference Include="CVKL" Version="0.1.3.2-beta" />
</ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
-
-
- using System;
-using System.IO;
+using System.IO;
- using System.Threading;
using Crow;
- using CVKL;
- using VK;
namespace HelloWorld
{
{
NotifyValueChanged ("ShowError", false);
}
-
- void buildCommandBuffers () {
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- cmds[i]?.Free ();
- cmds[i] = cmdPool.AllocateAndStart ();
-
- CommandBuffer cmd = cmds [i];
-
- swapChain.images [i].SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal,
- VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.Transfer);
- uiImage.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.ColorAttachmentOptimal, VkImageLayout.TransferSrcOptimal,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.Transfer);
-
- VkImageSubresourceLayers imgSubResLayer = new VkImageSubresourceLayers {
- aspectMask = VkImageAspectFlags.Color,
- mipLevel = 0,
- baseArrayLayer = 0,
- layerCount = 1
- };
- VkImageCopy cregion = new VkImageCopy {
- srcSubresource = imgSubResLayer,
- srcOffset = default (VkOffset3D),
- dstSubresource = imgSubResLayer,
- dstOffset = default (VkOffset3D),
- extent = new VkExtent3D { width = swapChain.Width, height = swapChain.Height }
- };
- Vk.vkCmdCopyImage (cmds [i].Handle, uiImage.Handle, VkImageLayout.TransferSrcOptimal,
- swapChain.images [i].Handle, VkImageLayout.TransferDstOptimal, 1, ref cregion);
-
- swapChain.images [i].SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.TransferDstOptimal, VkImageLayout.PresentSrcKHR,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.BottomOfPipe);
- uiImage.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.TransferSrcOptimal, VkImageLayout.ColorAttachmentOptimal,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.ColorAttachmentOutput);
-
- cmds [i].End ();
- }
- }
-
-
- #region update
- int frameCount = 0;
-
- public override void Update () {
- if (++frameCount > 20) {
- NotifyValueChanged ("fps", fps);
- frameCount = 0;
- }
- }
- #endregion
-
-
- protected override void OnResize () {
- dev.WaitIdle ();
-
- crow.ProcessResize (new Crow.Rectangle (0, 0, (int)swapChain.Width, (int)swapChain.Height));
-
- initUISurface ();
-
- buildCommandBuffers ();
- dev.WaitIdle ();
- }
- #region Mouse and keyboard
- //protected override void onScroll (double xOffset, double yOffset)
- //{
- // if (KeyModifiers.HasFlag (Glfw.Modifier.Shift))
- // crow.ProcessMouseWheelChanged ((float)xOffset);
- // else
- // crow.ProcessMouseWheelChanged ((float)yOffset);
- //}
- protected override void onMouseMove (double xPos, double yPos)
- {
- if (crow.ProcessMouseMove ((int)xPos, (int)yPos))
- return;
- }
- protected override void onMouseButtonDown (Glfw.MouseButton button)
- {
- if (crow.ProcessMouseButtonDown ((Crow.MouseButton)button))
- return;
- base.onMouseButtonDown (button);
- }
- protected override void onMouseButtonUp (Glfw.MouseButton button)
- {
- if (crow.ProcessMouseButtonUp ((Crow.MouseButton)button))
- return;
- base.onMouseButtonUp (button);
- }
- protected override void onKeyDown (Glfw.Key key, int scanCode, Glfw.Modifier modifiers)
- {
- if (crow.ProcessKeyDown ((Crow.Key)key))
- return;
- }
- protected override void onKeyUp (Glfw.Key key, int scanCode, Glfw.Modifier modifiers)
- {
- if (crow.ProcessKeyUp ((Crow.Key)key))
- return;
- }
- //protected override void onChar (Glfw.CodePoint cp)
- //{
- // if (crow.ProcessKeyPress (cp.ToChar ()))
- // return;
- //}
- #endregion
-
- #region dispose
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
-
- isRunning = false;
- uiImage?.Dispose ();
- while (crow != null)
- Thread.Sleep (1);
- }
- }
-
- base.Dispose (disposing);
- }
- #endregion
}
--}
++}