Creating the Project
v3 Tutorials
Goal
In this tutorial we’ll get the RogueSharp and RLNET NuGet packages added to a brand new project.
Creating a new Console Project
I’ll be using Visual Studio 2015 for this project. The community edition can be found here: https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx
- Go to the File menu and choose New -> Project…
- From Templates choose Visual C# -> Windows -> Console Application
- Give it any name and location that want.
Adding NuGet Packages
Both RogueSharp and RLNET are available via NuGet and are easy to add to our project.
- Right click on the project (the name of your project will be whatever you named it in step 3 above)
- Choose Manage NuGet Packages… from the context menu.
Now you should be able to choose Browse and search for RogueSharp and RLNET. Make sure that the Package Source dropdown is set to nuget.org. Click Install for both packages. As of this writing the latest version of RogueSharp is 3.0.0 and RLNET is 1.0.6. Note RLNet has a dependency on OpenTK so it will also install v1.1.225 of that library.
Adding a Font File
RLNET needs a special font file like libtcod uses. If you aren’t familiar with this and want to know more about it there is good information here.
But for our purposes just right click and download this image and place it in your project directory.
Once the file is in your project directory, you should be able to Right Click on your project in Visual Studio and choose Add -> Existing Item… Choose the image that you saved and it should show up in the project. Make sure to set the Properties of this file to Copy always.
The Code
A console application always includes a file called Program.cs which has a single Main() function which serves as the entry point.
Rename Program.cs to Game.cs
Now we’re going to add a bit of code to render a RLRootConsole with the text “It worked!” just to prove that we hooked up the NuGet packages correctly. I won’t go into a lot of detail here but if you want more depth check out these other tutorials.
If you run your project now you should see something like this:
Here is the link to the final code on BitBucket