Skip to content

Getting Started

Alan Stagner edited this page Jun 9, 2020 · 1 revision

Setting up dependencies

  1. In your workspace, choose Add From Installed -> SDL2
  2. Choose Add Existing Project -> BNA/BeefProj.toml
  3. Add BNA dependency to your project
  4. (Optional) set your project's application type to GUI Application
  5. Copy the BNA/Content folder to your project's folder. Note that in final distributed builds this should also be copied next to the executable, but there's a bug in the CopyToDependents command preventing me from automating this as a post-build step.

Creating a new game

In a new file:

using System;
using BNA;

namespace MyProgram
{
    public class MyGame : Game
    {
        public this(StringView title, int windowWidth, int windowHeight, bool fullscreen = false)
            : base(title, windowWidth, windowHeight, fullscreen)
        {
        }
    }
}

In your main program class:

class Program
{
    public static void Main(String[] args)
    {
        using(let game = scope MyGame("Hello, world!", 1280, 720))
        {
            game.Run();
        }
    }
}

Hit F5 to compile and run. You should see a black window:

You're ready to start using BNA!