This project is read-only.

Basic documentation

You can check CURRENT FUNCTIONALITIES with some additional information and links for documentation at official manual for Allegro.

Anyway here is basic usage of that library:

1) Add library functionalities.

using AllegroNET;

2) Create BITMAP for our game and link it with GameScreen. GameScreen is Silverlight Image where we want to output our graphics. We are using WriteableBitmap internally here - look for 'true' argument in calling create_bitmap). In most cases you will need only one such bitmap - main bitmap that will handle all changes. Rest bitmaps can be created via simplified version: create_bitmap(w, h).

BITMAP screen = Allegro.create_bitmap((int)GameScreen.Width, (int)GameScreen.Height, true);
GameScreen.Source = screen.Source;

3) Clear bitmap with white color (0xffffff), if you need (default color is black):

Allegro.clear_to_color(color, 0xffffff);

4) Let's draw some primitives, for example:, 100, 100, 50, 0xffff00);

Allegro.triangle(screen, 100, 100, 300, 100, 150, 50, 0x0000ff);

5) Let's draw masked bitmap (common sprite). 'sprite' is another BITMAP, that has masked color 0xFF00FF for transparent pixels.>
Allegro.draw_sprite(screen, sprite, 100, 100);
6) Let's use DATAFILE. To create DATAFILE you can use grabber utility from original Allegro.

6.1) Init storage

6.2) Load DATAFILE
 DATAFILE[] dat = Allegro.load_datafile("melee.dat");
RLE_SPRITE rle = null;
if (dat != null)
rle = (RLE_SPRITE)dat[0].dat;

7) Output final result into the our GameScreen;

Last edited Oct 22, 2010 at 8:50 PM by plandem, version 11


No comments yet.