{$MODE DELPHI}
interface
uses
Classes, SysUtils, LResources, Forms, Graphics, Dialogs,
ButtonPanel, AdDraws, AdGui, AdComponents, AdClasses, AdGUIConnector,
AdPerformanceCounter, StdCtrls, ComCtrls;
type
{ TForm1 }
TForm1 =
class(TForm)
procedure FormClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
procedure OpenClick(Sender:TObject);
{ private declarations }
public
AdDraw : TAdDraw;
AdGui : TAdGui;
AdConnector : TAdGuiConnector;
AdPerCounter : TAdPerformanceCounter;
procedure Idle(Sender:TObject;
var Done:boolean);
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.OpenClick(Sender:TObject);
begin
TAdButton(AdGUI.FindComponent('
AdButton1')).Caption := '
Du hast mich geklickt!';
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
AdDraw := TAdDraw.Create(self);
AdConnector := TAdGUIConnector.Create(AdGUI);
AdGUI := TAdGUI.Create(AdDraw);
//Erzeugen der Klasse
AdDraw.DllName := '
C:\Documents and Settings\Blockbuster\Desktop\QuickDesktop\Andorra\ad2d_35_ALL\ad2d_35\bin\AndorraOGLLaz.dll';
AdGUI.Skin.LoadFromFile('
sunna.axs');
//Laden des Skins
AdGUI.Cursors.LoadFromFile('
cursors.xml');
//Laden der Cursor
AdGUI.LoadFromFile('
gui.axg');
//Laden der GUI
TAdButton(AdGUI.FindComponent('
AdButton1')).Caption := '
Hallo!';
AdConnector.ConnectEventHandlers(self); <-- 1. Fehler
Application.OnIdle := Idle;
AdDraw.Initialize;
AdGUI.FindComponent('
btn_open').OnClick := OpenClick;
end;
procedure TForm1.FormClick(Sender: TObject);
var
p:TPoint;
begin
GetCursorPos(p);
//Aktuelle Mauszeigerkoordinaten auslesen <-- 2. Fehler
p := ScreenToClient(p);
//In Koordinaten relativ zum Formular umrechnen
if not AdGUI.Click(p.X, p.Y)
then //Ereignisbehandlung ausführen
begin
//Es wurde auf das Spielfeld geklickt
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
end;
procedure TForm1.Idle(Sender: TObject;
var Done:boolean);
begin
AdDraw.ClearSurface(0);
AdDraw.BeginScene;
AdDraw.EndScene;
AdDraw.Flip;
end;