| 1 |
{ |
| 2 |
Copyright 2016-2022 Michalis Kamburelis. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in this distribution, for details about the copyright. |
| 8 |
|
| 9 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
|
| 13 |
---------------------------------------------------------------------------- |
| 14 |
} |
| 15 |
|
| 16 |
{ Game initialization. |
| 17 |
This unit is cross-platform. |
| 18 |
It will be used by the platform-specific program or library file. } |
| 19 |
unit GameInitialize; |
| 20 |
|
| 21 |
interface |
| 22 |
|
| 23 |
implementation |
| 24 |
|
| 25 |
uses SysUtils, Classes, CastleControls, CastleUtils, CastleFilesUtils, |
| 26 |
CastleColors, CastleUIControls, CastleWindow, |
| 27 |
CastleApplicationProperties, CastleLog, |
| 28 |
GameViewMainMenu, GameViewLoading, GameViewPlay, GameViewAskDialog; |
| 29 |
|
| 30 |
var |
| 31 |
Window: TCastleWindow; |
| 32 |
|
| 33 |
procedure ApplicationInitialize; |
| 34 |
begin |
| 35 |
{ Adjust container settings for a scalable UI (adjusts to any window size in a smart way). } |
| 36 |
Window.Container.LoadSettings('castle-data:/CastleSettings.xml'); |
| 37 |
|
| 38 |
{ initialize first view } |
| 39 |
Window.Container.View := TViewMainMenu.CreateUntilStopped; |
| 40 |
end; |
| 41 |
|
| 42 |
initialization |
| 43 |
Application.OnInitialize := @ApplicationInitialize; |
| 44 |
|
| 45 |
Window := TCastleWindow.Create(Application); |
| 46 |
Application.MainWindow := Window; |
| 47 |
finalization |
| 48 |
Window.Container.View := nil; |
| 49 |
end. |