-
-
Notifications
You must be signed in to change notification settings - Fork 86
.NET Core 2
Lauriethefish edited this page Oct 25, 2020
·
2 revisions
- Visual Studio Code
- C# Extension
- .NET Core 2+
- Windows 10
- Powershell
- Learn how to set up an exteremly basic SFML.Net Project that will run locally on .NET Core
- Download and install Tools
- Download CSFML dlls from the offical distribution source.
- Ensure you get the ones corresponding to your architecture.
- Create a new .NET Core project
- Create project folder and navigate into it
- At the console, run
dotnet new console
- If you're using the .NET Core 3 preview:
- In the generated .csproj file, change
<TargetFramework>netcoreapp3.0</TargetFramework>
to<TargetFramework>netcoreapp2.2</TargetFramework>
. The minor version shouldn't be terribly important. - Run
dotnet restore
to get the build system to pull the correct framework packages - In
.vscode/launch.json
, change thecwd
member to"${workspaceFolder}/bin/Debug/netcoreapp2.2"
- In the generated .csproj file, change
- If you're using the .NET Core 3 preview:
- Install required nuget packages. At the console, run
dotnet add package SFML.System.NetCore,SFML.Window.NetCore,SFML.Graphics.NetCore
. This will pull the SFML binding packages into your project. Note that as of the creation of this tutorial they do not contian the required binaries. Also note that additional packagesSFML.Audio.NetCore
andSFML.Network.NetCore
are also available. - In the root project directory, create the folder tree
res/bin
and copy the CSFML dlls into this folder.- They don't have to be in this folder, but this tutotiral will assume they are for simplicity.
- In the .csproj file, add the following target after the PropertyGroup element. This will copy the dlls to the output directory after the build completes.
<Target Name="CopySFMLBinaries" AfterTargets="AfterBuild"> <Copy SourceFiles="./res/bin/csfml-system-2.dll" DestinationFolder="$(OutDir)"/> <Copy SourceFiles="./res/bin/csfml-graphics-2.dll" DestinationFolder="$(OutDir)"/> <Copy SourceFiles="./res/bin/csfml-window-2.dll" DestinationFolder="$(OutDir)"/> </Target>
- Create a window and event loop.
- Create a shape and use the window to draw it.