Topic : Allegro Vivace
Author : Filipe Medeiros
Page : 1 Next >>
Go to page :


Allegro Vivace
Copyright (C) 1997-1998 George Foot.
Converted to HTML by Filipe Medeiros





Permission is granted to distribute this documentation verbatim
in any form without restriction and to distribute modified
copies provided it is stated that modifications have been made.
This is the sixth draft. The Texinfo source was updated on
3 May 1998 and built on 3 May 1998.

This is the sixth draft of Allegro Vivace converted into HTML
by Filipe Medeiros. No modifications to the actual text has been
made, save the text diagrams in chapter 5, which were replaced
by images, and the index, which was empty.
Started on the 18 June 1999, completed 19 June
1999.

Table of Contents

Legal issues
Distribution
Disclaimer

1. Introduction
    1.1 About the tutorial
    1.2 Aim
    1.3 Target audience
    1.4 Requirements
    1.5 Before we start...
2. Getting, installing and using Allegro
    2.1 What is Allegro?
    2.2 Where to find Allegro
    2.3 How to install Allegro
    2.4 Testing the installation
    2.5 Using Allegro
3. A basic game structure
    3.1 What does a game need to do?
    3.2 Proposed structure
    3.3 Multi-file projects
4. Introducing graphics
    4.1 Selecting a graphics mode
    4.2 Drawing things
    4.2.1 The BITMAP struct
    4.2.2 Plotting pixels
    4.2.3 Some other `primitives'
    4.2.4 Writing text
    4.3 Palette manipulation
        4.3.1 Palette explanation
        4.3.2 Changing a single logical color's appearance
        4.3.3 Changing the entire palette
        4.3.4 Fading in and out
    4.4 Simple animation
        4.4.1 What is animation?
        4.4.2 Making things appear to move
        4.4.3 Reducing flicker
            4.4.3.1 Synchronising to the vertical retrace
            4.4.3.2 Maximising drawn time
            4.4.3.3 Optimising drawing order
            4.4.3.4 Double buffering
            4.4.3.5 Dirty rectangles
            4.4.3.6 Alternate line blitting
5. Making several things happen at once
    5.1 Moving more circles
    5.2 Now moving a square as well
    5.3 Keeping track of things
        5.3.1 Dynamic allocation
        5.3.2 Linked lists
            5.3.2.1 Singly linked lists
            5.3.2.2 Doubly linked lists
            5.3.2.3 Circularly linked lists
            5.3.2.4 Using linked lists
    5.4 Object Oriented Programming
6. User input
    6.1 Keyboard input
        6.1.1 Why the standard PC keyboard routines are useless
        6.1.2 Allegro's keyboard routines
        6.1.3 Moving something using the keyboard
        6.1.4 Letting the user choose which keys to use
    6.2 Joystick input
        6.2.1 Digital readings
        6.2.2 The fire buttons
        6.2.3 Analogue readings and calibration
    6.3 Mouse input
        6.3.1 Point-and-click
            6.3.1.1 Initialising the mouse
            6.3.1.2 Reading the mouse
            6.3.1.3 Displaying the mouse pointer
            6.3.1.4 Controlling the mouse pointer
        6.3.2 Direct mouse control
    6.4 Generic input
    6.5 Ways of interpretting input
7. More 2D graphics
8. Sound
    8.1 Sound configuration
        8.1.1 Initialising sound drivers
        8.1.2 Using a configuration file
    8.2 Digital sound
        8.2.1 Loading sound files
        8.2.2 Playing samples
        8.2.3 Adjusting a playing sample's parameters
        8.2.4 Unloading samples
        8.2.5 Voice functions
    8.3 MIDI music
        8.3.1 Loading MIDI music
        8.3.2 Playing MIDI music
        8.3.3 Controlling MIDI music
        8.3.4 Unloading MIDI music
9. Timers
    9.1 Uses of timers
    9.2 Setting up timer callbacks
        9.2.1 Initialising the timer system
        9.2.2 Locking and volatility
        9.2.3 Installing timer callbacks
        9.2.4 Removing timer callbacks
    9.3 Limitations of timers
    9.4 Examples of timers
        9.4.1 Timing a game
        9.4.2 Measuring the frame rate
        9.4.3 Regulating game speed
10. Datafiles
    10.1 Concept
    10.2 Creating a datafile
        10.2.1 The grabber
        10.2.2 The DAT utility
    10.3 Using a datafile in your program
        10.3.1 Loading an entire datafile
        10.3.2 Individually loading datafile components
        10.3.3 Reading a datafile component as a normal packfile



Legal issues

Distribution


You may freely distribute this document in any form without modifying the text; I don't expect anything in return, but an email would be nice. You may also distribute modified copies in any form, provided it is made clear that such copies have been modified.

Disclaimer


I accept no liability for any damage use or abuse of this tutorial may cause to anything at all. The examples presented as part of this package are not guarranteed to work, and are not guarranteed to be safe. In general you shouldn't compile programs you don't understand anyway.

1. Introduction


1.1 About the tutorial

This tutorial is available in several different formats - plain text, Info format (which also works with RHIDE) and as Texinfo source. The source distribution includes utility files to create the other formats. Support for HTML format is planned. Throughout the tutorial you'll see references to example programs. These have not all been written, and none of them are available yet. All parts of Allegro Vivace can be downloaded from the web site, individually or in groups. Go to: http://www.canvaslink.com/gfoot/vivace/ for full information.

If you want to contact me, my email address is:
george.foot@merton.oxford.ac.uk

Comments, suggestions and complaints are, as always, much appreciated.

1.2 Aim

The aim of this tutorial is to guide newcomers to game programming and Allegro through the process of writing a simple game.

1.3 Target audience

As stated above, this tutorial is aimed at newcomers to game programming and Allegro. It is not aimed at complete newcomers to the C language, and it is not aimed at complete newcomers to djgpp. By this, I mean some knowledge of and experience using the C language will be assumed, and I expect you to already have a working installation of DJGPP.

1.4 Requirements

Working installation of djgpp v2.01 or compatible (v2.00 might be okay)
Allegro version 3.0 or compatible (v2.0 and above should be fine but see below)
GNU Make utility (for building Allegro, and because it's useful anyway)
By "working installation of djgpp" I mean one that is capable of compiling C programs and linking them to executables. Test it by going to the tutorial directory and typing: make test1 If no errors are reported, all is well. If not, you need to troubleshoot the problem, and this is not the place for me to explain this in detail. Read `readme.1st' and the djgpp FAQ; if this doesn't help follow the instructions given in the FAQ for posting a help request to the djgpp newsgroup/mailing list.

If your version of djgpp is v2.00, you

Page : 1 Next >>