Quick Start Guide

Getting Allegro# working is a simple process.

Source Distribution

Ingredients:

Unzip the Allegro# distribution to an easily-accessible location where your projects can link to it. It is possible to link with the library itself rather than the project, but that will sacrifice the in-line documentation

Make a new solution for your game. Under your newly-created project, find References. Right-click and add a reference to the project AllegroSharp.

All you need to do now is toss using AllegroSharp; wherever you want to use Allegro# code.

Binary Distribution

Ingredients:

Unzip the Allegro# distribution to an easily-accessible location where your projects can link to it.

Make a new solution for your game. Under your newly-created project, find References. Right-click and add a reference to AllegroSharp.dll.

All you need to do now is toss using AllegroSharp; wherever you want to use Allegro# code.

Skeleton Code

Here's a simple template to get you started:

using AllegroSharp;

namespace MyGame
{
    class Program
    {
        static void Main(string[] args)
        {
            Allegro.Init();
            Keyboard.Install();
            
            Graphics.SetMode(GraphicsDriver.AutoDetect, 640, 480);
            
            Bitmap buffer = new Bitmap(Screen.W, Screen.H);
            Bitmap me = new Bitmap(20, 20);
            Point pos = new Point();
            
            Primitives.Circle(me, new Point(10, 10), 10, Color.PureBlue, true);
            
            while (!Keyboard.KeyPressed)
            {
                if (Keyboard.Key[Key.Up] && pos.Y > 0)
                {
                    pos.Y--;
                }
                if (Keyboard.Key[Key.Down] && pos.Y < Screen.H)
                {
                    pos.Y++;
                }
                if (Keyboard.Key[Key.Right] && pos.X < Screen.W)
                {
                    pos.X++;
                }
                if (Keyboard.Key[Key.Left] && pos.X > 0)
                {
                    pos.X--;
                }

                buffer.Clear();
                me.Draw(buffer, pos);
                buffer.Blit(Graphics.Screen);
            }
            me.Destroy();
            buffer.Destroy();
        }
    }
}