-
Notifications
You must be signed in to change notification settings - Fork 3
Getting Started
A complete minimal template project and other examples can also be found here.
Pile depends on bon which has to be installed or added to the workspace manually.
To add Pile to your project:
- add the projects you need to your workspace (right click on your project > add from installed../add existing project.. (depending on how you installed Pile)):
- Pile (the main project), found in ./Pile/
- exactly one Graphics, Audio and System implementation, found in ./Implementations/(list of all implementation projects)
- add those to your dependencies (right click on your project > Properties.. > General/Dependencies) by ticking the boxes of all related Pile projects
Pile provides its own entry point from which your code will be run through Game. To set it up:
- set your projects startup object (right click on your project > Properties... > General/Beef > General/Startup Object) to
Pile.Core - you have to make sure your game class is included at all, since it is never referenced by Pile, with
[AlwaysInclude] - use the static constructor to tell Pile what to do on startup (See example below).
Finally, since Pile will automatically try to build assets for your projects if you have any, so you'll have to set PileGame as a project name alias (right click on your project > Properties... > General/Project > Project Name Aliases).
First, you need to override Game<T>. T should be the class itself. This is used for nothing but supplying a reference to the active game instance with the right type.
using Pile;
using System;
namespace Game
{
[AlwaysInclude]
public class ExampleGame : Game<ExampleGame>
{
static this()
{
// Tell Pile to start this
Core.Config.createGame = () => new ExampleGame();
Core.Config.gameTitle = "example";
Core.Config.windowTitle = "Example Game";
}
// This class contains some fundamental overridable methods which are called by Core
protected override void Startup()
{
Log.Info(System.DataPath);
}
}
}If you get any errors while compiling anything, make sure your project is set as startup project, and that it lists Pile and all implementation projects as dependencies.