# Nez Setup

## Nez Setup

![Nez framework](https://4273800566-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lpi5iawrEyk0J2HCTdx%2F-LpjmCFRiSsEvayyHc8j%2F-LpjmFIbYe4FNUvlmea-%2Fnez-logo-black.png?alt=media\&token=33dbb33f-a73b-40a4-97bd-a7640e4e8539)

### Setup

#### Install as a submodule:

* create a `Monogame Cross Platform Desktop Project`
* clone or download the [Nez](https://github.com/prime31/Nez) repository
* add the `Nez.Portable/Nez.csproj` project to your solution and add a reference to it in your main project
* make your main Game class (`Game1.cs` in a default project) subclass [Nez.Core](https://github.com/prime31/Nez/blob/master/Nez.Portable/Core.cs)

If you intend to use any of the built in Effects or PostProcessors you should also copy or link the [DefaultContent/effects](https://github.com/prime31/Nez/tree/master/DefaultContent) folder into your projects [Content/nez/effects](https://github.com/prime31/Nez/tree/master/DefaultContent/effects) folder and the [DefaultContent/textures](https://github.com/prime31/Nez/tree/master/DefaultContent/textures) folder into `Content/nez/textures`. Be sure to set the Build Action to Content and enable the "Copy to output directory" property so they get copied into your compiled game. See the Nez.Samples csproj for an example on how to do this.

Note: if you get compile errors referencing a missing `project.assets.json` file run `msbuild Nez.sln /t:restore` in the root Nez folder to restore them.

#### Install through [NuGet](https://www.nuget.org/):

Add [Nez](https://www.nuget.org/packages/Nez/) to your project's NuGet packages. Optionally add the [Nez.FarseerPhysics](https://github.com/prime31/Nez/tree/master/Nez.FarseerPhysics) and [Nez.Persistence](https://github.com/prime31/Nez/tree/master/Nez.Persistence) NuGet packages.

Installing through [NuGet](https://www.nuget.org/), the contents of the [DefaultContent](https://github.com/prime31/Nez/tree/master/DefaultContent) content folder is also included in the package. You will find them under `packages/Nez.{VERSION}/tools`.

All Nez shaders are compiled for OpenGL so be sure to use the DesktopGL template, not DirectX! Nez only supports OpenGL out of the box to keep things compatible across Android/iOS/Mac/Linux/Windows.

If you are developing a mobile application you will need to enable touch input by calling `Input.Touch.EnableTouchSupport()`.

### Samples Repository

You can find the samples repo [here](https://github.com/prime31/Nez-Samples). It contains a variety of sample scenes that demonstrate the basics of getting stuff done with Nez. [The wiki](https://github.com/prime31/Nez/wiki) also contains a few short examples. [This YouTube playlist](https://www.youtube.com/playlist?list=PLb8LPjN5zpx0ZerxdoVarLKlWJ1_-YD9M) also has a few relevant videos.

## FNA Compatibility

To make getting up and running with FNA easier there are separate csproj files (\*.FNA.csproj). Note that you still have to install the required FNA native libs per the [FNA documentation](https://github.com/FNA-XNA/FNA/wiki/1:-Download-and-Update-FNA). The [MonoGameCompat class](https://github.com/prime31/Nez/blob/62bbcca5e346413cacc2c3f9e765e11ead568de5/Nez-PCL/Utils/MonoGameCompat.cs) is included as well and consists of a few extension methods that implmement some commonly used method that are in MonoGame but not in FNA.

### Setup details

. Here is what you need to do to get up and running with Nez + FNA:

* clone this repo recursively
* open the Nez solution (Nez/Nez.sln) and build it. This will cause the NuGet packages to refresh.
* download/clone FNA
* open your game's project and add a reference to FNA and Nez.FNA
* (optionally) add references to Nez.FNA.ImGui or Nez.FNA.FarseerPhysics if you need them

The folder structure the cscproj files expect is something like this:

* TopLevelFolderHousingEverything
  * FNA
  * YourGameProject
  * Nez


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://anshuman-kumar.gitbook.io/nez-doc/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
