Well, here is a basic template I was working on (based on code from from Delphi Graphics and Game Programming Exposed). It's not the most amazing thing in world, but it's simple enough for beginners to grab a hold of. Note that I don't set Done := false, because I immediately call GameLoop upon entering OnIdleHandler, which loops until GameRunning := false (almost the same effect). Also I throttle the loop to 30fps, this of course could be placed elsewhere or increased/decreased as necessary.


[pascal]
[background=#FFFFFF][normal=#000080][number=#FF0000][string=#0000FF][comment=#8080FF][reserved=#000000]
{================================================= ==============}
{ }
{ File: unt_Game.pas }
{ Created By: Name Goes Here }
{ Modified By: N/A }
{ Creation Date: N/A }
{ Last Modified On: N/A }
{ }
{ Description: Simple template for a game in Delphi. }
{ }
{---------------------------------------------------------------}
{ Copyright Ac XXXX-XXXX All Rights Reserved }
{================================================= ==============}

UNIT unt_Game;


{================================================= =============================}
INTERFACE
USES Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
{================================================= =============================}

{Global DataType / Constant / Variable Declarations}
{------------------------------------------------------------------------------}

TYPE
TGameState = (gsDemo, gsPlaying, gsIntermission, gsPaused, gsGameOver);

Tfrm_Game = class(TForm)
procedure FormCreate(Sender: TObject);
procedure OnIdleHandler(Sender: TObject; var Done: Boolean);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;

CONST
Throttle = trunc(1000 / 30); {30fps Throttle}

VAR
frm_Game: Tfrm_Game;
GameRunning: Boolean;
GameState: TGameState;

{Function / Procedure ProtoTypes}
{------------------------------------------------------------------------------}

{None needed yet} {mainly used for forward delcarations}


{================================================= =============================}
IMPLEMENTATION {$R *.DFM}
{================================================= =============================}

{Game Event Handlers}
{------------------------------------------------------------------------------}

procedure Pause(MilliSeconds: Integer);
var
CurrentTime: LongInt;
PauseTime: LongInt;
begin
CurrentTime := GetTickCount;
PauseTime := CurrentTime + MilliSeconds;
while CurrentTime < (PauseTime) do begin
Application.ProcessMessages;
CurrentTime := GetTickCount;
end;
end;

procedure doDemo();
begin
//Display automated demonstration/intro here
Application.ProcessMessages;
end;

procedure doPlaying();
begin
//Perform all gameplay here
Application.ProcessMessages;
end;

procedure doIntermission();
begin
//Perform inter-level loads etc. here
Application.ProcessMessages;
end;

procedure doPause();
begin
//Pause gameplay here
Application.ProcessMessages;
end;

procedure doGameOver();
begin
//Display game over screen and cleanup here
Application.ProcessMessages;
end;

procedure GameLoop();
var
TimeIndex: LongInt;
begin
while GameRunning do begin
//Record time before processing
TimeIndex := LongInt(GetTickCount);
//Process game
case GameState of
gsDemo: doDemo;
gsPlaying: doPlaying;
gsIntermission: doIntermission;
gsPaused: doPause;
gsGameOver: doGameOver;
end;
//Calculate time it took to process
TimeIndex := LongInt(GetTickCount) - TimeIndex;
//Pause if it was too quick
if (TimeIndex < Throttle) then begin
Pause(Throttle - TimeIndex);
end;
Application.ProcessMessages;
end;
end;


{Form Event Handlers}
{------------------------------------------------------------------------------}

procedure Tfrm_Game.OnIdleHandler(Sender: TObject; var Done: Boolean);
begin
GameLoop;
end;

procedure Tfrm_Game.FormCreate(Sender: TObject);
begin
GameState := gsDemo;
GameRunning := True;
Application.OnIdle := OnIdleHandler;
end;

procedure Tfrm_Game.FormClose(Sender: TObject; var Action: TCloseAction);
begin
GameRunning := False;
end;


{================================================= ==============}
{ Copyright Ac XXXX-XXXX All Rights Reserved }
{================================================= ==============}

END.[/pascal]


If anyone wants to add, revise, or update the code, please feel free.