procedure TfrmMain.FormCreate(Sender: TObject);
var GraphicsFolder:TStringList;
GraphicsIndex:Integer;
begin
// Grundlegendes
IsMouseDown:=False;
Randomize;
// Klassen usw. initialisieren
GlobalSounds:=TInstantSound.Create;
GraphicsFolder:=TStringList.Create;
EasyTimer:=TEasyTimer.Create;
// Andorra 2D initialisieren
OutputScreen:=TAdDraw.Create(self);
OutputScreen.DllName:='
DLL/AndorraDX93D.dll';
OutputScreen.Options:=OutputScreen.Options+[aoAntialias];
with OutputScreen.Display
do
begin
Width:=Screen.Width;
Height:=Screen.Height;
BitDepth:=ad32Bit;
DisplayMode:=dmFullscreen;
end;
OutputScreen.Initialize;
GameScreen:=TAdTextureSurface.Create(OutputScreen);
GameScreen.SetSize(1280,720);
PerformanceCounter:=TAdPerformanceCounter.Create;
PerformanceCounter.MaximumFrameRate:=150;
PerformanceCounter.MaximumTimeGap:=30;
// Bilder in die ImageList laden
ImageList:=TAdImageList.Create(OutputScreen);
// PNG Grafiken laden
SpecialFunctions.FindAllFiles(GraphicsFolder,'
Graphics','
*.png',False);
for GraphicsIndex:=0
to pred(GraphicsFolder.Count)
do
begin
with ImageList.Add(ChangeFileExt(ExtractFileName(GraphicsFolder[GraphicsIndex]),'
'))
do
begin
Texture.LoadGraphicFromFile(GraphicsFolder[GraphicsIndex],True,clNone);
Texture.Filter:=atAnisotropic;
end;
end;
ImageList.Restore;
// EasyDraw initialisieren
EasyDraw:=TEasyDrawAd.Create(GameScreen,ImageList);
// Spielszenen / Status initialisieren
GameScenes[0]:=TScene_Loader.Create(frmMain,GameScreen,ImageList);
GameScenes[1]:=TScene_Intro.Create(frmMain,GameScreen,ImageList);
GameScenes[2]:=TScene_Splash.Create(frmMain,GameScreen,ImageList);
GameScenes[3]:=TScene_MainMenu.Create(frmMain,GameScreen,ImageList);
GameScenes[4]:=TScene_NewGame.Create(frmMain,GameScreen,ImageList);
GameScenes[5]:=TScene_Game.Create(frmMain,GameScreen,ImageList);
GameSceneNow:=0;
GameSceneNext:=0;
// Alles einschalten
Application.OnIdle:=Cadence;
end;