| 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 |
{$region 'Castle Initialization Uses'} |
| 29 |
// The content here may be automatically updated by CGE editor. |
| 30 |
, GameViewMainMenu |
| 31 |
, GameViewLoading |
| 32 |
, GameViewPlay |
| 33 |
, GameViewAskDialog |
| 34 |
{$endregion 'Castle Initialization Uses'}; |
| 35 |
|
| 36 |
var |
| 37 |
Window: TCastleWindow; |
| 38 |
|
| 39 |
procedure ApplicationInitialize; |
| 40 |
begin |
| 41 |
{ Adjust container settings for a scalable UI (adjusts to any window size in a smart way). } |
| 42 |
Window.Container.LoadSettings('castle-data:/CastleSettings.xml'); |
| 43 |
|
| 44 |
{ Create views (see https://castle-engine.io/views ). } |
| 45 |
{$region 'Castle View Creation'} |
| 46 |
// The content here may be automatically updated by CGE editor. |
| 47 |
ViewMainMenu := TViewMainMenu.Create(Application); |
| 48 |
ViewLoading := TViewLoading.Create(Application); |
| 49 |
ViewPlay := TViewPlay.Create(Application); |
| 50 |
ViewAskDialog := TViewAskDialog.Create(Application); |
| 51 |
{$endregion 'Castle View Creation'} |
| 52 |
|
| 53 |
{ initialize first view } |
| 54 |
Window.Container.View := ViewMainMenu; |
| 55 |
end; |
| 56 |
|
| 57 |
initialization |
| 58 |
Application.OnInitialize := @ApplicationInitialize; |
| 59 |
|
| 60 |
Window := TCastleWindow.Create(Application); |
| 61 |
Application.MainWindow := Window; |
| 62 |
end. |