Skip to content

Getting Started on macOS

Cole Campbell edited this page Dec 3, 2018 · 4 revisions

This guide assumes that you will be writing code using Visual Studio for Mac. You can acquire Visual Studio for Mac for free from Microsoft at https://www.visualstudio.com/vs/visual-studio-mac.

Creating a New Project

First, let's create a new project. From the File menu, select New Solution... to open the New Project dialog. Select the Mac > App category from the list on the left side of the dialog box, then select Cocoa App and click Next.

You will then be prompted to configure your application. Enter your app's name, then change the other settings to whatever values you consider appropriate and click Next to continue.

On the final pane, enter a name for your project and solution, then click Create to create the project.

New Project dialog

Configuring the Project

The first thing you'll want to do after creating your project is make sure that it's using the Xamarin.Mac Full Framework. You can do this by right clicking on your project in Visual Studio and selecting Options from the context menu, then selecting Build > General from the list on the left side of the Project Options dialog. Select the Xamarin.Mac Full target framework, making sure that it's set for compatibility with .NET Framework 4.6.1 using the dropdown menu, and click OK to confirm the change.

New Project dialog

Setting up Ultraviolet

With your project configured, the next thing you'll need to do is retrieve the Ultraviolet Framework assemblies and add them as references. The easiest way to do this is through NuGet.

From Visual Studio for Mac's Project menu, select Add NuGet Packages... to bring up the Add Packages dialog. There's one for every Ultraviolet assembly, and in some cases it may be useful to pick and choose just the ones you want. For the purposes of this guide, though, we're going to go with the simplest solution.

Add Packages dialog

Use the search box at the top right of the dialog to search for the Ultraviolet.Game.macOS package. This package contains a complete skeleton of a working Ultraviolet Framework project. Adding it to your project will automatically pull in all of the required libraries, and it will also inject two code files into your project: a new Main.cs file (which will replace the one which already exists), and a file called Game.cs.

The Game.cs file contains an example implementation of the UltravioletApplication class; this is the starting point for all of your application's code. For example, the OnUpdating() method should contain your application's update logic, and the OnDrawing() method should be where you place your application's rendering logic.

At this point your project should run without any further modification. Press the F5 key to execute the program and you will be presented with an empty, cornflower blue window.

You now have a complete Ultraviolet Framework application. Enjoy!

Clone this wiki locally
You can’t perform that action at this time.